jquery-1.6.1.js 229 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936
  1. /*!
  2. * jQuery JavaScript Library v1.6.1
  3. * http://jquery.com/
  4. *
  5. * Copyright 2011, John Resig
  6. * Dual licensed under the MIT or GPL Version 2 licenses.
  7. * http://jquery.org/license
  8. *
  9. * Includes Sizzle.js
  10. * http://sizzlejs.com/
  11. * Copyright 2011, The Dojo Foundation
  12. * Released under the MIT, BSD, and GPL Licenses.
  13. *
  14. * Date: Thu May 12 15:04:36 2011 -0400
  15. */
  16. (function( window, undefined ) {
  17. // Use the correct document accordingly with window argument (sandbox)
  18. var document = window.document,
  19. navigator = window.navigator,
  20. location = window.location;
  21. var jQuery = (function() {
  22. // Define a local copy of jQuery
  23. var jQuery = function( selector, context ) {
  24. // The jQuery object is actually just the init constructor 'enhanced'
  25. return new jQuery.fn.init( selector, context, rootjQuery );
  26. },
  27. // Map over jQuery in case of overwrite
  28. _jQuery = window.jQuery,
  29. // Map over the $ in case of overwrite
  30. _$ = window.$,
  31. // A central reference to the root jQuery(document)
  32. rootjQuery,
  33. // A simple way to check for HTML strings or ID strings
  34. // (both of which we optimize for)
  35. quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
  36. // Check if a string has a non-whitespace character in it
  37. rnotwhite = /\S/,
  38. // Used for trimming whitespace
  39. trimLeft = /^\s+/,
  40. trimRight = /\s+$/,
  41. // Check for digits
  42. rdigit = /\d/,
  43. // Match a standalone tag
  44. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  45. // JSON RegExp
  46. rvalidchars = /^[\],:{}\s]*$/,
  47. rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  48. rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  49. rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  50. // Useragent RegExp
  51. rwebkit = /(webkit)[ \/]([\w.]+)/,
  52. ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  53. rmsie = /(msie) ([\w.]+)/,
  54. rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
  55. // Keep a UserAgent string for use with jQuery.browser
  56. userAgent = navigator.userAgent,
  57. // For matching the engine and version of the browser
  58. browserMatch,
  59. // The deferred used on DOM ready
  60. readyList,
  61. // The ready event handler
  62. DOMContentLoaded,
  63. // Save a reference to some core methods
  64. toString = Object.prototype.toString,
  65. hasOwn = Object.prototype.hasOwnProperty,
  66. push = Array.prototype.push,
  67. slice = Array.prototype.slice,
  68. trim = String.prototype.trim,
  69. indexOf = Array.prototype.indexOf,
  70. // [[Class]] -> type pairs
  71. class2type = {};
  72. jQuery.fn = jQuery.prototype = {
  73. constructor: jQuery,
  74. init: function( selector, context, rootjQuery ) {
  75. var match, elem, ret, doc;
  76. // Handle $(""), $(null), or $(undefined)
  77. if ( !selector ) {
  78. return this;
  79. }
  80. // Handle $(DOMElement)
  81. if ( selector.nodeType ) {
  82. this.context = this[0] = selector;
  83. this.length = 1;
  84. return this;
  85. }
  86. // The body element only exists once, optimize finding it
  87. if ( selector === "body" && !context && document.body ) {
  88. this.context = document;
  89. this[0] = document.body;
  90. this.selector = selector;
  91. this.length = 1;
  92. return this;
  93. }
  94. // Handle HTML strings
  95. if ( typeof selector === "string" ) {
  96. // Are we dealing with HTML string or an ID?
  97. if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
  98. // Assume that strings that start and end with <> are HTML and skip the regex check
  99. match = [ null, selector, null ];
  100. } else {
  101. match = quickExpr.exec( selector );
  102. }
  103. // Verify a match, and that no context was specified for #id
  104. if ( match && (match[1] || !context) ) {
  105. // HANDLE: $(html) -> $(array)
  106. if ( match[1] ) {
  107. context = context instanceof jQuery ? context[0] : context;
  108. doc = (context ? context.ownerDocument || context : document);
  109. // If a single string is passed in and it's a single tag
  110. // just do a createElement and skip the rest
  111. ret = rsingleTag.exec( selector );
  112. if ( ret ) {
  113. if ( jQuery.isPlainObject( context ) ) {
  114. selector = [ document.createElement( ret[1] ) ];
  115. jQuery.fn.attr.call( selector, context, true );
  116. } else {
  117. selector = [ doc.createElement( ret[1] ) ];
  118. }
  119. } else {
  120. ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
  121. selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
  122. }
  123. return jQuery.merge( this, selector );
  124. // HANDLE: $("#id")
  125. } else {
  126. elem = document.getElementById( match[2] );
  127. // Check parentNode to catch when Blackberry 4.6 returns
  128. // nodes that are no longer in the document #6963
  129. if ( elem && elem.parentNode ) {
  130. // Handle the case where IE and Opera return items
  131. // by name instead of ID
  132. if ( elem.id !== match[2] ) {
  133. return rootjQuery.find( selector );
  134. }
  135. // Otherwise, we inject the element directly into the jQuery object
  136. this.length = 1;
  137. this[0] = elem;
  138. }
  139. this.context = document;
  140. this.selector = selector;
  141. return this;
  142. }
  143. // HANDLE: $(expr, $(...))
  144. } else if ( !context || context.jquery ) {
  145. return (context || rootjQuery).find( selector );
  146. // HANDLE: $(expr, context)
  147. // (which is just equivalent to: $(context).find(expr)
  148. } else {
  149. return this.constructor( context ).find( selector );
  150. }
  151. // HANDLE: $(function)
  152. // Shortcut for document ready
  153. } else if ( jQuery.isFunction( selector ) ) {
  154. return rootjQuery.ready( selector );
  155. }
  156. if (selector.selector !== undefined) {
  157. this.selector = selector.selector;
  158. this.context = selector.context;
  159. }
  160. return jQuery.makeArray( selector, this );
  161. },
  162. // Start with an empty selector
  163. selector: "",
  164. // The current version of jQuery being used
  165. jquery: "1.6.1",
  166. // The default length of a jQuery object is 0
  167. length: 0,
  168. // The number of elements contained in the matched element set
  169. size: function() {
  170. return this.length;
  171. },
  172. toArray: function() {
  173. return slice.call( this, 0 );
  174. },
  175. // Get the Nth element in the matched element set OR
  176. // Get the whole matched element set as a clean array
  177. get: function( num ) {
  178. return num == null ?
  179. // Return a 'clean' array
  180. this.toArray() :
  181. // Return just the object
  182. ( num < 0 ? this[ this.length + num ] : this[ num ] );
  183. },
  184. // Take an array of elements and push it onto the stack
  185. // (returning the new matched element set)
  186. pushStack: function( elems, name, selector ) {
  187. // Build a new jQuery matched element set
  188. var ret = this.constructor();
  189. if ( jQuery.isArray( elems ) ) {
  190. push.apply( ret, elems );
  191. } else {
  192. jQuery.merge( ret, elems );
  193. }
  194. // Add the old object onto the stack (as a reference)
  195. ret.prevObject = this;
  196. ret.context = this.context;
  197. if ( name === "find" ) {
  198. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  199. } else if ( name ) {
  200. ret.selector = this.selector + "." + name + "(" + selector + ")";
  201. }
  202. // Return the newly-formed element set
  203. return ret;
  204. },
  205. // Execute a callback for every element in the matched set.
  206. // (You can seed the arguments with an array of args, but this is
  207. // only used internally.)
  208. each: function( callback, args ) {
  209. return jQuery.each( this, callback, args );
  210. },
  211. ready: function( fn ) {
  212. // Attach the listeners
  213. jQuery.bindReady();
  214. // Add the callback
  215. readyList.done( fn );
  216. return this;
  217. },
  218. eq: function( i ) {
  219. return i === -1 ?
  220. this.slice( i ) :
  221. this.slice( i, +i + 1 );
  222. },
  223. first: function() {
  224. return this.eq( 0 );
  225. },
  226. last: function() {
  227. return this.eq( -1 );
  228. },
  229. slice: function() {
  230. return this.pushStack( slice.apply( this, arguments ),
  231. "slice", slice.call(arguments).join(",") );
  232. },
  233. map: function( callback ) {
  234. return this.pushStack( jQuery.map(this, function( elem, i ) {
  235. return callback.call( elem, i, elem );
  236. }));
  237. },
  238. end: function() {
  239. return this.prevObject || this.constructor(null);
  240. },
  241. // For internal use only.
  242. // Behaves like an Array's method, not like a jQuery method.
  243. push: push,
  244. sort: [].sort,
  245. splice: [].splice
  246. };
  247. // Give the init function the jQuery prototype for later instantiation
  248. jQuery.fn.init.prototype = jQuery.fn;
  249. jQuery.extend = jQuery.fn.extend = function() {
  250. var options, name, src, copy, copyIsArray, clone,
  251. target = arguments[0] || {},
  252. i = 1,
  253. length = arguments.length,
  254. deep = false;
  255. // Handle a deep copy situation
  256. if ( typeof target === "boolean" ) {
  257. deep = target;
  258. target = arguments[1] || {};
  259. // skip the boolean and the target
  260. i = 2;
  261. }
  262. // Handle case when target is a string or something (possible in deep copy)
  263. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  264. target = {};
  265. }
  266. // extend jQuery itself if only one argument is passed
  267. if ( length === i ) {
  268. target = this;
  269. --i;
  270. }
  271. for ( ; i < length; i++ ) {
  272. // Only deal with non-null/undefined values
  273. if ( (options = arguments[ i ]) != null ) {
  274. // Extend the base object
  275. for ( name in options ) {
  276. src = target[ name ];
  277. copy = options[ name ];
  278. // Prevent never-ending loop
  279. if ( target === copy ) {
  280. continue;
  281. }
  282. // Recurse if we're merging plain objects or arrays
  283. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  284. if ( copyIsArray ) {
  285. copyIsArray = false;
  286. clone = src && jQuery.isArray(src) ? src : [];
  287. } else {
  288. clone = src && jQuery.isPlainObject(src) ? src : {};
  289. }
  290. // Never move original objects, clone them
  291. target[ name ] = jQuery.extend( deep, clone, copy );
  292. // Don't bring in undefined values
  293. } else if ( copy !== undefined ) {
  294. target[ name ] = copy;
  295. }
  296. }
  297. }
  298. }
  299. // Return the modified object
  300. return target;
  301. };
  302. jQuery.extend({
  303. noConflict: function( deep ) {
  304. if ( window.$ === jQuery ) {
  305. window.$ = _$;
  306. }
  307. if ( deep && window.jQuery === jQuery ) {
  308. window.jQuery = _jQuery;
  309. }
  310. return jQuery;
  311. },
  312. // Is the DOM ready to be used? Set to true once it occurs.
  313. isReady: false,
  314. // A counter to track how many items to wait for before
  315. // the ready event fires. See #6781
  316. readyWait: 1,
  317. // Hold (or release) the ready event
  318. holdReady: function( hold ) {
  319. if ( hold ) {
  320. jQuery.readyWait++;
  321. } else {
  322. jQuery.ready( true );
  323. }
  324. },
  325. // Handle when the DOM is ready
  326. ready: function( wait ) {
  327. // Either a released hold or an DOMready/load event and not yet ready
  328. if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
  329. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  330. if ( !document.body ) {
  331. return setTimeout( jQuery.ready, 1 );
  332. }
  333. // Remember that the DOM is ready
  334. jQuery.isReady = true;
  335. // If a normal DOM Ready event fired, decrement, and wait if need be
  336. if ( wait !== true && --jQuery.readyWait > 0 ) {
  337. return;
  338. }
  339. // If there are functions bound, to execute
  340. readyList.resolveWith( document, [ jQuery ] );
  341. // Trigger any bound ready events
  342. if ( jQuery.fn.trigger ) {
  343. jQuery( document ).trigger( "ready" ).unbind( "ready" );
  344. }
  345. }
  346. },
  347. bindReady: function() {
  348. if ( readyList ) {
  349. return;
  350. }
  351. readyList = jQuery._Deferred();
  352. // Catch cases where $(document).ready() is called after the
  353. // browser event has already occurred.
  354. if ( document.readyState === "complete" ) {
  355. // Handle it asynchronously to allow scripts the opportunity to delay ready
  356. return setTimeout( jQuery.ready, 1 );
  357. }
  358. // Mozilla, Opera and webkit nightlies currently support this event
  359. if ( document.addEventListener ) {
  360. // Use the handy event callback
  361. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  362. // A fallback to window.onload, that will always work
  363. window.addEventListener( "load", jQuery.ready, false );
  364. // If IE event model is used
  365. } else if ( document.attachEvent ) {
  366. // ensure firing before onload,
  367. // maybe late but safe also for iframes
  368. document.attachEvent( "onreadystatechange", DOMContentLoaded );
  369. // A fallback to window.onload, that will always work
  370. window.attachEvent( "onload", jQuery.ready );
  371. // If IE and not a frame
  372. // continually check to see if the document is ready
  373. var toplevel = false;
  374. try {
  375. toplevel = window.frameElement == null;
  376. } catch(e) {}
  377. if ( document.documentElement.doScroll && toplevel ) {
  378. doScrollCheck();
  379. }
  380. }
  381. },
  382. // See test/unit/core.js for details concerning isFunction.
  383. // Since version 1.3, DOM methods and functions like alert
  384. // aren't supported. They return false on IE (#2968).
  385. isFunction: function( obj ) {
  386. return jQuery.type(obj) === "function";
  387. },
  388. isArray: Array.isArray || function( obj ) {
  389. return jQuery.type(obj) === "array";
  390. },
  391. // A crude way of determining if an object is a window
  392. isWindow: function( obj ) {
  393. return obj && typeof obj === "object" && "setInterval" in obj;
  394. },
  395. isNaN: function( obj ) {
  396. return obj == null || !rdigit.test( obj ) || isNaN( obj );
  397. },
  398. type: function( obj ) {
  399. return obj == null ?
  400. String( obj ) :
  401. class2type[ toString.call(obj) ] || "object";
  402. },
  403. isPlainObject: function( obj ) {
  404. // Must be an Object.
  405. // Because of IE, we also have to check the presence of the constructor property.
  406. // Make sure that DOM nodes and window objects don't pass through, as well
  407. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  408. return false;
  409. }
  410. // Not own constructor property must be Object
  411. if ( obj.constructor &&
  412. !hasOwn.call(obj, "constructor") &&
  413. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  414. return false;
  415. }
  416. // Own properties are enumerated firstly, so to speed up,
  417. // if last one is own, then all properties are own.
  418. var key;
  419. for ( key in obj ) {}
  420. return key === undefined || hasOwn.call( obj, key );
  421. },
  422. isEmptyObject: function( obj ) {
  423. for ( var name in obj ) {
  424. return false;
  425. }
  426. return true;
  427. },
  428. error: function( msg ) {
  429. throw msg;
  430. },
  431. parseJSON: function( data ) {
  432. if ( typeof data !== "string" || !data ) {
  433. return null;
  434. }
  435. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  436. data = jQuery.trim( data );
  437. // Attempt to parse using the native JSON parser first
  438. if ( window.JSON && window.JSON.parse ) {
  439. return window.JSON.parse( data );
  440. }
  441. // Make sure the incoming data is actual JSON
  442. // Logic borrowed from http://json.org/json2.js
  443. if ( rvalidchars.test( data.replace( rvalidescape, "@" )
  444. .replace( rvalidtokens, "]" )
  445. .replace( rvalidbraces, "")) ) {
  446. return (new Function( "return " + data ))();
  447. }
  448. jQuery.error( "Invalid JSON: " + data );
  449. },
  450. // Cross-browser xml parsing
  451. // (xml & tmp used internally)
  452. parseXML: function( data , xml , tmp ) {
  453. if ( window.DOMParser ) { // Standard
  454. tmp = new DOMParser();
  455. xml = tmp.parseFromString( data , "text/xml" );
  456. } else { // IE
  457. xml = new ActiveXObject( "Microsoft.XMLDOM" );
  458. xml.async = "false";
  459. xml.loadXML( data );
  460. }
  461. tmp = xml.documentElement;
  462. if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
  463. jQuery.error( "Invalid XML: " + data );
  464. }
  465. return xml;
  466. },
  467. noop: function() {},
  468. // Evaluates a script in a global context
  469. // Workarounds based on findings by Jim Driscoll
  470. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  471. globalEval: function( data ) {
  472. if ( data && rnotwhite.test( data ) ) {
  473. // We use execScript on Internet Explorer
  474. // We use an anonymous function so that context is window
  475. // rather than jQuery in Firefox
  476. ( window.execScript || function( data ) {
  477. window[ "eval" ].call( window, data );
  478. } )( data );
  479. }
  480. },
  481. nodeName: function( elem, name ) {
  482. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  483. },
  484. // args is for internal usage only
  485. each: function( object, callback, args ) {
  486. var name, i = 0,
  487. length = object.length,
  488. isObj = length === undefined || jQuery.isFunction( object );
  489. if ( args ) {
  490. if ( isObj ) {
  491. for ( name in object ) {
  492. if ( callback.apply( object[ name ], args ) === false ) {
  493. break;
  494. }
  495. }
  496. } else {
  497. for ( ; i < length; ) {
  498. if ( callback.apply( object[ i++ ], args ) === false ) {
  499. break;
  500. }
  501. }
  502. }
  503. // A special, fast, case for the most common use of each
  504. } else {
  505. if ( isObj ) {
  506. for ( name in object ) {
  507. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  508. break;
  509. }
  510. }
  511. } else {
  512. for ( ; i < length; ) {
  513. if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
  514. break;
  515. }
  516. }
  517. }
  518. }
  519. return object;
  520. },
  521. // Use native String.trim function wherever possible
  522. trim: trim ?
  523. function( text ) {
  524. return text == null ?
  525. "" :
  526. trim.call( text );
  527. } :
  528. // Otherwise use our own trimming functionality
  529. function( text ) {
  530. return text == null ?
  531. "" :
  532. text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
  533. },
  534. // results is for internal usage only
  535. makeArray: function( array, results ) {
  536. var ret = results || [];
  537. if ( array != null ) {
  538. // The window, strings (and functions) also have 'length'
  539. // The extra typeof function check is to prevent crashes
  540. // in Safari 2 (See: #3039)
  541. // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
  542. var type = jQuery.type( array );
  543. if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
  544. push.call( ret, array );
  545. } else {
  546. jQuery.merge( ret, array );
  547. }
  548. }
  549. return ret;
  550. },
  551. inArray: function( elem, array ) {
  552. if ( indexOf ) {
  553. return indexOf.call( array, elem );
  554. }
  555. for ( var i = 0, length = array.length; i < length; i++ ) {
  556. if ( array[ i ] === elem ) {
  557. return i;
  558. }
  559. }
  560. return -1;
  561. },
  562. merge: function( first, second ) {
  563. var i = first.length,
  564. j = 0;
  565. if ( typeof second.length === "number" ) {
  566. for ( var l = second.length; j < l; j++ ) {
  567. first[ i++ ] = second[ j ];
  568. }
  569. } else {
  570. while ( second[j] !== undefined ) {
  571. first[ i++ ] = second[ j++ ];
  572. }
  573. }
  574. first.length = i;
  575. return first;
  576. },
  577. grep: function( elems, callback, inv ) {
  578. var ret = [], retVal;
  579. inv = !!inv;
  580. // Go through the array, only saving the items
  581. // that pass the validator function
  582. for ( var i = 0, length = elems.length; i < length; i++ ) {
  583. retVal = !!callback( elems[ i ], i );
  584. if ( inv !== retVal ) {
  585. ret.push( elems[ i ] );
  586. }
  587. }
  588. return ret;
  589. },
  590. // arg is for internal usage only
  591. map: function( elems, callback, arg ) {
  592. var value, key, ret = [],
  593. i = 0,
  594. length = elems.length,
  595. // jquery objects are treated as arrays
  596. isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
  597. // Go through the array, translating each of the items to their
  598. if ( isArray ) {
  599. for ( ; i < length; i++ ) {
  600. value = callback( elems[ i ], i, arg );
  601. if ( value != null ) {
  602. ret[ ret.length ] = value;
  603. }
  604. }
  605. // Go through every key on the object,
  606. } else {
  607. for ( key in elems ) {
  608. value = callback( elems[ key ], key, arg );
  609. if ( value != null ) {
  610. ret[ ret.length ] = value;
  611. }
  612. }
  613. }
  614. // Flatten any nested arrays
  615. return ret.concat.apply( [], ret );
  616. },
  617. // A global GUID counter for objects
  618. guid: 1,
  619. // Bind a function to a context, optionally partially applying any
  620. // arguments.
  621. proxy: function( fn, context ) {
  622. if ( typeof context === "string" ) {
  623. var tmp = fn[ context ];
  624. context = fn;
  625. fn = tmp;
  626. }
  627. // Quick check to determine if target is callable, in the spec
  628. // this throws a TypeError, but we will just return undefined.
  629. if ( !jQuery.isFunction( fn ) ) {
  630. return undefined;
  631. }
  632. // Simulated bind
  633. var args = slice.call( arguments, 2 ),
  634. proxy = function() {
  635. return fn.apply( context, args.concat( slice.call( arguments ) ) );
  636. };
  637. // Set the guid of unique handler to the same of original handler, so it can be removed
  638. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  639. return proxy;
  640. },
  641. // Mutifunctional method to get and set values to a collection
  642. // The value/s can be optionally by executed if its a function
  643. access: function( elems, key, value, exec, fn, pass ) {
  644. var length = elems.length;
  645. // Setting many attributes
  646. if ( typeof key === "object" ) {
  647. for ( var k in key ) {
  648. jQuery.access( elems, k, key[k], exec, fn, value );
  649. }
  650. return elems;
  651. }
  652. // Setting one attribute
  653. if ( value !== undefined ) {
  654. // Optionally, function values get executed if exec is true
  655. exec = !pass && exec && jQuery.isFunction(value);
  656. for ( var i = 0; i < length; i++ ) {
  657. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  658. }
  659. return elems;
  660. }
  661. // Getting an attribute
  662. return length ? fn( elems[0], key ) : undefined;
  663. },
  664. now: function() {
  665. return (new Date()).getTime();
  666. },
  667. // Use of jQuery.browser is frowned upon.
  668. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  669. uaMatch: function( ua ) {
  670. ua = ua.toLowerCase();
  671. var match = rwebkit.exec( ua ) ||
  672. ropera.exec( ua ) ||
  673. rmsie.exec( ua ) ||
  674. ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
  675. [];
  676. return { browser: match[1] || "", version: match[2] || "0" };
  677. },
  678. sub: function() {
  679. function jQuerySub( selector, context ) {
  680. return new jQuerySub.fn.init( selector, context );
  681. }
  682. jQuery.extend( true, jQuerySub, this );
  683. jQuerySub.superclass = this;
  684. jQuerySub.fn = jQuerySub.prototype = this();
  685. jQuerySub.fn.constructor = jQuerySub;
  686. jQuerySub.sub = this.sub;
  687. jQuerySub.fn.init = function init( selector, context ) {
  688. if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
  689. context = jQuerySub( context );
  690. }
  691. return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
  692. };
  693. jQuerySub.fn.init.prototype = jQuerySub.fn;
  694. var rootjQuerySub = jQuerySub(document);
  695. return jQuerySub;
  696. },
  697. browser: {}
  698. });
  699. // Populate the class2type map
  700. jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
  701. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  702. });
  703. browserMatch = jQuery.uaMatch( userAgent );
  704. if ( browserMatch.browser ) {
  705. jQuery.browser[ browserMatch.browser ] = true;
  706. jQuery.browser.version = browserMatch.version;
  707. }
  708. // Deprecated, use jQuery.browser.webkit instead
  709. if ( jQuery.browser.webkit ) {
  710. jQuery.browser.safari = true;
  711. }
  712. // IE doesn't match non-breaking spaces with \s
  713. if ( rnotwhite.test( "\xA0" ) ) {
  714. trimLeft = /^[\s\xA0]+/;
  715. trimRight = /[\s\xA0]+$/;
  716. }
  717. // All jQuery objects should point back to these
  718. rootjQuery = jQuery(document);
  719. // Cleanup functions for the document ready method
  720. if ( document.addEventListener ) {
  721. DOMContentLoaded = function() {
  722. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  723. jQuery.ready();
  724. };
  725. } else if ( document.attachEvent ) {
  726. DOMContentLoaded = function() {
  727. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  728. if ( document.readyState === "complete" ) {
  729. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  730. jQuery.ready();
  731. }
  732. };
  733. }
  734. // The DOM ready check for Internet Explorer
  735. function doScrollCheck() {
  736. if ( jQuery.isReady ) {
  737. return;
  738. }
  739. try {
  740. // If IE is used, use the trick by Diego Perini
  741. // http://javascript.nwbox.com/IEContentLoaded/
  742. document.documentElement.doScroll("left");
  743. } catch(e) {
  744. setTimeout( doScrollCheck, 1 );
  745. return;
  746. }
  747. // and execute any waiting functions
  748. jQuery.ready();
  749. }
  750. // Expose jQuery to the global object
  751. return jQuery;
  752. })();
  753. var // Promise methods
  754. promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
  755. // Static reference to slice
  756. sliceDeferred = [].slice;
  757. jQuery.extend({
  758. // Create a simple deferred (one callbacks list)
  759. _Deferred: function() {
  760. var // callbacks list
  761. callbacks = [],
  762. // stored [ context , args ]
  763. fired,
  764. // to avoid firing when already doing so
  765. firing,
  766. // flag to know if the deferred has been cancelled
  767. cancelled,
  768. // the deferred itself
  769. deferred = {
  770. // done( f1, f2, ...)
  771. done: function() {
  772. if ( !cancelled ) {
  773. var args = arguments,
  774. i,
  775. length,
  776. elem,
  777. type,
  778. _fired;
  779. if ( fired ) {
  780. _fired = fired;
  781. fired = 0;
  782. }
  783. for ( i = 0, length = args.length; i < length; i++ ) {
  784. elem = args[ i ];
  785. type = jQuery.type( elem );
  786. if ( type === "array" ) {
  787. deferred.done.apply( deferred, elem );
  788. } else if ( type === "function" ) {
  789. callbacks.push( elem );
  790. }
  791. }
  792. if ( _fired ) {
  793. deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
  794. }
  795. }
  796. return this;
  797. },
  798. // resolve with given context and args
  799. resolveWith: function( context, args ) {
  800. if ( !cancelled && !fired && !firing ) {
  801. // make sure args are available (#8421)
  802. args = args || [];
  803. firing = 1;
  804. try {
  805. while( callbacks[ 0 ] ) {
  806. callbacks.shift().apply( context, args );
  807. }
  808. }
  809. finally {
  810. fired = [ context, args ];
  811. firing = 0;
  812. }
  813. }
  814. return this;
  815. },
  816. // resolve with this as context and given arguments
  817. resolve: function() {
  818. deferred.resolveWith( this, arguments );
  819. return this;
  820. },
  821. // Has this deferred been resolved?
  822. isResolved: function() {
  823. return !!( firing || fired );
  824. },
  825. // Cancel
  826. cancel: function() {
  827. cancelled = 1;
  828. callbacks = [];
  829. return this;
  830. }
  831. };
  832. return deferred;
  833. },
  834. // Full fledged deferred (two callbacks list)
  835. Deferred: function( func ) {
  836. var deferred = jQuery._Deferred(),
  837. failDeferred = jQuery._Deferred(),
  838. promise;
  839. // Add errorDeferred methods, then and promise
  840. jQuery.extend( deferred, {
  841. then: function( doneCallbacks, failCallbacks ) {
  842. deferred.done( doneCallbacks ).fail( failCallbacks );
  843. return this;
  844. },
  845. always: function() {
  846. return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
  847. },
  848. fail: failDeferred.done,
  849. rejectWith: failDeferred.resolveWith,
  850. reject: failDeferred.resolve,
  851. isRejected: failDeferred.isResolved,
  852. pipe: function( fnDone, fnFail ) {
  853. return jQuery.Deferred(function( newDefer ) {
  854. jQuery.each( {
  855. done: [ fnDone, "resolve" ],
  856. fail: [ fnFail, "reject" ]
  857. }, function( handler, data ) {
  858. var fn = data[ 0 ],
  859. action = data[ 1 ],
  860. returned;
  861. if ( jQuery.isFunction( fn ) ) {
  862. deferred[ handler ](function() {
  863. returned = fn.apply( this, arguments );
  864. if ( returned && jQuery.isFunction( returned.promise ) ) {
  865. returned.promise().then( newDefer.resolve, newDefer.reject );
  866. } else {
  867. newDefer[ action ]( returned );
  868. }
  869. });
  870. } else {
  871. deferred[ handler ]( newDefer[ action ] );
  872. }
  873. });
  874. }).promise();
  875. },
  876. // Get a promise for this deferred
  877. // If obj is provided, the promise aspect is added to the object
  878. promise: function( obj ) {
  879. if ( obj == null ) {
  880. if ( promise ) {
  881. return promise;
  882. }
  883. promise = obj = {};
  884. }
  885. var i = promiseMethods.length;
  886. while( i-- ) {
  887. obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
  888. }
  889. return obj;
  890. }
  891. });
  892. // Make sure only one callback list will be used
  893. deferred.done( failDeferred.cancel ).fail( deferred.cancel );
  894. // Unexpose cancel
  895. delete deferred.cancel;
  896. // Call given func if any
  897. if ( func ) {
  898. func.call( deferred, deferred );
  899. }
  900. return deferred;
  901. },
  902. // Deferred helper
  903. when: function( firstParam ) {
  904. var args = arguments,
  905. i = 0,
  906. length = args.length,
  907. count = length,
  908. deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
  909. firstParam :
  910. jQuery.Deferred();
  911. function resolveFunc( i ) {
  912. return function( value ) {
  913. args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
  914. if ( !( --count ) ) {
  915. // Strange bug in FF4:
  916. // Values changed onto the arguments object sometimes end up as undefined values
  917. // outside the $.when method. Cloning the object into a fresh array solves the issue
  918. deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
  919. }
  920. };
  921. }
  922. if ( length > 1 ) {
  923. for( ; i < length; i++ ) {
  924. if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
  925. args[ i ].promise().then( resolveFunc(i), deferred.reject );
  926. } else {
  927. --count;
  928. }
  929. }
  930. if ( !count ) {
  931. deferred.resolveWith( deferred, args );
  932. }
  933. } else if ( deferred !== firstParam ) {
  934. deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
  935. }
  936. return deferred.promise();
  937. }
  938. });
  939. jQuery.support = (function() {
  940. var div = document.createElement( "div" ),
  941. documentElement = document.documentElement,
  942. all,
  943. a,
  944. select,
  945. opt,
  946. input,
  947. marginDiv,
  948. support,
  949. fragment,
  950. body,
  951. bodyStyle,
  952. tds,
  953. events,
  954. eventName,
  955. i,
  956. isSupported;
  957. // Preliminary tests
  958. div.setAttribute("className", "t");
  959. div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  960. all = div.getElementsByTagName( "*" );
  961. a = div.getElementsByTagName( "a" )[ 0 ];
  962. // Can't get basic test support
  963. if ( !all || !all.length || !a ) {
  964. return {};
  965. }
  966. // First batch of supports tests
  967. select = document.createElement( "select" );
  968. opt = select.appendChild( document.createElement("option") );
  969. input = div.getElementsByTagName( "input" )[ 0 ];
  970. support = {
  971. // IE strips leading whitespace when .innerHTML is used
  972. leadingWhitespace: ( div.firstChild.nodeType === 3 ),
  973. // Make sure that tbody elements aren't automatically inserted
  974. // IE will insert them into empty tables
  975. tbody: !div.getElementsByTagName( "tbody" ).length,
  976. // Make sure that link elements get serialized correctly by innerHTML
  977. // This requires a wrapper element in IE
  978. htmlSerialize: !!div.getElementsByTagName( "link" ).length,
  979. // Get the style information from getAttribute
  980. // (IE uses .cssText instead)
  981. style: /top/.test( a.getAttribute("style") ),
  982. // Make sure that URLs aren't manipulated
  983. // (IE normalizes it by default)
  984. hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
  985. // Make sure that element opacity exists
  986. // (IE uses filter instead)
  987. // Use a regex to work around a WebKit issue. See #5145
  988. opacity: /^0.55$/.test( a.style.opacity ),
  989. // Verify style float existence
  990. // (IE uses styleFloat instead of cssFloat)
  991. cssFloat: !!a.style.cssFloat,
  992. // Make sure that if no value is specified for a checkbox
  993. // that it defaults to "on".
  994. // (WebKit defaults to "" instead)
  995. checkOn: ( input.value === "on" ),
  996. // Make sure that a selected-by-default option has a working selected property.
  997. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  998. optSelected: opt.selected,
  999. // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  1000. getSetAttribute: div.className !== "t",
  1001. // Will be defined later
  1002. submitBubbles: true,
  1003. changeBubbles: true,
  1004. focusinBubbles: false,
  1005. deleteExpando: true,
  1006. noCloneEvent: true,
  1007. inlineBlockNeedsLayout: false,
  1008. shrinkWrapBlocks: false,
  1009. reliableMarginRight: true
  1010. };
  1011. // Make sure checked status is properly cloned
  1012. input.checked = true;
  1013. support.noCloneChecked = input.cloneNode( true ).checked;
  1014. // Make sure that the options inside disabled selects aren't marked as disabled
  1015. // (WebKit marks them as disabled)
  1016. select.disabled = true;
  1017. support.optDisabled = !opt.disabled;
  1018. // Test to see if it's possible to delete an expando from an element
  1019. // Fails in Internet Explorer
  1020. try {
  1021. delete div.test;
  1022. } catch( e ) {
  1023. support.deleteExpando = false;
  1024. }
  1025. if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
  1026. div.attachEvent( "onclick", function click() {
  1027. // Cloning a node shouldn't copy over any
  1028. // bound event handlers (IE does this)
  1029. support.noCloneEvent = false;
  1030. div.detachEvent( "onclick", click );
  1031. });
  1032. div.cloneNode( true ).fireEvent( "onclick" );
  1033. }
  1034. // Check if a radio maintains it's value
  1035. // after being appended to the DOM
  1036. input = document.createElement("input");
  1037. input.value = "t";
  1038. input.setAttribute("type", "radio");
  1039. support.radioValue = input.value === "t";
  1040. input.setAttribute("checked", "checked");
  1041. div.appendChild( input );
  1042. fragment = document.createDocumentFragment();
  1043. fragment.appendChild( div.firstChild );
  1044. // WebKit doesn't clone checked state correctly in fragments
  1045. support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
  1046. div.innerHTML = "";
  1047. // Figure out if the W3C box model works as expected
  1048. div.style.width = div.style.paddingLeft = "1px";
  1049. // We use our own, invisible, body
  1050. body = document.createElement( "body" );
  1051. bodyStyle = {
  1052. visibility: "hidden",
  1053. width: 0,
  1054. height: 0,
  1055. border: 0,
  1056. margin: 0,
  1057. // Set background to avoid IE crashes when removing (#9028)
  1058. background: "none"
  1059. };
  1060. for ( i in bodyStyle ) {
  1061. body.style[ i ] = bodyStyle[ i ];
  1062. }
  1063. body.appendChild( div );
  1064. documentElement.insertBefore( body, documentElement.firstChild );
  1065. // Check if a disconnected checkbox will retain its checked
  1066. // value of true after appended to the DOM (IE6/7)
  1067. support.appendChecked = input.checked;
  1068. support.boxModel = div.offsetWidth === 2;
  1069. if ( "zoom" in div.style ) {
  1070. // Check if natively block-level elements act like inline-block
  1071. // elements when setting their display to 'inline' and giving
  1072. // them layout
  1073. // (IE < 8 does this)
  1074. div.style.display = "inline";
  1075. div.style.zoom = 1;
  1076. support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
  1077. // Check if elements with layout shrink-wrap their children
  1078. // (IE 6 does this)
  1079. div.style.display = "";
  1080. div.innerHTML = "<div style='width:4px;'></div>";
  1081. support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
  1082. }
  1083. div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
  1084. tds = div.getElementsByTagName( "td" );
  1085. // Check if table cells still have offsetWidth/Height when they are set
  1086. // to display:none and there are still other visible table cells in a
  1087. // table row; if so, offsetWidth/Height are not reliable for use when
  1088. // determining if an element has been hidden directly using
  1089. // display:none (it is still safe to use offsets if a parent element is
  1090. // hidden; don safety goggles and see bug #4512 for more information).
  1091. // (only IE 8 fails this test)
  1092. isSupported = ( tds[ 0 ].offsetHeight === 0 );
  1093. tds[ 0 ].style.display = "";
  1094. tds[ 1 ].style.display = "none";
  1095. // Check if empty table cells still have offsetWidth/Height
  1096. // (IE < 8 fail this test)
  1097. support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
  1098. div.innerHTML = "";
  1099. // Check if div with explicit width and no margin-right incorrectly
  1100. // gets computed margin-right based on width of container. For more
  1101. // info see bug #3333
  1102. // Fails in WebKit before Feb 2011 nightlies
  1103. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  1104. if ( document.defaultView && document.defaultView.getComputedStyle ) {
  1105. marginDiv = document.createElement( "div" );
  1106. marginDiv.style.width = "0";
  1107. marginDiv.style.marginRight = "0";
  1108. div.appendChild( marginDiv );
  1109. support.reliableMarginRight =
  1110. ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
  1111. }
  1112. // Remove the body element we added
  1113. body.innerHTML = "";
  1114. documentElement.removeChild( body );
  1115. // Technique from Juriy Zaytsev
  1116. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  1117. // We only care about the case where non-standard event systems
  1118. // are used, namely in IE. Short-circuiting here helps us to
  1119. // avoid an eval call (in setAttribute) which can cause CSP
  1120. // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
  1121. if ( div.attachEvent ) {
  1122. for( i in {
  1123. submit: 1,
  1124. change: 1,
  1125. focusin: 1
  1126. } ) {
  1127. eventName = "on" + i;
  1128. isSupported = ( eventName in div );
  1129. if ( !isSupported ) {
  1130. div.setAttribute( eventName, "return;" );
  1131. isSupported = ( typeof div[ eventName ] === "function" );
  1132. }
  1133. support[ i + "Bubbles" ] = isSupported;
  1134. }
  1135. }
  1136. return support;
  1137. })();
  1138. // Keep track of boxModel
  1139. jQuery.boxModel = jQuery.support.boxModel;
  1140. var rbrace = /^(?:\{.*\}|\[.*\])$/,
  1141. rmultiDash = /([a-z])([A-Z])/g;
  1142. jQuery.extend({
  1143. cache: {},
  1144. // Please use with caution
  1145. uuid: 0,
  1146. // Unique for each copy of jQuery on the page
  1147. // Non-digits removed to match rinlinejQuery
  1148. expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
  1149. // The following elements throw uncatchable exceptions if you
  1150. // attempt to add expando properties to them.
  1151. noData: {
  1152. "embed": true,
  1153. // Ban all objects except for Flash (which handle expandos)
  1154. "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  1155. "applet": true
  1156. },
  1157. hasData: function( elem ) {
  1158. elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
  1159. return !!elem && !isEmptyDataObject( elem );
  1160. },
  1161. data: function( elem, name, data, pvt /* Internal Use Only */ ) {
  1162. if ( !jQuery.acceptData( elem ) ) {
  1163. return;
  1164. }
  1165. var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
  1166. // We have to handle DOM nodes and JS objects differently because IE6-7
  1167. // can't GC object references properly across the DOM-JS boundary
  1168. isNode = elem.nodeType,
  1169. // Only DOM nodes need the global jQuery cache; JS object data is
  1170. // attached directly to the object so GC can occur automatically
  1171. cache = isNode ? jQuery.cache : elem,
  1172. // Only defining an ID for JS objects if its cache already exists allows
  1173. // the code to shortcut on the same path as a DOM node with no cache
  1174. id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
  1175. // Avoid doing any more work than we need to when trying to get data on an
  1176. // object that has no data at all
  1177. if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
  1178. return;
  1179. }
  1180. if ( !id ) {
  1181. // Only DOM nodes need a new unique ID for each element since their data
  1182. // ends up in the global cache
  1183. if ( isNode ) {
  1184. elem[ jQuery.expando ] = id = ++jQuery.uuid;
  1185. } else {
  1186. id = jQuery.expando;
  1187. }
  1188. }
  1189. if ( !cache[ id ] ) {
  1190. cache[ id ] = {};
  1191. // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
  1192. // metadata on plain JS objects when the object is serialized using
  1193. // JSON.stringify
  1194. if ( !isNode ) {
  1195. cache[ id ].toJSON = jQuery.noop;
  1196. }
  1197. }
  1198. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  1199. // shallow copied over onto the existing cache
  1200. if ( typeof name === "object" || typeof name === "function" ) {
  1201. if ( pvt ) {
  1202. cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
  1203. } else {
  1204. cache[ id ] = jQuery.extend(cache[ id ], name);
  1205. }
  1206. }
  1207. thisCache = cache[ id ];
  1208. // Internal jQuery data is stored in a separate object inside the object's data
  1209. // cache in order to avoid key collisions between internal data and user-defined
  1210. // data
  1211. if ( pvt ) {
  1212. if ( !thisCache[ internalKey ] ) {
  1213. thisCache[ internalKey ] = {};
  1214. }
  1215. thisCache = thisCache[ internalKey ];
  1216. }
  1217. if ( data !== undefined ) {
  1218. thisCache[ jQuery.camelCase( name ) ] = data;
  1219. }
  1220. // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
  1221. // not attempt to inspect the internal events object using jQuery.data, as this
  1222. // internal data object is undocumented and subject to change.
  1223. if ( name === "events" && !thisCache[name] ) {
  1224. return thisCache[ internalKey ] && thisCache[ internalKey ].events;
  1225. }
  1226. return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
  1227. },
  1228. removeData: function( elem, name, pvt /* Internal Use Only */ ) {
  1229. if ( !jQuery.acceptData( elem ) ) {
  1230. return;
  1231. }
  1232. var internalKey = jQuery.expando, isNode = elem.nodeType,
  1233. // See jQuery.data for more information
  1234. cache = isNode ? jQuery.cache : elem,
  1235. // See jQuery.data for more information
  1236. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  1237. // If there is already no cache entry for this object, there is no
  1238. // purpose in continuing
  1239. if ( !cache[ id ] ) {
  1240. return;
  1241. }
  1242. if ( name ) {
  1243. var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
  1244. if ( thisCache ) {
  1245. delete thisCache[ name ];
  1246. // If there is no data left in the cache, we want to continue
  1247. // and let the cache object itself get destroyed
  1248. if ( !isEmptyDataObject(thisCache) ) {
  1249. return;
  1250. }
  1251. }
  1252. }
  1253. // See jQuery.data for more information
  1254. if ( pvt ) {
  1255. delete cache[ id ][ internalKey ];
  1256. // Don't destroy the parent cache unless the internal data object
  1257. // had been the only thing left in it
  1258. if ( !isEmptyDataObject(cache[ id ]) ) {
  1259. return;
  1260. }
  1261. }
  1262. var internalCache = cache[ id ][ internalKey ];
  1263. // Browsers that fail expando deletion also refuse to delete expandos on
  1264. // the window, but it will allow it on all other JS objects; other browsers
  1265. // don't care
  1266. if ( jQuery.support.deleteExpando || cache != window ) {
  1267. delete cache[ id ];
  1268. } else {
  1269. cache[ id ] = null;
  1270. }
  1271. // We destroyed the entire user cache at once because it's faster than
  1272. // iterating through each key, but we need to continue to persist internal
  1273. // data if it existed
  1274. if ( internalCache ) {
  1275. cache[ id ] = {};
  1276. // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
  1277. // metadata on plain JS objects when the object is serialized using
  1278. // JSON.stringify
  1279. if ( !isNode ) {
  1280. cache[ id ].toJSON = jQuery.noop;
  1281. }
  1282. cache[ id ][ internalKey ] = internalCache;
  1283. // Otherwise, we need to eliminate the expando on the node to avoid
  1284. // false lookups in the cache for entries that no longer exist
  1285. } else if ( isNode ) {
  1286. // IE does not allow us to delete expando properties from nodes,
  1287. // nor does it have a removeAttribute function on Document nodes;
  1288. // we must handle all of these cases
  1289. if ( jQuery.support.deleteExpando ) {
  1290. delete elem[ jQuery.expando ];
  1291. } else if ( elem.removeAttribute ) {
  1292. elem.removeAttribute( jQuery.expando );
  1293. } else {
  1294. elem[ jQuery.expando ] = null;
  1295. }
  1296. }
  1297. },
  1298. // For internal use only.
  1299. _data: function( elem, name, data ) {
  1300. return jQuery.data( elem, name, data, true );
  1301. },
  1302. // A method for determining if a DOM node can handle the data expando
  1303. acceptData: function( elem ) {
  1304. if ( elem.nodeName ) {
  1305. var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
  1306. if ( match ) {
  1307. return !(match === true || elem.getAttribute("classid") !== match);
  1308. }
  1309. }
  1310. return true;
  1311. }
  1312. });
  1313. jQuery.fn.extend({
  1314. data: function( key, value ) {
  1315. var data = null;
  1316. if ( typeof key === "undefined" ) {
  1317. if ( this.length ) {
  1318. data = jQuery.data( this[0] );
  1319. if ( this[0].nodeType === 1 ) {
  1320. var attr = this[0].attributes, name;
  1321. for ( var i = 0, l = attr.length; i < l; i++ ) {
  1322. name = attr[i].name;
  1323. if ( name.indexOf( "data-" ) === 0 ) {
  1324. name = jQuery.camelCase( name.substring(5) );
  1325. dataAttr( this[0], name, data[ name ] );
  1326. }
  1327. }
  1328. }
  1329. }
  1330. return data;
  1331. } else if ( typeof key === "object" ) {
  1332. return this.each(function() {
  1333. jQuery.data( this, key );
  1334. });
  1335. }
  1336. var parts = key.split(".");
  1337. parts[1] = parts[1] ? "." + parts[1] : "";
  1338. if ( value === undefined ) {
  1339. data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1340. // Try to fetch any internally stored data first
  1341. if ( data === undefined && this.length ) {
  1342. data = jQuery.data( this[0], key );
  1343. data = dataAttr( this[0], key, data );
  1344. }
  1345. return data === undefined && parts[1] ?
  1346. this.data( parts[0] ) :
  1347. data;
  1348. } else {
  1349. return this.each(function() {
  1350. var $this = jQuery( this ),
  1351. args = [ parts[0], value ];
  1352. $this.triggerHandler( "setData" + parts[1] + "!", args );
  1353. jQuery.data( this, key, value );
  1354. $this.triggerHandler( "changeData" + parts[1] + "!", args );
  1355. });
  1356. }
  1357. },
  1358. removeData: function( key ) {
  1359. return this.each(function() {
  1360. jQuery.removeData( this, key );
  1361. });
  1362. }
  1363. });
  1364. function dataAttr( elem, key, data ) {
  1365. // If nothing was found internally, try to fetch any
  1366. // data from the HTML5 data-* attribute
  1367. if ( data === undefined && elem.nodeType === 1 ) {
  1368. var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
  1369. data = elem.getAttribute( name );
  1370. if ( typeof data === "string" ) {
  1371. try {
  1372. data = data === "true" ? true :
  1373. data === "false" ? false :
  1374. data === "null" ? null :
  1375. !jQuery.isNaN( data ) ? parseFloat( data ) :
  1376. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  1377. data;
  1378. } catch( e ) {}
  1379. // Make sure we set the data so it isn't changed later
  1380. jQuery.data( elem, key, data );
  1381. } else {
  1382. data = undefined;
  1383. }
  1384. }
  1385. return data;
  1386. }
  1387. // TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
  1388. // property to be considered empty objects; this property always exists in
  1389. // order to make sure JSON.stringify does not expose internal metadata
  1390. function isEmptyDataObject( obj ) {
  1391. for ( var name in obj ) {
  1392. if ( name !== "toJSON" ) {
  1393. return false;
  1394. }
  1395. }
  1396. return true;
  1397. }
  1398. function handleQueueMarkDefer( elem, type, src ) {
  1399. var deferDataKey = type + "defer",
  1400. queueDataKey = type + "queue",
  1401. markDataKey = type + "mark",
  1402. defer = jQuery.data( elem, deferDataKey, undefined, true );
  1403. if ( defer &&
  1404. ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
  1405. ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
  1406. // Give room for hard-coded callbacks to fire first
  1407. // and eventually mark/queue something else on the element
  1408. setTimeout( function() {
  1409. if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
  1410. !jQuery.data( elem, markDataKey, undefined, true ) ) {
  1411. jQuery.removeData( elem, deferDataKey, true );
  1412. defer.resolve();
  1413. }
  1414. }, 0 );
  1415. }
  1416. }
  1417. jQuery.extend({
  1418. _mark: function( elem, type ) {
  1419. if ( elem ) {
  1420. type = (type || "fx") + "mark";
  1421. jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
  1422. }
  1423. },
  1424. _unmark: function( force, elem, type ) {
  1425. if ( force !== true ) {
  1426. type = elem;
  1427. elem = force;
  1428. force = false;
  1429. }
  1430. if ( elem ) {
  1431. type = type || "fx";
  1432. var key = type + "mark",
  1433. count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
  1434. if ( count ) {
  1435. jQuery.data( elem, key, count, true );
  1436. } else {
  1437. jQuery.removeData( elem, key, true );
  1438. handleQueueMarkDefer( elem, type, "mark" );
  1439. }
  1440. }
  1441. },
  1442. queue: function( elem, type, data ) {
  1443. if ( elem ) {
  1444. type = (type || "fx") + "queue";
  1445. var q = jQuery.data( elem, type, undefined, true );
  1446. // Speed up dequeue by getting out quickly if this is just a lookup
  1447. if ( data ) {
  1448. if ( !q || jQuery.isArray(data) ) {
  1449. q = jQuery.data( elem, type, jQuery.makeArray(data), true );
  1450. } else {
  1451. q.push( data );
  1452. }
  1453. }
  1454. return q || [];
  1455. }
  1456. },
  1457. dequeue: function( elem, type ) {
  1458. type = type || "fx";
  1459. var queue = jQuery.queue( elem, type ),
  1460. fn = queue.shift(),
  1461. defer;
  1462. // If the fx queue is dequeued, always remove the progress sentinel
  1463. if ( fn === "inprogress" ) {
  1464. fn = queue.shift();
  1465. }
  1466. if ( fn ) {
  1467. // Add a progress sentinel to prevent the fx queue from being
  1468. // automatically dequeued
  1469. if ( type === "fx" ) {
  1470. queue.unshift("inprogress");
  1471. }
  1472. fn.call(elem, function() {
  1473. jQuery.dequeue(elem, type);
  1474. });
  1475. }
  1476. if ( !queue.length ) {
  1477. jQuery.removeData( elem, type + "queue", true );
  1478. handleQueueMarkDefer( elem, type, "queue" );
  1479. }
  1480. }
  1481. });
  1482. jQuery.fn.extend({
  1483. queue: function( type, data ) {
  1484. if ( typeof type !== "string" ) {
  1485. data = type;
  1486. type = "fx";
  1487. }
  1488. if ( data === undefined ) {
  1489. return jQuery.queue( this[0], type );
  1490. }
  1491. return this.each(function() {
  1492. var queue = jQuery.queue( this, type, data );
  1493. if ( type === "fx" && queue[0] !== "inprogress" ) {
  1494. jQuery.dequeue( this, type );
  1495. }
  1496. });
  1497. },
  1498. dequeue: function( type ) {
  1499. return this.each(function() {
  1500. jQuery.dequeue( this, type );
  1501. });
  1502. },
  1503. // Based off of the plugin by Clint Helfers, with permission.
  1504. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  1505. delay: function( time, type ) {
  1506. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  1507. type = type || "fx";
  1508. return this.queue( type, function() {
  1509. var elem = this;
  1510. setTimeout(function() {
  1511. jQuery.dequeue( elem, type );
  1512. }, time );
  1513. });
  1514. },
  1515. clearQueue: function( type ) {
  1516. return this.queue( type || "fx", [] );
  1517. },
  1518. // Get a promise resolved when queues of a certain type
  1519. // are emptied (fx is the type by default)
  1520. promise: function( type, object ) {
  1521. if ( typeof type !== "string" ) {
  1522. object = type;
  1523. type = undefined;
  1524. }
  1525. type = type || "fx";
  1526. var defer = jQuery.Deferred(),
  1527. elements = this,
  1528. i = elements.length,
  1529. count = 1,
  1530. deferDataKey = type + "defer",
  1531. queueDataKey = type + "queue",
  1532. markDataKey = type + "mark",
  1533. tmp;
  1534. function resolve() {
  1535. if ( !( --count ) ) {
  1536. defer.resolveWith( elements, [ elements ] );
  1537. }
  1538. }
  1539. while( i-- ) {
  1540. if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
  1541. ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
  1542. jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
  1543. jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
  1544. count++;
  1545. tmp.done( resolve );
  1546. }
  1547. }
  1548. resolve();
  1549. return defer.promise();
  1550. }
  1551. });
  1552. var rclass = /[\n\t\r]/g,
  1553. rspace = /\s+/,
  1554. rreturn = /\r/g,
  1555. rtype = /^(?:button|input)$/i,
  1556. rfocusable = /^(?:button|input|object|select|textarea)$/i,
  1557. rclickable = /^a(?:rea)?$/i,
  1558. rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
  1559. rinvalidChar = /\:/,
  1560. formHook, boolHook;
  1561. jQuery.fn.extend({
  1562. attr: function( name, value ) {
  1563. return jQuery.access( this, name, value, true, jQuery.attr );
  1564. },
  1565. removeAttr: function( name ) {
  1566. return this.each(function() {
  1567. jQuery.removeAttr( this, name );
  1568. });
  1569. },
  1570. prop: function( name, value ) {
  1571. return jQuery.access( this, name, value, true, jQuery.prop );
  1572. },
  1573. removeProp: function( name ) {
  1574. name = jQuery.propFix[ name ] || name;
  1575. return this.each(function() {
  1576. // try/catch handles cases where IE balks (such as removing a property on window)
  1577. try {
  1578. this[ name ] = undefined;
  1579. delete this[ name ];
  1580. } catch( e ) {}
  1581. });
  1582. },
  1583. addClass: function( value ) {
  1584. if ( jQuery.isFunction( value ) ) {
  1585. return this.each(function(i) {
  1586. var self = jQuery(this);
  1587. self.addClass( value.call(this, i, self.attr("class") || "") );
  1588. });
  1589. }
  1590. if ( value && typeof value === "string" ) {
  1591. var classNames = (value || "").split( rspace );
  1592. for ( var i = 0, l = this.length; i < l; i++ ) {
  1593. var elem = this[i];
  1594. if ( elem.nodeType === 1 ) {
  1595. if ( !elem.className ) {
  1596. elem.className = value;
  1597. } else {
  1598. var className = " " + elem.className + " ",
  1599. setClass = elem.className;
  1600. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1601. if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
  1602. setClass += " " + classNames[c];
  1603. }
  1604. }
  1605. elem.className = jQuery.trim( setClass );
  1606. }
  1607. }
  1608. }
  1609. }
  1610. return this;
  1611. },
  1612. removeClass: function( value ) {
  1613. if ( jQuery.isFunction(value) ) {
  1614. return this.each(function(i) {
  1615. var self = jQuery(this);
  1616. self.removeClass( value.call(this, i, self.attr("class")) );
  1617. });
  1618. }
  1619. if ( (value && typeof value === "string") || value === undefined ) {
  1620. var classNames = (value || "").split( rspace );
  1621. for ( var i = 0, l = this.length; i < l; i++ ) {
  1622. var elem = this[i];
  1623. if ( elem.nodeType === 1 && elem.className ) {
  1624. if ( value ) {
  1625. var className = (" " + elem.className + " ").replace(rclass, " ");
  1626. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1627. className = className.replace(" " + classNames[c] + " ", " ");
  1628. }
  1629. elem.className = jQuery.trim( className );
  1630. } else {
  1631. elem.className = "";
  1632. }
  1633. }
  1634. }
  1635. }
  1636. return this;
  1637. },
  1638. toggleClass: function( value, stateVal ) {
  1639. var type = typeof value,
  1640. isBool = typeof stateVal === "boolean";
  1641. if ( jQuery.isFunction( value ) ) {
  1642. return this.each(function(i) {
  1643. var self = jQuery(this);
  1644. self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
  1645. });
  1646. }
  1647. return this.each(function() {
  1648. if ( type === "string" ) {
  1649. // toggle individual class names
  1650. var className,
  1651. i = 0,
  1652. self = jQuery( this ),
  1653. state = stateVal,
  1654. classNames = value.split( rspace );
  1655. while ( (className = classNames[ i++ ]) ) {
  1656. // check each className given, space seperated list
  1657. state = isBool ? state : !self.hasClass( className );
  1658. self[ state ? "addClass" : "removeClass" ]( className );
  1659. }
  1660. } else if ( type === "undefined" || type === "boolean" ) {
  1661. if ( this.className ) {
  1662. // store className if set
  1663. jQuery._data( this, "__className__", this.className );
  1664. }
  1665. // toggle whole className
  1666. this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
  1667. }
  1668. });
  1669. },
  1670. hasClass: function( selector ) {
  1671. var className = " " + selector + " ";
  1672. for ( var i = 0, l = this.length; i < l; i++ ) {
  1673. if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
  1674. return true;
  1675. }
  1676. }
  1677. return false;
  1678. },
  1679. val: function( value ) {
  1680. var hooks, ret,
  1681. elem = this[0];
  1682. if ( !arguments.length ) {
  1683. if ( elem ) {
  1684. hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
  1685. if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
  1686. return ret;
  1687. }
  1688. return (elem.value || "").replace(rreturn, "");
  1689. }
  1690. return undefined;
  1691. }
  1692. var isFunction = jQuery.isFunction( value );
  1693. return this.each(function( i ) {
  1694. var self = jQuery(this), val;
  1695. if ( this.nodeType !== 1 ) {
  1696. return;
  1697. }
  1698. if ( isFunction ) {
  1699. val = value.call( this, i, self.val() );
  1700. } else {
  1701. val = value;
  1702. }
  1703. // Treat null/undefined as ""; convert numbers to string
  1704. if ( val == null ) {
  1705. val = "";
  1706. } else if ( typeof val === "number" ) {
  1707. val += "";
  1708. } else if ( jQuery.isArray( val ) ) {
  1709. val = jQuery.map(val, function ( value ) {
  1710. return value == null ? "" : value + "";
  1711. });
  1712. }
  1713. hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
  1714. // If set returns undefined, fall back to normal setting
  1715. if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
  1716. this.value = val;
  1717. }
  1718. });
  1719. }
  1720. });
  1721. jQuery.extend({
  1722. valHooks: {
  1723. option: {
  1724. get: function( elem ) {
  1725. // attributes.value is undefined in Blackberry 4.7 but
  1726. // uses .value. See #6932
  1727. var val = elem.attributes.value;
  1728. return !val || val.specified ? elem.value : elem.text;
  1729. }
  1730. },
  1731. select: {
  1732. get: function( elem ) {
  1733. var value,
  1734. index = elem.selectedIndex,
  1735. values = [],
  1736. options = elem.options,
  1737. one = elem.type === "select-one";
  1738. // Nothing was selected
  1739. if ( index < 0 ) {
  1740. return null;
  1741. }
  1742. // Loop through all the selected options
  1743. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  1744. var option = options[ i ];
  1745. // Don't return options that are disabled or in a disabled optgroup
  1746. if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
  1747. (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
  1748. // Get the specific value for the option
  1749. value = jQuery( option ).val();
  1750. // We don't need an array for one selects
  1751. if ( one ) {
  1752. return value;
  1753. }
  1754. // Multi-Selects return an array
  1755. values.push( value );
  1756. }
  1757. }
  1758. // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
  1759. if ( one && !values.length && options.length ) {
  1760. return jQuery( options[ index ] ).val();
  1761. }
  1762. return values;
  1763. },
  1764. set: function( elem, value ) {
  1765. var values = jQuery.makeArray( value );
  1766. jQuery(elem).find("option").each(function() {
  1767. this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
  1768. });
  1769. if ( !values.length ) {
  1770. elem.selectedIndex = -1;
  1771. }
  1772. return values;
  1773. }
  1774. }
  1775. },
  1776. attrFn: {
  1777. val: true,
  1778. css: true,
  1779. html: true,
  1780. text: true,
  1781. data: true,
  1782. width: true,
  1783. height: true,
  1784. offset: true
  1785. },
  1786. attrFix: {
  1787. // Always normalize to ensure hook usage
  1788. tabindex: "tabIndex"
  1789. },
  1790. attr: function( elem, name, value, pass ) {
  1791. var nType = elem.nodeType;
  1792. // don't get/set attributes on text, comment and attribute nodes
  1793. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  1794. return undefined;
  1795. }
  1796. if ( pass && name in jQuery.attrFn ) {
  1797. return jQuery( elem )[ name ]( value );
  1798. }
  1799. // Fallback to prop when attributes are not supported
  1800. if ( !("getAttribute" in elem) ) {
  1801. return jQuery.prop( elem, name, value );
  1802. }
  1803. var ret, hooks,
  1804. notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
  1805. // Normalize the name if needed
  1806. name = notxml && jQuery.attrFix[ name ] || name;
  1807. hooks = jQuery.attrHooks[ name ];
  1808. if ( !hooks ) {
  1809. // Use boolHook for boolean attributes
  1810. if ( rboolean.test( name ) &&
  1811. (typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
  1812. hooks = boolHook;
  1813. // Use formHook for forms and if the name contains certain characters
  1814. } else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
  1815. hooks = formHook;
  1816. }
  1817. }
  1818. if ( value !== undefined ) {
  1819. if ( value === null ) {
  1820. jQuery.removeAttr( elem, name );
  1821. return undefined;
  1822. } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
  1823. return ret;
  1824. } else {
  1825. elem.setAttribute( name, "" + value );
  1826. return value;
  1827. }
  1828. } else if ( hooks && "get" in hooks && notxml ) {
  1829. return hooks.get( elem, name );
  1830. } else {
  1831. ret = elem.getAttribute( name );
  1832. // Non-existent attributes return null, we normalize to undefined
  1833. return ret === null ?
  1834. undefined :
  1835. ret;
  1836. }
  1837. },
  1838. removeAttr: function( elem, name ) {
  1839. var propName;
  1840. if ( elem.nodeType === 1 ) {
  1841. name = jQuery.attrFix[ name ] || name;
  1842. if ( jQuery.support.getSetAttribute ) {
  1843. // Use removeAttribute in browsers that support it
  1844. elem.removeAttribute( name );
  1845. } else {
  1846. jQuery.attr( elem, name, "" );
  1847. elem.removeAttributeNode( elem.getAttributeNode( name ) );
  1848. }
  1849. // Set corresponding property to false for boolean attributes
  1850. if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
  1851. elem[ propName ] = false;
  1852. }
  1853. }
  1854. },
  1855. attrHooks: {
  1856. type: {
  1857. set: function( elem, value ) {
  1858. // We can't allow the type property to be changed (since it causes problems in IE)
  1859. if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
  1860. jQuery.error( "type property can't be changed" );
  1861. } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
  1862. // Setting the type on a radio button after the value resets the value in IE6-9
  1863. // Reset value to it's default in case type is set after value
  1864. // This is for element creation
  1865. var val = elem.value;
  1866. elem.setAttribute( "type", value );
  1867. if ( val ) {
  1868. elem.value = val;
  1869. }
  1870. return value;
  1871. }
  1872. }
  1873. },
  1874. tabIndex: {
  1875. get: function( elem ) {
  1876. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1877. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1878. var attributeNode = elem.getAttributeNode("tabIndex");
  1879. return attributeNode && attributeNode.specified ?
  1880. parseInt( attributeNode.value, 10 ) :
  1881. rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
  1882. 0 :
  1883. undefined;
  1884. }
  1885. }
  1886. },
  1887. propFix: {
  1888. tabindex: "tabIndex",
  1889. readonly: "readOnly",
  1890. "for": "htmlFor",
  1891. "class": "className",
  1892. maxlength: "maxLength",
  1893. cellspacing: "cellSpacing",
  1894. cellpadding: "cellPadding",
  1895. rowspan: "rowSpan",
  1896. colspan: "colSpan",
  1897. usemap: "useMap",
  1898. frameborder: "frameBorder",
  1899. contenteditable: "contentEditable"
  1900. },
  1901. prop: function( elem, name, value ) {
  1902. var nType = elem.nodeType;
  1903. // don't get/set properties on text, comment and attribute nodes
  1904. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  1905. return undefined;
  1906. }
  1907. var ret, hooks,
  1908. notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
  1909. // Try to normalize/fix the name
  1910. name = notxml && jQuery.propFix[ name ] || name;
  1911. hooks = jQuery.propHooks[ name ];
  1912. if ( value !== undefined ) {
  1913. if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
  1914. return ret;
  1915. } else {
  1916. return (elem[ name ] = value);
  1917. }
  1918. } else {
  1919. if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
  1920. return ret;
  1921. } else {
  1922. return elem[ name ];
  1923. }
  1924. }
  1925. },
  1926. propHooks: {}
  1927. });
  1928. // Hook for boolean attributes
  1929. boolHook = {
  1930. get: function( elem, name ) {
  1931. // Align boolean attributes with corresponding properties
  1932. return elem[ jQuery.propFix[ name ] || name ] ?
  1933. name.toLowerCase() :
  1934. undefined;
  1935. },
  1936. set: function( elem, value, name ) {
  1937. var propName;
  1938. if ( value === false ) {
  1939. // Remove boolean attributes when set to false
  1940. jQuery.removeAttr( elem, name );
  1941. } else {
  1942. // value is true since we know at this point it's type boolean and not false
  1943. // Set boolean attributes to the same name and set the DOM property
  1944. propName = jQuery.propFix[ name ] || name;
  1945. if ( propName in elem ) {
  1946. // Only set the IDL specifically if it already exists on the element
  1947. elem[ propName ] = value;
  1948. }
  1949. elem.setAttribute( name, name.toLowerCase() );
  1950. }
  1951. return name;
  1952. }
  1953. };
  1954. // Use the value property for back compat
  1955. // Use the formHook for button elements in IE6/7 (#1954)
  1956. jQuery.attrHooks.value = {
  1957. get: function( elem, name ) {
  1958. if ( formHook && jQuery.nodeName( elem, "button" ) ) {
  1959. return formHook.get( elem, name );
  1960. }
  1961. return elem.value;
  1962. },
  1963. set: function( elem, value, name ) {
  1964. if ( formHook && jQuery.nodeName( elem, "button" ) ) {
  1965. return formHook.set( elem, value, name );
  1966. }
  1967. // Does not return so that setAttribute is also used
  1968. elem.value = value;
  1969. }
  1970. };
  1971. // IE6/7 do not support getting/setting some attributes with get/setAttribute
  1972. if ( !jQuery.support.getSetAttribute ) {
  1973. // propFix is more comprehensive and contains all fixes
  1974. jQuery.attrFix = jQuery.propFix;
  1975. // Use this for any attribute on a form in IE6/7
  1976. formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
  1977. get: function( elem, name ) {
  1978. var ret;
  1979. ret = elem.getAttributeNode( name );
  1980. // Return undefined if nodeValue is empty string
  1981. return ret && ret.nodeValue !== "" ?
  1982. ret.nodeValue :
  1983. undefined;
  1984. },
  1985. set: function( elem, value, name ) {
  1986. // Check form objects in IE (multiple bugs related)
  1987. // Only use nodeValue if the attribute node exists on the form
  1988. var ret = elem.getAttributeNode( name );
  1989. if ( ret ) {
  1990. ret.nodeValue = value;
  1991. return value;
  1992. }
  1993. }
  1994. };
  1995. // Set width and height to auto instead of 0 on empty string( Bug #8150 )
  1996. // This is for removals
  1997. jQuery.each([ "width", "height" ], function( i, name ) {
  1998. jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
  1999. set: function( elem, value ) {
  2000. if ( value === "" ) {
  2001. elem.setAttribute( name, "auto" );
  2002. return value;
  2003. }
  2004. }
  2005. });
  2006. });
  2007. }
  2008. // Some attributes require a special call on IE
  2009. if ( !jQuery.support.hrefNormalized ) {
  2010. jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
  2011. jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
  2012. get: function( elem ) {
  2013. var ret = elem.getAttribute( name, 2 );
  2014. return ret === null ? undefined : ret;
  2015. }
  2016. });
  2017. });
  2018. }
  2019. if ( !jQuery.support.style ) {
  2020. jQuery.attrHooks.style = {
  2021. get: function( elem ) {
  2022. // Return undefined in the case of empty string
  2023. // Normalize to lowercase since IE uppercases css property names
  2024. return elem.style.cssText.toLowerCase() || undefined;
  2025. },
  2026. set: function( elem, value ) {
  2027. return (elem.style.cssText = "" + value);
  2028. }
  2029. };
  2030. }
  2031. // Safari mis-reports the default selected property of an option
  2032. // Accessing the parent's selectedIndex property fixes it
  2033. if ( !jQuery.support.optSelected ) {
  2034. jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
  2035. get: function( elem ) {
  2036. var parent = elem.parentNode;
  2037. if ( parent ) {
  2038. parent.selectedIndex;
  2039. // Make sure that it also works with optgroups, see #5701
  2040. if ( parent.parentNode ) {
  2041. parent.parentNode.selectedIndex;
  2042. }
  2043. }
  2044. }
  2045. });
  2046. }
  2047. // Radios and checkboxes getter/setter
  2048. if ( !jQuery.support.checkOn ) {
  2049. jQuery.each([ "radio", "checkbox" ], function() {
  2050. jQuery.valHooks[ this ] = {
  2051. get: function( elem ) {
  2052. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  2053. return elem.getAttribute("value") === null ? "on" : elem.value;
  2054. }
  2055. };
  2056. });
  2057. }
  2058. jQuery.each([ "radio", "checkbox" ], function() {
  2059. jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
  2060. set: function( elem, value ) {
  2061. if ( jQuery.isArray( value ) ) {
  2062. return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
  2063. }
  2064. }
  2065. });
  2066. });
  2067. var hasOwn = Object.prototype.hasOwnProperty,
  2068. rnamespaces = /\.(.*)$/,
  2069. rformElems = /^(?:textarea|input|select)$/i,
  2070. rperiod = /\./g,
  2071. rspaces = / /g,
  2072. rescape = /[^\w\s.|`]/g,
  2073. fcleanup = function( nm ) {
  2074. return nm.replace(rescape, "\\$&");
  2075. };
  2076. /*
  2077. * A number of helper functions used for managing events.
  2078. * Many of the ideas behind this code originated from
  2079. * Dean Edwards' addEvent library.
  2080. */
  2081. jQuery.event = {
  2082. // Bind an event to an element
  2083. // Original by Dean Edwards
  2084. add: function( elem, types, handler, data ) {
  2085. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  2086. return;
  2087. }
  2088. if ( handler === false ) {
  2089. handler = returnFalse;
  2090. } else if ( !handler ) {
  2091. // Fixes bug #7229. Fix recommended by jdalton
  2092. return;
  2093. }
  2094. var handleObjIn, handleObj;
  2095. if ( handler.handler ) {
  2096. handleObjIn = handler;
  2097. handler = handleObjIn.handler;
  2098. }
  2099. // Make sure that the function being executed has a unique ID
  2100. if ( !handler.guid ) {
  2101. handler.guid = jQuery.guid++;
  2102. }
  2103. // Init the element's event structure
  2104. var elemData = jQuery._data( elem );
  2105. // If no elemData is found then we must be trying to bind to one of the
  2106. // banned noData elements
  2107. if ( !elemData ) {
  2108. return;
  2109. }
  2110. var events = elemData.events,
  2111. eventHandle = elemData.handle;
  2112. if ( !events ) {
  2113. elemData.events = events = {};
  2114. }
  2115. if ( !eventHandle ) {
  2116. elemData.handle = eventHandle = function( e ) {
  2117. // Discard the second event of a jQuery.event.trigger() and
  2118. // when an event is called after a page has unloaded
  2119. return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
  2120. jQuery.event.handle.apply( eventHandle.elem, arguments ) :
  2121. undefined;
  2122. };
  2123. }
  2124. // Add elem as a property of the handle function
  2125. // This is to prevent a memory leak with non-native events in IE.
  2126. eventHandle.elem = elem;
  2127. // Handle multiple events separated by a space
  2128. // jQuery(...).bind("mouseover mouseout", fn);
  2129. types = types.split(" ");
  2130. var type, i = 0, namespaces;
  2131. while ( (type = types[ i++ ]) ) {
  2132. handleObj = handleObjIn ?
  2133. jQuery.extend({}, handleObjIn) :
  2134. { handler: handler, data: data };
  2135. // Namespaced event handlers
  2136. if ( type.indexOf(".") > -1 ) {
  2137. namespaces = type.split(".");
  2138. type = namespaces.shift();
  2139. handleObj.namespace = namespaces.slice(0).sort().join(".");
  2140. } else {
  2141. namespaces = [];
  2142. handleObj.namespace = "";
  2143. }
  2144. handleObj.type = type;
  2145. if ( !handleObj.guid ) {
  2146. handleObj.guid = handler.guid;
  2147. }
  2148. // Get the current list of functions bound to this event
  2149. var handlers = events[ type ],
  2150. special = jQuery.event.special[ type ] || {};
  2151. // Init the event handler queue
  2152. if ( !handlers ) {
  2153. handlers = events[ type ] = [];
  2154. // Check for a special event handler
  2155. // Only use addEventListener/attachEvent if the special
  2156. // events handler returns false
  2157. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  2158. // Bind the global event handler to the element
  2159. if ( elem.addEventListener ) {
  2160. elem.addEventListener( type, eventHandle, false );
  2161. } else if ( elem.attachEvent ) {
  2162. elem.attachEvent( "on" + type, eventHandle );
  2163. }
  2164. }
  2165. }
  2166. if ( special.add ) {
  2167. special.add.call( elem, handleObj );
  2168. if ( !handleObj.handler.guid ) {
  2169. handleObj.handler.guid = handler.guid;
  2170. }
  2171. }
  2172. // Add the function to the element's handler list
  2173. handlers.push( handleObj );
  2174. // Keep track of which events have been used, for event optimization
  2175. jQuery.event.global[ type ] = true;
  2176. }
  2177. // Nullify elem to prevent memory leaks in IE
  2178. elem = null;
  2179. },
  2180. global: {},
  2181. // Detach an event or set of events from an element
  2182. remove: function( elem, types, handler, pos ) {
  2183. // don't do events on text and comment nodes
  2184. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  2185. return;
  2186. }
  2187. if ( handler === false ) {
  2188. handler = returnFalse;
  2189. }
  2190. var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
  2191. elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
  2192. events = elemData && elemData.events;
  2193. if ( !elemData || !events ) {
  2194. return;
  2195. }
  2196. // types is actually an event object here
  2197. if ( types && types.type ) {
  2198. handler = types.handler;
  2199. types = types.type;
  2200. }
  2201. // Unbind all events for the element
  2202. if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
  2203. types = types || "";
  2204. for ( type in events ) {
  2205. jQuery.event.remove( elem, type + types );
  2206. }
  2207. return;
  2208. }
  2209. // Handle multiple events separated by a space
  2210. // jQuery(...).unbind("mouseover mouseout", fn);
  2211. types = types.split(" ");
  2212. while ( (type = types[ i++ ]) ) {
  2213. origType = type;
  2214. handleObj = null;
  2215. all = type.indexOf(".") < 0;
  2216. namespaces = [];
  2217. if ( !all ) {
  2218. // Namespaced event handlers
  2219. namespaces = type.split(".");
  2220. type = namespaces.shift();
  2221. namespace = new RegExp("(^|\\.)" +
  2222. jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
  2223. }
  2224. eventType = events[ type ];
  2225. if ( !eventType ) {
  2226. continue;
  2227. }
  2228. if ( !handler ) {
  2229. for ( j = 0; j < eventType.length; j++ ) {
  2230. handleObj = eventType[ j ];
  2231. if ( all || namespace.test( handleObj.namespace ) ) {
  2232. jQuery.event.remove( elem, origType, handleObj.handler, j );
  2233. eventType.splice( j--, 1 );
  2234. }
  2235. }
  2236. continue;
  2237. }
  2238. special = jQuery.event.special[ type ] || {};
  2239. for ( j = pos || 0; j < eventType.length; j++ ) {
  2240. handleObj = eventType[ j ];
  2241. if ( handler.guid === handleObj.guid ) {
  2242. // remove the given handler for the given type
  2243. if ( all || namespace.test( handleObj.namespace ) ) {
  2244. if ( pos == null ) {
  2245. eventType.splice( j--, 1 );
  2246. }
  2247. if ( special.remove ) {
  2248. special.remove.call( elem, handleObj );
  2249. }
  2250. }
  2251. if ( pos != null ) {
  2252. break;
  2253. }
  2254. }
  2255. }
  2256. // remove generic event handler if no more handlers exist
  2257. if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
  2258. if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
  2259. jQuery.removeEvent( elem, type, elemData.handle );
  2260. }
  2261. ret = null;
  2262. delete events[ type ];
  2263. }
  2264. }
  2265. // Remove the expando if it's no longer used
  2266. if ( jQuery.isEmptyObject( events ) ) {
  2267. var handle = elemData.handle;
  2268. if ( handle ) {
  2269. handle.elem = null;
  2270. }
  2271. delete elemData.events;
  2272. delete elemData.handle;
  2273. if ( jQuery.isEmptyObject( elemData ) ) {
  2274. jQuery.removeData( elem, undefined, true );
  2275. }
  2276. }
  2277. },
  2278. // Events that are safe to short-circuit if no handlers are attached.
  2279. // Native DOM events should not be added, they may have inline handlers.
  2280. customEvent: {
  2281. "getData": true,
  2282. "setData": true,
  2283. "changeData": true
  2284. },
  2285. trigger: function( event, data, elem, onlyHandlers ) {
  2286. // Event object or event type
  2287. var type = event.type || event,
  2288. namespaces = [],
  2289. exclusive;
  2290. if ( type.indexOf("!") >= 0 ) {
  2291. // Exclusive events trigger only for the exact event (no namespaces)
  2292. type = type.slice(0, -1);
  2293. exclusive = true;
  2294. }
  2295. if ( type.indexOf(".") >= 0 ) {
  2296. // Namespaced trigger; create a regexp to match event type in handle()
  2297. namespaces = type.split(".");
  2298. type = namespaces.shift();
  2299. namespaces.sort();
  2300. }
  2301. if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
  2302. // No jQuery handlers for this event type, and it can't have inline handlers
  2303. return;
  2304. }
  2305. // Caller can pass in an Event, Object, or just an event type string
  2306. event = typeof event === "object" ?
  2307. // jQuery.Event object
  2308. event[ jQuery.expando ] ? event :
  2309. // Object literal
  2310. new jQuery.Event( type, event ) :
  2311. // Just the event type (string)
  2312. new jQuery.Event( type );
  2313. event.type = type;
  2314. event.exclusive = exclusive;
  2315. event.namespace = namespaces.join(".");
  2316. event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
  2317. // triggerHandler() and global events don't bubble or run the default action
  2318. if ( onlyHandlers || !elem ) {
  2319. event.preventDefault();
  2320. event.stopPropagation();
  2321. }
  2322. // Handle a global trigger
  2323. if ( !elem ) {
  2324. // TODO: Stop taunting the data cache; remove global events and always attach to document
  2325. jQuery.each( jQuery.cache, function() {
  2326. // internalKey variable is just used to make it easier to find
  2327. // and potentially change this stuff later; currently it just
  2328. // points to jQuery.expando
  2329. var internalKey = jQuery.expando,
  2330. internalCache = this[ internalKey ];
  2331. if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
  2332. jQuery.event.trigger( event, data, internalCache.handle.elem );
  2333. }
  2334. });
  2335. return;
  2336. }
  2337. // Don't do events on text and comment nodes
  2338. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  2339. return;
  2340. }
  2341. // Clean up the event in case it is being reused
  2342. event.result = undefined;
  2343. event.target = elem;
  2344. // Clone any incoming data and prepend the event, creating the handler arg list
  2345. data = data ? jQuery.makeArray( data ) : [];
  2346. data.unshift( event );
  2347. var cur = elem,
  2348. // IE doesn't like method names with a colon (#3533, #8272)
  2349. ontype = type.indexOf(":") < 0 ? "on" + type : "";
  2350. // Fire event on the current element, then bubble up the DOM tree
  2351. do {
  2352. var handle = jQuery._data( cur, "handle" );
  2353. event.currentTarget = cur;
  2354. if ( handle ) {
  2355. handle.apply( cur, data );
  2356. }
  2357. // Trigger an inline bound script
  2358. if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
  2359. event.result = false;
  2360. event.preventDefault();
  2361. }
  2362. // Bubble up to document, then to window
  2363. cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
  2364. } while ( cur && !event.isPropagationStopped() );
  2365. // If nobody prevented the default action, do it now
  2366. if ( !event.isDefaultPrevented() ) {
  2367. var old,
  2368. special = jQuery.event.special[ type ] || {};
  2369. if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
  2370. !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
  2371. // Call a native DOM method on the target with the same name name as the event.
  2372. // Can't use an .isFunction)() check here because IE6/7 fails that test.
  2373. // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
  2374. try {
  2375. if ( ontype && elem[ type ] ) {
  2376. // Don't re-trigger an onFOO event when we call its FOO() method
  2377. old = elem[ ontype ];
  2378. if ( old ) {
  2379. elem[ ontype ] = null;
  2380. }
  2381. jQuery.event.triggered = type;
  2382. elem[ type ]();
  2383. }
  2384. } catch ( ieError ) {}
  2385. if ( old ) {
  2386. elem[ ontype ] = old;
  2387. }
  2388. jQuery.event.triggered = undefined;
  2389. }
  2390. }
  2391. return event.result;
  2392. },
  2393. handle: function( event ) {
  2394. event = jQuery.event.fix( event || window.event );
  2395. // Snapshot the handlers list since a called handler may add/remove events.
  2396. var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
  2397. run_all = !event.exclusive && !event.namespace,
  2398. args = Array.prototype.slice.call( arguments, 0 );
  2399. // Use the fix-ed Event rather than the (read-only) native event
  2400. args[0] = event;
  2401. event.currentTarget = this;
  2402. for ( var j = 0, l = handlers.length; j < l; j++ ) {
  2403. var handleObj = handlers[ j ];
  2404. // Triggered event must 1) be non-exclusive and have no namespace, or
  2405. // 2) have namespace(s) a subset or equal to those in the bound event.
  2406. if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
  2407. // Pass in a reference to the handler function itself
  2408. // So that we can later remove it
  2409. event.handler = handleObj.handler;
  2410. event.data = handleObj.data;
  2411. event.handleObj = handleObj;
  2412. var ret = handleObj.handler.apply( this, args );
  2413. if ( ret !== undefined ) {
  2414. event.result = ret;
  2415. if ( ret === false ) {
  2416. event.preventDefault();
  2417. event.stopPropagation();
  2418. }
  2419. }
  2420. if ( event.isImmediatePropagationStopped() ) {
  2421. break;
  2422. }
  2423. }
  2424. }
  2425. return event.result;
  2426. },
  2427. 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(" "),
  2428. fix: function( event ) {
  2429. if ( event[ jQuery.expando ] ) {
  2430. return event;
  2431. }
  2432. // store a copy of the original event object
  2433. // and "clone" to set read-only properties
  2434. var originalEvent = event;
  2435. event = jQuery.Event( originalEvent );
  2436. for ( var i = this.props.length, prop; i; ) {
  2437. prop = this.props[ --i ];
  2438. event[ prop ] = originalEvent[ prop ];
  2439. }
  2440. // Fix target property, if necessary
  2441. if ( !event.target ) {
  2442. // Fixes #1925 where srcElement might not be defined either
  2443. event.target = event.srcElement || document;
  2444. }
  2445. // check if target is a textnode (safari)
  2446. if ( event.target.nodeType === 3 ) {
  2447. event.target = event.target.parentNode;
  2448. }
  2449. // Add relatedTarget, if necessary
  2450. if ( !event.relatedTarget && event.fromElement ) {
  2451. event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
  2452. }
  2453. // Calculate pageX/Y if missing and clientX/Y available
  2454. if ( event.pageX == null && event.clientX != null ) {
  2455. var eventDocument = event.target.ownerDocument || document,
  2456. doc = eventDocument.documentElement,
  2457. body = eventDocument.body;
  2458. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  2459. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  2460. }
  2461. // Add which for key events
  2462. if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
  2463. event.which = event.charCode != null ? event.charCode : event.keyCode;
  2464. }
  2465. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  2466. if ( !event.metaKey && event.ctrlKey ) {
  2467. event.metaKey = event.ctrlKey;
  2468. }
  2469. // Add which for click: 1 === left; 2 === middle; 3 === right
  2470. // Note: button is not normalized, so don't use it
  2471. if ( !event.which && event.button !== undefined ) {
  2472. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  2473. }
  2474. return event;
  2475. },
  2476. // Deprecated, use jQuery.guid instead
  2477. guid: 1E8,
  2478. // Deprecated, use jQuery.proxy instead
  2479. proxy: jQuery.proxy,
  2480. special: {
  2481. ready: {
  2482. // Make sure the ready event is setup
  2483. setup: jQuery.bindReady,
  2484. teardown: jQuery.noop
  2485. },
  2486. live: {
  2487. add: function( handleObj ) {
  2488. jQuery.event.add( this,
  2489. liveConvert( handleObj.origType, handleObj.selector ),
  2490. jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
  2491. },
  2492. remove: function( handleObj ) {
  2493. jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
  2494. }
  2495. },
  2496. beforeunload: {
  2497. setup: function( data, namespaces, eventHandle ) {
  2498. // We only want to do this special case on windows
  2499. if ( jQuery.isWindow( this ) ) {
  2500. this.onbeforeunload = eventHandle;
  2501. }
  2502. },
  2503. teardown: function( namespaces, eventHandle ) {
  2504. if ( this.onbeforeunload === eventHandle ) {
  2505. this.onbeforeunload = null;
  2506. }
  2507. }
  2508. }
  2509. }
  2510. };
  2511. jQuery.removeEvent = document.removeEventListener ?
  2512. function( elem, type, handle ) {
  2513. if ( elem.removeEventListener ) {
  2514. elem.removeEventListener( type, handle, false );
  2515. }
  2516. } :
  2517. function( elem, type, handle ) {
  2518. if ( elem.detachEvent ) {
  2519. elem.detachEvent( "on" + type, handle );
  2520. }
  2521. };
  2522. jQuery.Event = function( src, props ) {
  2523. // Allow instantiation without the 'new' keyword
  2524. if ( !this.preventDefault ) {
  2525. return new jQuery.Event( src, props );
  2526. }
  2527. // Event object
  2528. if ( src && src.type ) {
  2529. this.originalEvent = src;
  2530. this.type = src.type;
  2531. // Events bubbling up the document may have been marked as prevented
  2532. // by a handler lower down the tree; reflect the correct value.
  2533. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
  2534. src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
  2535. // Event type
  2536. } else {
  2537. this.type = src;
  2538. }
  2539. // Put explicitly provided properties onto the event object
  2540. if ( props ) {
  2541. jQuery.extend( this, props );
  2542. }
  2543. // timeStamp is buggy for some events on Firefox(#3843)
  2544. // So we won't rely on the native value
  2545. this.timeStamp = jQuery.now();
  2546. // Mark it as fixed
  2547. this[ jQuery.expando ] = true;
  2548. };
  2549. function returnFalse() {
  2550. return false;
  2551. }
  2552. function returnTrue() {
  2553. return true;
  2554. }
  2555. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  2556. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  2557. jQuery.Event.prototype = {
  2558. preventDefault: function() {
  2559. this.isDefaultPrevented = returnTrue;
  2560. var e = this.originalEvent;
  2561. if ( !e ) {
  2562. return;
  2563. }
  2564. // if preventDefault exists run it on the original event
  2565. if ( e.preventDefault ) {
  2566. e.preventDefault();
  2567. // otherwise set the returnValue property of the original event to false (IE)
  2568. } else {
  2569. e.returnValue = false;
  2570. }
  2571. },
  2572. stopPropagation: function() {
  2573. this.isPropagationStopped = returnTrue;
  2574. var e = this.originalEvent;
  2575. if ( !e ) {
  2576. return;
  2577. }
  2578. // if stopPropagation exists run it on the original event
  2579. if ( e.stopPropagation ) {
  2580. e.stopPropagation();
  2581. }
  2582. // otherwise set the cancelBubble property of the original event to true (IE)
  2583. e.cancelBubble = true;
  2584. },
  2585. stopImmediatePropagation: function() {
  2586. this.isImmediatePropagationStopped = returnTrue;
  2587. this.stopPropagation();
  2588. },
  2589. isDefaultPrevented: returnFalse,
  2590. isPropagationStopped: returnFalse,
  2591. isImmediatePropagationStopped: returnFalse
  2592. };
  2593. // Checks if an event happened on an element within another element
  2594. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  2595. var withinElement = function( event ) {
  2596. // Check if mouse(over|out) are still within the same parent element
  2597. var parent = event.relatedTarget;
  2598. // set the correct event type
  2599. event.type = event.data;
  2600. // Firefox sometimes assigns relatedTarget a XUL element
  2601. // which we cannot access the parentNode property of
  2602. try {
  2603. // Chrome does something similar, the parentNode property
  2604. // can be accessed but is null.
  2605. if ( parent && parent !== document && !parent.parentNode ) {
  2606. return;
  2607. }
  2608. // Traverse up the tree
  2609. while ( parent && parent !== this ) {
  2610. parent = parent.parentNode;
  2611. }
  2612. if ( parent !== this ) {
  2613. // handle event if we actually just moused on to a non sub-element
  2614. jQuery.event.handle.apply( this, arguments );
  2615. }
  2616. // assuming we've left the element since we most likely mousedover a xul element
  2617. } catch(e) { }
  2618. },
  2619. // In case of event delegation, we only need to rename the event.type,
  2620. // liveHandler will take care of the rest.
  2621. delegate = function( event ) {
  2622. event.type = event.data;
  2623. jQuery.event.handle.apply( this, arguments );
  2624. };
  2625. // Create mouseenter and mouseleave events
  2626. jQuery.each({
  2627. mouseenter: "mouseover",
  2628. mouseleave: "mouseout"
  2629. }, function( orig, fix ) {
  2630. jQuery.event.special[ orig ] = {
  2631. setup: function( data ) {
  2632. jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
  2633. },
  2634. teardown: function( data ) {
  2635. jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
  2636. }
  2637. };
  2638. });
  2639. // submit delegation
  2640. if ( !jQuery.support.submitBubbles ) {
  2641. jQuery.event.special.submit = {
  2642. setup: function( data, namespaces ) {
  2643. if ( !jQuery.nodeName( this, "form" ) ) {
  2644. jQuery.event.add(this, "click.specialSubmit", function( e ) {
  2645. var elem = e.target,
  2646. type = elem.type;
  2647. if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
  2648. trigger( "submit", this, arguments );
  2649. }
  2650. });
  2651. jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
  2652. var elem = e.target,
  2653. type = elem.type;
  2654. if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
  2655. trigger( "submit", this, arguments );
  2656. }
  2657. });
  2658. } else {
  2659. return false;
  2660. }
  2661. },
  2662. teardown: function( namespaces ) {
  2663. jQuery.event.remove( this, ".specialSubmit" );
  2664. }
  2665. };
  2666. }
  2667. // change delegation, happens here so we have bind.
  2668. if ( !jQuery.support.changeBubbles ) {
  2669. var changeFilters,
  2670. getVal = function( elem ) {
  2671. var type = elem.type, val = elem.value;
  2672. if ( type === "radio" || type === "checkbox" ) {
  2673. val = elem.checked;
  2674. } else if ( type === "select-multiple" ) {
  2675. val = elem.selectedIndex > -1 ?
  2676. jQuery.map( elem.options, function( elem ) {
  2677. return elem.selected;
  2678. }).join("-") :
  2679. "";
  2680. } else if ( jQuery.nodeName( elem, "select" ) ) {
  2681. val = elem.selectedIndex;
  2682. }
  2683. return val;
  2684. },
  2685. testChange = function testChange( e ) {
  2686. var elem = e.target, data, val;
  2687. if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
  2688. return;
  2689. }
  2690. data = jQuery._data( elem, "_change_data" );
  2691. val = getVal(elem);
  2692. // the current data will be also retrieved by beforeactivate
  2693. if ( e.type !== "focusout" || elem.type !== "radio" ) {
  2694. jQuery._data( elem, "_change_data", val );
  2695. }
  2696. if ( data === undefined || val === data ) {
  2697. return;
  2698. }
  2699. if ( data != null || val ) {
  2700. e.type = "change";
  2701. e.liveFired = undefined;
  2702. jQuery.event.trigger( e, arguments[1], elem );
  2703. }
  2704. };
  2705. jQuery.event.special.change = {
  2706. filters: {
  2707. focusout: testChange,
  2708. beforedeactivate: testChange,
  2709. click: function( e ) {
  2710. var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
  2711. if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
  2712. testChange.call( this, e );
  2713. }
  2714. },
  2715. // Change has to be called before submit
  2716. // Keydown will be called before keypress, which is used in submit-event delegation
  2717. keydown: function( e ) {
  2718. var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
  2719. if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
  2720. (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
  2721. type === "select-multiple" ) {
  2722. testChange.call( this, e );
  2723. }
  2724. },
  2725. // Beforeactivate happens also before the previous element is blurred
  2726. // with this event you can't trigger a change event, but you can store
  2727. // information
  2728. beforeactivate: function( e ) {
  2729. var elem = e.target;
  2730. jQuery._data( elem, "_change_data", getVal(elem) );
  2731. }
  2732. },
  2733. setup: function( data, namespaces ) {
  2734. if ( this.type === "file" ) {
  2735. return false;
  2736. }
  2737. for ( var type in changeFilters ) {
  2738. jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
  2739. }
  2740. return rformElems.test( this.nodeName );
  2741. },
  2742. teardown: function( namespaces ) {
  2743. jQuery.event.remove( this, ".specialChange" );
  2744. return rformElems.test( this.nodeName );
  2745. }
  2746. };
  2747. changeFilters = jQuery.event.special.change.filters;
  2748. // Handle when the input is .focus()'d
  2749. changeFilters.focus = changeFilters.beforeactivate;
  2750. }
  2751. function trigger( type, elem, args ) {
  2752. // Piggyback on a donor event to simulate a different one.
  2753. // Fake originalEvent to avoid donor's stopPropagation, but if the
  2754. // simulated event prevents default then we do the same on the donor.
  2755. // Don't pass args or remember liveFired; they apply to the donor event.
  2756. var event = jQuery.extend( {}, args[ 0 ] );
  2757. event.type = type;
  2758. event.originalEvent = {};
  2759. event.liveFired = undefined;
  2760. jQuery.event.handle.call( elem, event );
  2761. if ( event.isDefaultPrevented() ) {
  2762. args[ 0 ].preventDefault();
  2763. }
  2764. }
  2765. // Create "bubbling" focus and blur events
  2766. if ( !jQuery.support.focusinBubbles ) {
  2767. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  2768. // Attach a single capturing handler while someone wants focusin/focusout
  2769. var attaches = 0;
  2770. jQuery.event.special[ fix ] = {
  2771. setup: function() {
  2772. if ( attaches++ === 0 ) {
  2773. document.addEventListener( orig, handler, true );
  2774. }
  2775. },
  2776. teardown: function() {
  2777. if ( --attaches === 0 ) {
  2778. document.removeEventListener( orig, handler, true );
  2779. }
  2780. }
  2781. };
  2782. function handler( donor ) {
  2783. // Donor event is always a native one; fix it and switch its type.
  2784. // Let focusin/out handler cancel the donor focus/blur event.
  2785. var e = jQuery.event.fix( donor );
  2786. e.type = fix;
  2787. e.originalEvent = {};
  2788. jQuery.event.trigger( e, null, e.target );
  2789. if ( e.isDefaultPrevented() ) {
  2790. donor.preventDefault();
  2791. }
  2792. }
  2793. });
  2794. }
  2795. jQuery.each(["bind", "one"], function( i, name ) {
  2796. jQuery.fn[ name ] = function( type, data, fn ) {
  2797. var handler;
  2798. // Handle object literals
  2799. if ( typeof type === "object" ) {
  2800. for ( var key in type ) {
  2801. this[ name ](key, data, type[key], fn);
  2802. }
  2803. return this;
  2804. }
  2805. if ( arguments.length === 2 || data === false ) {
  2806. fn = data;
  2807. data = undefined;
  2808. }
  2809. if ( name === "one" ) {
  2810. handler = function( event ) {
  2811. jQuery( this ).unbind( event, handler );
  2812. return fn.apply( this, arguments );
  2813. };
  2814. handler.guid = fn.guid || jQuery.guid++;
  2815. } else {
  2816. handler = fn;
  2817. }
  2818. if ( type === "unload" && name !== "one" ) {
  2819. this.one( type, data, fn );
  2820. } else {
  2821. for ( var i = 0, l = this.length; i < l; i++ ) {
  2822. jQuery.event.add( this[i], type, handler, data );
  2823. }
  2824. }
  2825. return this;
  2826. };
  2827. });
  2828. jQuery.fn.extend({
  2829. unbind: function( type, fn ) {
  2830. // Handle object literals
  2831. if ( typeof type === "object" && !type.preventDefault ) {
  2832. for ( var key in type ) {
  2833. this.unbind(key, type[key]);
  2834. }
  2835. } else {
  2836. for ( var i = 0, l = this.length; i < l; i++ ) {
  2837. jQuery.event.remove( this[i], type, fn );
  2838. }
  2839. }
  2840. return this;
  2841. },
  2842. delegate: function( selector, types, data, fn ) {
  2843. return this.live( types, data, fn, selector );
  2844. },
  2845. undelegate: function( selector, types, fn ) {
  2846. if ( arguments.length === 0 ) {
  2847. return this.unbind( "live" );
  2848. } else {
  2849. return this.die( types, null, fn, selector );
  2850. }
  2851. },
  2852. trigger: function( type, data ) {
  2853. return this.each(function() {
  2854. jQuery.event.trigger( type, data, this );
  2855. });
  2856. },
  2857. triggerHandler: function( type, data ) {
  2858. if ( this[0] ) {
  2859. return jQuery.event.trigger( type, data, this[0], true );
  2860. }
  2861. },
  2862. toggle: function( fn ) {
  2863. // Save reference to arguments for access in closure
  2864. var args = arguments,
  2865. guid = fn.guid || jQuery.guid++,
  2866. i = 0,
  2867. toggler = function( event ) {
  2868. // Figure out which function to execute
  2869. var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
  2870. jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
  2871. // Make sure that clicks stop
  2872. event.preventDefault();
  2873. // and execute the function
  2874. return args[ lastToggle ].apply( this, arguments ) || false;
  2875. };
  2876. // link all the functions, so any of them can unbind this click handler
  2877. toggler.guid = guid;
  2878. while ( i < args.length ) {
  2879. args[ i++ ].guid = guid;
  2880. }
  2881. return this.click( toggler );
  2882. },
  2883. hover: function( fnOver, fnOut ) {
  2884. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  2885. }
  2886. });
  2887. var liveMap = {
  2888. focus: "focusin",
  2889. blur: "focusout",
  2890. mouseenter: "mouseover",
  2891. mouseleave: "mouseout"
  2892. };
  2893. jQuery.each(["live", "die"], function( i, name ) {
  2894. jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
  2895. var type, i = 0, match, namespaces, preType,
  2896. selector = origSelector || this.selector,
  2897. context = origSelector ? this : jQuery( this.context );
  2898. if ( typeof types === "object" && !types.preventDefault ) {
  2899. for ( var key in types ) {
  2900. context[ name ]( key, data, types[key], selector );
  2901. }
  2902. return this;
  2903. }
  2904. if ( name === "die" && !types &&
  2905. origSelector && origSelector.charAt(0) === "." ) {
  2906. context.unbind( origSelector );
  2907. return this;
  2908. }
  2909. if ( data === false || jQuery.isFunction( data ) ) {
  2910. fn = data || returnFalse;
  2911. data = undefined;
  2912. }
  2913. types = (types || "").split(" ");
  2914. while ( (type = types[ i++ ]) != null ) {
  2915. match = rnamespaces.exec( type );
  2916. namespaces = "";
  2917. if ( match ) {
  2918. namespaces = match[0];
  2919. type = type.replace( rnamespaces, "" );
  2920. }
  2921. if ( type === "hover" ) {
  2922. types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
  2923. continue;
  2924. }
  2925. preType = type;
  2926. if ( liveMap[ type ] ) {
  2927. types.push( liveMap[ type ] + namespaces );
  2928. type = type + namespaces;
  2929. } else {
  2930. type = (liveMap[ type ] || type) + namespaces;
  2931. }
  2932. if ( name === "live" ) {
  2933. // bind live handler
  2934. for ( var j = 0, l = context.length; j < l; j++ ) {
  2935. jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
  2936. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
  2937. }
  2938. } else {
  2939. // unbind live handler
  2940. context.unbind( "live." + liveConvert( type, selector ), fn );
  2941. }
  2942. }
  2943. return this;
  2944. };
  2945. });
  2946. function liveHandler( event ) {
  2947. var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
  2948. elems = [],
  2949. selectors = [],
  2950. events = jQuery._data( this, "events" );
  2951. // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
  2952. if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
  2953. return;
  2954. }
  2955. if ( event.namespace ) {
  2956. namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
  2957. }
  2958. event.liveFired = this;
  2959. var live = events.live.slice(0);
  2960. for ( j = 0; j < live.length; j++ ) {
  2961. handleObj = live[j];
  2962. if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
  2963. selectors.push( handleObj.selector );
  2964. } else {
  2965. live.splice( j--, 1 );
  2966. }
  2967. }
  2968. match = jQuery( event.target ).closest( selectors, event.currentTarget );
  2969. for ( i = 0, l = match.length; i < l; i++ ) {
  2970. close = match[i];
  2971. for ( j = 0; j < live.length; j++ ) {
  2972. handleObj = live[j];
  2973. if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
  2974. elem = close.elem;
  2975. related = null;
  2976. // Those two events require additional checking
  2977. if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
  2978. event.type = handleObj.preType;
  2979. related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
  2980. // Make sure not to accidentally match a child element with the same selector
  2981. if ( related && jQuery.contains( elem, related ) ) {
  2982. related = elem;
  2983. }
  2984. }
  2985. if ( !related || related !== elem ) {
  2986. elems.push({ elem: elem, handleObj: handleObj, level: close.level });
  2987. }
  2988. }
  2989. }
  2990. }
  2991. for ( i = 0, l = elems.length; i < l; i++ ) {
  2992. match = elems[i];
  2993. if ( maxLevel && match.level > maxLevel ) {
  2994. break;
  2995. }
  2996. event.currentTarget = match.elem;
  2997. event.data = match.handleObj.data;
  2998. event.handleObj = match.handleObj;
  2999. ret = match.handleObj.origHandler.apply( match.elem, arguments );
  3000. if ( ret === false || event.isPropagationStopped() ) {
  3001. maxLevel = match.level;
  3002. if ( ret === false ) {
  3003. stop = false;
  3004. }
  3005. if ( event.isImmediatePropagationStopped() ) {
  3006. break;
  3007. }
  3008. }
  3009. }
  3010. return stop;
  3011. }
  3012. function liveConvert( type, selector ) {
  3013. return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
  3014. }
  3015. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  3016. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  3017. "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
  3018. // Handle event binding
  3019. jQuery.fn[ name ] = function( data, fn ) {
  3020. if ( fn == null ) {
  3021. fn = data;
  3022. data = null;
  3023. }
  3024. return arguments.length > 0 ?
  3025. this.bind( name, data, fn ) :
  3026. this.trigger( name );
  3027. };
  3028. if ( jQuery.attrFn ) {
  3029. jQuery.attrFn[ name ] = true;
  3030. }
  3031. });
  3032. /*!
  3033. * Sizzle CSS Selector Engine
  3034. * Copyright 2011, The Dojo Foundation
  3035. * Released under the MIT, BSD, and GPL Licenses.
  3036. * More information: http://sizzlejs.com/
  3037. */
  3038. (function(){
  3039. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
  3040. done = 0,
  3041. toString = Object.prototype.toString,
  3042. hasDuplicate = false,
  3043. baseHasDuplicate = true,
  3044. rBackslash = /\\/g,
  3045. rNonWord = /\W/;
  3046. // Here we check if the JavaScript engine is using some sort of
  3047. // optimization where it does not always call our comparision
  3048. // function. If that is the case, discard the hasDuplicate value.
  3049. // Thus far that includes Google Chrome.
  3050. [0, 0].sort(function() {
  3051. baseHasDuplicate = false;
  3052. return 0;
  3053. });
  3054. var Sizzle = function( selector, context, results, seed ) {
  3055. results = results || [];
  3056. context = context || document;
  3057. var origContext = context;
  3058. if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
  3059. return [];
  3060. }
  3061. if ( !selector || typeof selector !== "string" ) {
  3062. return results;
  3063. }
  3064. var m, set, checkSet, extra, ret, cur, pop, i,
  3065. prune = true,
  3066. contextXML = Sizzle.isXML( context ),
  3067. parts = [],
  3068. soFar = selector;
  3069. // Reset the position of the chunker regexp (start from head)
  3070. do {
  3071. chunker.exec( "" );
  3072. m = chunker.exec( soFar );
  3073. if ( m ) {
  3074. soFar = m[3];
  3075. parts.push( m[1] );
  3076. if ( m[2] ) {
  3077. extra = m[3];
  3078. break;
  3079. }
  3080. }
  3081. } while ( m );
  3082. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  3083. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  3084. set = posProcess( parts[0] + parts[1], context );
  3085. } else {
  3086. set = Expr.relative[ parts[0] ] ?
  3087. [ context ] :
  3088. Sizzle( parts.shift(), context );
  3089. while ( parts.length ) {
  3090. selector = parts.shift();
  3091. if ( Expr.relative[ selector ] ) {
  3092. selector += parts.shift();
  3093. }
  3094. set = posProcess( selector, set );
  3095. }
  3096. }
  3097. } else {
  3098. // Take a shortcut and set the context if the root selector is an ID
  3099. // (but not if it'll be faster if the inner selector is an ID)
  3100. if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
  3101. Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
  3102. ret = Sizzle.find( parts.shift(), context, contextXML );
  3103. context = ret.expr ?
  3104. Sizzle.filter( ret.expr, ret.set )[0] :
  3105. ret.set[0];
  3106. }
  3107. if ( context ) {
  3108. ret = seed ?
  3109. { expr: parts.pop(), set: makeArray(seed) } :
  3110. Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
  3111. set = ret.expr ?
  3112. Sizzle.filter( ret.expr, ret.set ) :
  3113. ret.set;
  3114. if ( parts.length > 0 ) {
  3115. checkSet = makeArray( set );
  3116. } else {
  3117. prune = false;
  3118. }
  3119. while ( parts.length ) {
  3120. cur = parts.pop();
  3121. pop = cur;
  3122. if ( !Expr.relative[ cur ] ) {
  3123. cur = "";
  3124. } else {
  3125. pop = parts.pop();
  3126. }
  3127. if ( pop == null ) {
  3128. pop = context;
  3129. }
  3130. Expr.relative[ cur ]( checkSet, pop, contextXML );
  3131. }
  3132. } else {
  3133. checkSet = parts = [];
  3134. }
  3135. }
  3136. if ( !checkSet ) {
  3137. checkSet = set;
  3138. }
  3139. if ( !checkSet ) {
  3140. Sizzle.error( cur || selector );
  3141. }
  3142. if ( toString.call(checkSet) === "[object Array]" ) {
  3143. if ( !prune ) {
  3144. results.push.apply( results, checkSet );
  3145. } else if ( context && context.nodeType === 1 ) {
  3146. for ( i = 0; checkSet[i] != null; i++ ) {
  3147. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
  3148. results.push( set[i] );
  3149. }
  3150. }
  3151. } else {
  3152. for ( i = 0; checkSet[i] != null; i++ ) {
  3153. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  3154. results.push( set[i] );
  3155. }
  3156. }
  3157. }
  3158. } else {
  3159. makeArray( checkSet, results );
  3160. }
  3161. if ( extra ) {
  3162. Sizzle( extra, origContext, results, seed );
  3163. Sizzle.uniqueSort( results );
  3164. }
  3165. return results;
  3166. };
  3167. Sizzle.uniqueSort = function( results ) {
  3168. if ( sortOrder ) {
  3169. hasDuplicate = baseHasDuplicate;
  3170. results.sort( sortOrder );
  3171. if ( hasDuplicate ) {
  3172. for ( var i = 1; i < results.length; i++ ) {
  3173. if ( results[i] === results[ i - 1 ] ) {
  3174. results.splice( i--, 1 );
  3175. }
  3176. }
  3177. }
  3178. }
  3179. return results;
  3180. };
  3181. Sizzle.matches = function( expr, set ) {
  3182. return Sizzle( expr, null, null, set );
  3183. };
  3184. Sizzle.matchesSelector = function( node, expr ) {
  3185. return Sizzle( expr, null, null, [node] ).length > 0;
  3186. };
  3187. Sizzle.find = function( expr, context, isXML ) {
  3188. var set;
  3189. if ( !expr ) {
  3190. return [];
  3191. }
  3192. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  3193. var match,
  3194. type = Expr.order[i];
  3195. if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
  3196. var left = match[1];
  3197. match.splice( 1, 1 );
  3198. if ( left.substr( left.length - 1 ) !== "\\" ) {
  3199. match[1] = (match[1] || "").replace( rBackslash, "" );
  3200. set = Expr.find[ type ]( match, context, isXML );
  3201. if ( set != null ) {
  3202. expr = expr.replace( Expr.match[ type ], "" );
  3203. break;
  3204. }
  3205. }
  3206. }
  3207. }
  3208. if ( !set ) {
  3209. set = typeof context.getElementsByTagName !== "undefined" ?
  3210. context.getElementsByTagName( "*" ) :
  3211. [];
  3212. }
  3213. return { set: set, expr: expr };
  3214. };
  3215. Sizzle.filter = function( expr, set, inplace, not ) {
  3216. var match, anyFound,
  3217. old = expr,
  3218. result = [],
  3219. curLoop = set,
  3220. isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
  3221. while ( expr && set.length ) {
  3222. for ( var type in Expr.filter ) {
  3223. if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
  3224. var found, item,
  3225. filter = Expr.filter[ type ],
  3226. left = match[1];
  3227. anyFound = false;
  3228. match.splice(1,1);
  3229. if ( left.substr( left.length - 1 ) === "\\" ) {
  3230. continue;
  3231. }
  3232. if ( curLoop === result ) {
  3233. result = [];
  3234. }
  3235. if ( Expr.preFilter[ type ] ) {
  3236. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  3237. if ( !match ) {
  3238. anyFound = found = true;
  3239. } else if ( match === true ) {
  3240. continue;
  3241. }
  3242. }
  3243. if ( match ) {
  3244. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  3245. if ( item ) {
  3246. found = filter( item, match, i, curLoop );
  3247. var pass = not ^ !!found;
  3248. if ( inplace && found != null ) {
  3249. if ( pass ) {
  3250. anyFound = true;
  3251. } else {
  3252. curLoop[i] = false;
  3253. }
  3254. } else if ( pass ) {
  3255. result.push( item );
  3256. anyFound = true;
  3257. }
  3258. }
  3259. }
  3260. }
  3261. if ( found !== undefined ) {
  3262. if ( !inplace ) {
  3263. curLoop = result;
  3264. }
  3265. expr = expr.replace( Expr.match[ type ], "" );
  3266. if ( !anyFound ) {
  3267. return [];
  3268. }
  3269. break;
  3270. }
  3271. }
  3272. }
  3273. // Improper expression
  3274. if ( expr === old ) {
  3275. if ( anyFound == null ) {
  3276. Sizzle.error( expr );
  3277. } else {
  3278. break;
  3279. }
  3280. }
  3281. old = expr;
  3282. }
  3283. return curLoop;
  3284. };
  3285. Sizzle.error = function( msg ) {
  3286. throw "Syntax error, unrecognized expression: " + msg;
  3287. };
  3288. var Expr = Sizzle.selectors = {
  3289. order: [ "ID", "NAME", "TAG" ],
  3290. match: {
  3291. ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  3292. CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  3293. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
  3294. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
  3295. TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
  3296. CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
  3297. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
  3298. PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
  3299. },
  3300. leftMatch: {},
  3301. attrMap: {
  3302. "class": "className",
  3303. "for": "htmlFor"
  3304. },
  3305. attrHandle: {
  3306. href: function( elem ) {
  3307. return elem.getAttribute( "href" );
  3308. },
  3309. type: function( elem ) {
  3310. return elem.getAttribute( "type" );
  3311. }
  3312. },
  3313. relative: {
  3314. "+": function(checkSet, part){
  3315. var isPartStr = typeof part === "string",
  3316. isTag = isPartStr && !rNonWord.test( part ),
  3317. isPartStrNotTag = isPartStr && !isTag;
  3318. if ( isTag ) {
  3319. part = part.toLowerCase();
  3320. }
  3321. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  3322. if ( (elem = checkSet[i]) ) {
  3323. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  3324. checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
  3325. elem || false :
  3326. elem === part;
  3327. }
  3328. }
  3329. if ( isPartStrNotTag ) {
  3330. Sizzle.filter( part, checkSet, true );
  3331. }
  3332. },
  3333. ">": function( checkSet, part ) {
  3334. var elem,
  3335. isPartStr = typeof part === "string",
  3336. i = 0,
  3337. l = checkSet.length;
  3338. if ( isPartStr && !rNonWord.test( part ) ) {
  3339. part = part.toLowerCase();
  3340. for ( ; i < l; i++ ) {
  3341. elem = checkSet[i];
  3342. if ( elem ) {
  3343. var parent = elem.parentNode;
  3344. checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
  3345. }
  3346. }
  3347. } else {
  3348. for ( ; i < l; i++ ) {
  3349. elem = checkSet[i];
  3350. if ( elem ) {
  3351. checkSet[i] = isPartStr ?
  3352. elem.parentNode :
  3353. elem.parentNode === part;
  3354. }
  3355. }
  3356. if ( isPartStr ) {
  3357. Sizzle.filter( part, checkSet, true );
  3358. }
  3359. }
  3360. },
  3361. "": function(checkSet, part, isXML){
  3362. var nodeCheck,
  3363. doneName = done++,
  3364. checkFn = dirCheck;
  3365. if ( typeof part === "string" && !rNonWord.test( part ) ) {
  3366. part = part.toLowerCase();
  3367. nodeCheck = part;
  3368. checkFn = dirNodeCheck;
  3369. }
  3370. checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
  3371. },
  3372. "~": function( checkSet, part, isXML ) {
  3373. var nodeCheck,
  3374. doneName = done++,
  3375. checkFn = dirCheck;
  3376. if ( typeof part === "string" && !rNonWord.test( part ) ) {
  3377. part = part.toLowerCase();
  3378. nodeCheck = part;
  3379. checkFn = dirNodeCheck;
  3380. }
  3381. checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
  3382. }
  3383. },
  3384. find: {
  3385. ID: function( match, context, isXML ) {
  3386. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  3387. var m = context.getElementById(match[1]);
  3388. // Check parentNode to catch when Blackberry 4.6 returns
  3389. // nodes that are no longer in the document #6963
  3390. return m && m.parentNode ? [m] : [];
  3391. }
  3392. },
  3393. NAME: function( match, context ) {
  3394. if ( typeof context.getElementsByName !== "undefined" ) {
  3395. var ret = [],
  3396. results = context.getElementsByName( match[1] );
  3397. for ( var i = 0, l = results.length; i < l; i++ ) {
  3398. if ( results[i].getAttribute("name") === match[1] ) {
  3399. ret.push( results[i] );
  3400. }
  3401. }
  3402. return ret.length === 0 ? null : ret;
  3403. }
  3404. },
  3405. TAG: function( match, context ) {
  3406. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3407. return context.getElementsByTagName( match[1] );
  3408. }
  3409. }
  3410. },
  3411. preFilter: {
  3412. CLASS: function( match, curLoop, inplace, result, not, isXML ) {
  3413. match = " " + match[1].replace( rBackslash, "" ) + " ";
  3414. if ( isXML ) {
  3415. return match;
  3416. }
  3417. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  3418. if ( elem ) {
  3419. if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
  3420. if ( !inplace ) {
  3421. result.push( elem );
  3422. }
  3423. } else if ( inplace ) {
  3424. curLoop[i] = false;
  3425. }
  3426. }
  3427. }
  3428. return false;
  3429. },
  3430. ID: function( match ) {
  3431. return match[1].replace( rBackslash, "" );
  3432. },
  3433. TAG: function( match, curLoop ) {
  3434. return match[1].replace( rBackslash, "" ).toLowerCase();
  3435. },
  3436. CHILD: function( match ) {
  3437. if ( match[1] === "nth" ) {
  3438. if ( !match[2] ) {
  3439. Sizzle.error( match[0] );
  3440. }
  3441. match[2] = match[2].replace(/^\+|\s*/g, '');
  3442. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  3443. var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
  3444. match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
  3445. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  3446. // calculate the numbers (first)n+(last) including if they are negative
  3447. match[2] = (test[1] + (test[2] || 1)) - 0;
  3448. match[3] = test[3] - 0;
  3449. }
  3450. else if ( match[2] ) {
  3451. Sizzle.error( match[0] );
  3452. }
  3453. // TODO: Move to normal caching system
  3454. match[0] = done++;
  3455. return match;
  3456. },
  3457. ATTR: function( match, curLoop, inplace, result, not, isXML ) {
  3458. var name = match[1] = match[1].replace( rBackslash, "" );
  3459. if ( !isXML && Expr.attrMap[name] ) {
  3460. match[1] = Expr.attrMap[name];
  3461. }
  3462. // Handle if an un-quoted value was used
  3463. match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
  3464. if ( match[2] === "~=" ) {
  3465. match[4] = " " + match[4] + " ";
  3466. }
  3467. return match;
  3468. },
  3469. PSEUDO: function( match, curLoop, inplace, result, not ) {
  3470. if ( match[1] === "not" ) {
  3471. // If we're dealing with a complex expression, or a simple one
  3472. if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
  3473. match[3] = Sizzle(match[3], null, null, curLoop);
  3474. } else {
  3475. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  3476. if ( !inplace ) {
  3477. result.push.apply( result, ret );
  3478. }
  3479. return false;
  3480. }
  3481. } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
  3482. return true;
  3483. }
  3484. return match;
  3485. },
  3486. POS: function( match ) {
  3487. match.unshift( true );
  3488. return match;
  3489. }
  3490. },
  3491. filters: {
  3492. enabled: function( elem ) {
  3493. return elem.disabled === false && elem.type !== "hidden";
  3494. },
  3495. disabled: function( elem ) {
  3496. return elem.disabled === true;
  3497. },
  3498. checked: function( elem ) {
  3499. return elem.checked === true;
  3500. },
  3501. selected: function( elem ) {
  3502. // Accessing this property makes selected-by-default
  3503. // options in Safari work properly
  3504. if ( elem.parentNode ) {
  3505. elem.parentNode.selectedIndex;
  3506. }
  3507. return elem.selected === true;
  3508. },
  3509. parent: function( elem ) {
  3510. return !!elem.firstChild;
  3511. },
  3512. empty: function( elem ) {
  3513. return !elem.firstChild;
  3514. },
  3515. has: function( elem, i, match ) {
  3516. return !!Sizzle( match[3], elem ).length;
  3517. },
  3518. header: function( elem ) {
  3519. return (/h\d/i).test( elem.nodeName );
  3520. },
  3521. text: function( elem ) {
  3522. var attr = elem.getAttribute( "type" ), type = elem.type;
  3523. // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
  3524. // use getAttribute instead to test this case
  3525. return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
  3526. },
  3527. radio: function( elem ) {
  3528. return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
  3529. },
  3530. checkbox: function( elem ) {
  3531. return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
  3532. },
  3533. file: function( elem ) {
  3534. return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
  3535. },
  3536. password: function( elem ) {
  3537. return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
  3538. },
  3539. submit: function( elem ) {
  3540. var name = elem.nodeName.toLowerCase();
  3541. return (name === "input" || name === "button") && "submit" === elem.type;
  3542. },
  3543. image: function( elem ) {
  3544. return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
  3545. },
  3546. reset: function( elem ) {
  3547. var name = elem.nodeName.toLowerCase();
  3548. return (name === "input" || name === "button") && "reset" === elem.type;
  3549. },
  3550. button: function( elem ) {
  3551. var name = elem.nodeName.toLowerCase();
  3552. return name === "input" && "button" === elem.type || name === "button";
  3553. },
  3554. input: function( elem ) {
  3555. return (/input|select|textarea|button/i).test( elem.nodeName );
  3556. },
  3557. focus: function( elem ) {
  3558. return elem === elem.ownerDocument.activeElement;
  3559. }
  3560. },
  3561. setFilters: {
  3562. first: function( elem, i ) {
  3563. return i === 0;
  3564. },
  3565. last: function( elem, i, match, array ) {
  3566. return i === array.length - 1;
  3567. },
  3568. even: function( elem, i ) {
  3569. return i % 2 === 0;
  3570. },
  3571. odd: function( elem, i ) {
  3572. return i % 2 === 1;
  3573. },
  3574. lt: function( elem, i, match ) {
  3575. return i < match[3] - 0;
  3576. },
  3577. gt: function( elem, i, match ) {
  3578. return i > match[3] - 0;
  3579. },
  3580. nth: function( elem, i, match ) {
  3581. return match[3] - 0 === i;
  3582. },
  3583. eq: function( elem, i, match ) {
  3584. return match[3] - 0 === i;
  3585. }
  3586. },
  3587. filter: {
  3588. PSEUDO: function( elem, match, i, array ) {
  3589. var name = match[1],
  3590. filter = Expr.filters[ name ];
  3591. if ( filter ) {
  3592. return filter( elem, i, match, array );
  3593. } else if ( name === "contains" ) {
  3594. return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
  3595. } else if ( name === "not" ) {
  3596. var not = match[3];
  3597. for ( var j = 0, l = not.length; j < l; j++ ) {
  3598. if ( not[j] === elem ) {
  3599. return false;
  3600. }
  3601. }
  3602. return true;
  3603. } else {
  3604. Sizzle.error( name );
  3605. }
  3606. },
  3607. CHILD: function( elem, match ) {
  3608. var type = match[1],
  3609. node = elem;
  3610. switch ( type ) {
  3611. case "only":
  3612. case "first":
  3613. while ( (node = node.previousSibling) ) {
  3614. if ( node.nodeType === 1 ) {
  3615. return false;
  3616. }
  3617. }
  3618. if ( type === "first" ) {
  3619. return true;
  3620. }
  3621. node = elem;
  3622. case "last":
  3623. while ( (node = node.nextSibling) ) {
  3624. if ( node.nodeType === 1 ) {
  3625. return false;
  3626. }
  3627. }
  3628. return true;
  3629. case "nth":
  3630. var first = match[2],
  3631. last = match[3];
  3632. if ( first === 1 && last === 0 ) {
  3633. return true;
  3634. }
  3635. var doneName = match[0],
  3636. parent = elem.parentNode;
  3637. if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
  3638. var count = 0;
  3639. for ( node = parent.firstChild; node; node = node.nextSibling ) {
  3640. if ( node.nodeType === 1 ) {
  3641. node.nodeIndex = ++count;
  3642. }
  3643. }
  3644. parent.sizcache = doneName;
  3645. }
  3646. var diff = elem.nodeIndex - last;
  3647. if ( first === 0 ) {
  3648. return diff === 0;
  3649. } else {
  3650. return ( diff % first === 0 && diff / first >= 0 );
  3651. }
  3652. }
  3653. },
  3654. ID: function( elem, match ) {
  3655. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  3656. },
  3657. TAG: function( elem, match ) {
  3658. return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
  3659. },
  3660. CLASS: function( elem, match ) {
  3661. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  3662. .indexOf( match ) > -1;
  3663. },
  3664. ATTR: function( elem, match ) {
  3665. var name = match[1],
  3666. result = Expr.attrHandle[ name ] ?
  3667. Expr.attrHandle[ name ]( elem ) :
  3668. elem[ name ] != null ?
  3669. elem[ name ] :
  3670. elem.getAttribute( name ),
  3671. value = result + "",
  3672. type = match[2],
  3673. check = match[4];
  3674. return result == null ?
  3675. type === "!=" :
  3676. type === "=" ?
  3677. value === check :
  3678. type === "*=" ?
  3679. value.indexOf(check) >= 0 :
  3680. type === "~=" ?
  3681. (" " + value + " ").indexOf(check) >= 0 :
  3682. !check ?
  3683. value && result !== false :
  3684. type === "!=" ?
  3685. value !== check :
  3686. type === "^=" ?
  3687. value.indexOf(check) === 0 :
  3688. type === "$=" ?
  3689. value.substr(value.length - check.length) === check :
  3690. type === "|=" ?
  3691. value === check || value.substr(0, check.length + 1) === check + "-" :
  3692. false;
  3693. },
  3694. POS: function( elem, match, i, array ) {
  3695. var name = match[2],
  3696. filter = Expr.setFilters[ name ];
  3697. if ( filter ) {
  3698. return filter( elem, i, match, array );
  3699. }
  3700. }
  3701. }
  3702. };
  3703. var origPOS = Expr.match.POS,
  3704. fescape = function(all, num){
  3705. return "\\" + (num - 0 + 1);
  3706. };
  3707. for ( var type in Expr.match ) {
  3708. Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
  3709. Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
  3710. }
  3711. var makeArray = function( array, results ) {
  3712. array = Array.prototype.slice.call( array, 0 );
  3713. if ( results ) {
  3714. results.push.apply( results, array );
  3715. return results;
  3716. }
  3717. return array;
  3718. };
  3719. // Perform a simple check to determine if the browser is capable of
  3720. // converting a NodeList to an array using builtin methods.
  3721. // Also verifies that the returned array holds DOM nodes
  3722. // (which is not the case in the Blackberry browser)
  3723. try {
  3724. Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
  3725. // Provide a fallback method if it does not work
  3726. } catch( e ) {
  3727. makeArray = function( array, results ) {
  3728. var i = 0,
  3729. ret = results || [];
  3730. if ( toString.call(array) === "[object Array]" ) {
  3731. Array.prototype.push.apply( ret, array );
  3732. } else {
  3733. if ( typeof array.length === "number" ) {
  3734. for ( var l = array.length; i < l; i++ ) {
  3735. ret.push( array[i] );
  3736. }
  3737. } else {
  3738. for ( ; array[i]; i++ ) {
  3739. ret.push( array[i] );
  3740. }
  3741. }
  3742. }
  3743. return ret;
  3744. };
  3745. }
  3746. var sortOrder, siblingCheck;
  3747. if ( document.documentElement.compareDocumentPosition ) {
  3748. sortOrder = function( a, b ) {
  3749. if ( a === b ) {
  3750. hasDuplicate = true;
  3751. return 0;
  3752. }
  3753. if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
  3754. return a.compareDocumentPosition ? -1 : 1;
  3755. }
  3756. return a.compareDocumentPosition(b) & 4 ? -1 : 1;
  3757. };
  3758. } else {
  3759. sortOrder = function( a, b ) {
  3760. // The nodes are identical, we can exit early
  3761. if ( a === b ) {
  3762. hasDuplicate = true;
  3763. return 0;
  3764. // Fallback to using sourceIndex (in IE) if it's available on both nodes
  3765. } else if ( a.sourceIndex && b.sourceIndex ) {
  3766. return a.sourceIndex - b.sourceIndex;
  3767. }
  3768. var al, bl,
  3769. ap = [],
  3770. bp = [],
  3771. aup = a.parentNode,
  3772. bup = b.parentNode,
  3773. cur = aup;
  3774. // If the nodes are siblings (or identical) we can do a quick check
  3775. if ( aup === bup ) {
  3776. return siblingCheck( a, b );
  3777. // If no parents were found then the nodes are disconnected
  3778. } else if ( !aup ) {
  3779. return -1;
  3780. } else if ( !bup ) {
  3781. return 1;
  3782. }
  3783. // Otherwise they're somewhere else in the tree so we need
  3784. // to build up a full list of the parentNodes for comparison
  3785. while ( cur ) {
  3786. ap.unshift( cur );
  3787. cur = cur.parentNode;
  3788. }
  3789. cur = bup;
  3790. while ( cur ) {
  3791. bp.unshift( cur );
  3792. cur = cur.parentNode;
  3793. }
  3794. al = ap.length;
  3795. bl = bp.length;
  3796. // Start walking down the tree looking for a discrepancy
  3797. for ( var i = 0; i < al && i < bl; i++ ) {
  3798. if ( ap[i] !== bp[i] ) {
  3799. return siblingCheck( ap[i], bp[i] );
  3800. }
  3801. }
  3802. // We ended someplace up the tree so do a sibling check
  3803. return i === al ?
  3804. siblingCheck( a, bp[i], -1 ) :
  3805. siblingCheck( ap[i], b, 1 );
  3806. };
  3807. siblingCheck = function( a, b, ret ) {
  3808. if ( a === b ) {
  3809. return ret;
  3810. }
  3811. var cur = a.nextSibling;
  3812. while ( cur ) {
  3813. if ( cur === b ) {
  3814. return -1;
  3815. }
  3816. cur = cur.nextSibling;
  3817. }
  3818. return 1;
  3819. };
  3820. }
  3821. // Utility function for retreiving the text value of an array of DOM nodes
  3822. Sizzle.getText = function( elems ) {
  3823. var ret = "", elem;
  3824. for ( var i = 0; elems[i]; i++ ) {
  3825. elem = elems[i];
  3826. // Get the text from text nodes and CDATA nodes
  3827. if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
  3828. ret += elem.nodeValue;
  3829. // Traverse everything else, except comment nodes
  3830. } else if ( elem.nodeType !== 8 ) {
  3831. ret += Sizzle.getText( elem.childNodes );
  3832. }
  3833. }
  3834. return ret;
  3835. };
  3836. // Check to see if the browser returns elements by name when
  3837. // querying by getElementById (and provide a workaround)
  3838. (function(){
  3839. // We're going to inject a fake input element with a specified name
  3840. var form = document.createElement("div"),
  3841. id = "script" + (new Date()).getTime(),
  3842. root = document.documentElement;
  3843. form.innerHTML = "<a name='" + id + "'/>";
  3844. // Inject it into the root element, check its status, and remove it quickly
  3845. root.insertBefore( form, root.firstChild );
  3846. // The workaround has to do additional checks after a getElementById
  3847. // Which slows things down for other browsers (hence the branching)
  3848. if ( document.getElementById( id ) ) {
  3849. Expr.find.ID = function( match, context, isXML ) {
  3850. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  3851. var m = context.getElementById(match[1]);
  3852. return m ?
  3853. m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
  3854. [m] :
  3855. undefined :
  3856. [];
  3857. }
  3858. };
  3859. Expr.filter.ID = function( elem, match ) {
  3860. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  3861. return elem.nodeType === 1 && node && node.nodeValue === match;
  3862. };
  3863. }
  3864. root.removeChild( form );
  3865. // release memory in IE
  3866. root = form = null;
  3867. })();
  3868. (function(){
  3869. // Check to see if the browser returns only elements
  3870. // when doing getElementsByTagName("*")
  3871. // Create a fake element
  3872. var div = document.createElement("div");
  3873. div.appendChild( document.createComment("") );
  3874. // Make sure no comments are found
  3875. if ( div.getElementsByTagName("*").length > 0 ) {
  3876. Expr.find.TAG = function( match, context ) {
  3877. var results = context.getElementsByTagName( match[1] );
  3878. // Filter out possible comments
  3879. if ( match[1] === "*" ) {
  3880. var tmp = [];
  3881. for ( var i = 0; results[i]; i++ ) {
  3882. if ( results[i].nodeType === 1 ) {
  3883. tmp.push( results[i] );
  3884. }
  3885. }
  3886. results = tmp;
  3887. }
  3888. return results;
  3889. };
  3890. }
  3891. // Check to see if an attribute returns normalized href attributes
  3892. div.innerHTML = "<a href='#'></a>";
  3893. if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  3894. div.firstChild.getAttribute("href") !== "#" ) {
  3895. Expr.attrHandle.href = function( elem ) {
  3896. return elem.getAttribute( "href", 2 );
  3897. };
  3898. }
  3899. // release memory in IE
  3900. div = null;
  3901. })();
  3902. if ( document.querySelectorAll ) {
  3903. (function(){
  3904. var oldSizzle = Sizzle,
  3905. div = document.createElement("div"),
  3906. id = "__sizzle__";
  3907. div.innerHTML = "<p class='TEST'></p>";
  3908. // Safari can't handle uppercase or unicode characters when
  3909. // in quirks mode.
  3910. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
  3911. return;
  3912. }
  3913. Sizzle = function( query, context, extra, seed ) {
  3914. context = context || document;
  3915. // Only use querySelectorAll on non-XML documents
  3916. // (ID selectors don't work in non-HTML documents)
  3917. if ( !seed && !Sizzle.isXML(context) ) {
  3918. // See if we find a selector to speed up
  3919. var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
  3920. if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
  3921. // Speed-up: Sizzle("TAG")
  3922. if ( match[1] ) {
  3923. return makeArray( context.getElementsByTagName( query ), extra );
  3924. // Speed-up: Sizzle(".CLASS")
  3925. } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
  3926. return makeArray( context.getElementsByClassName( match[2] ), extra );
  3927. }
  3928. }
  3929. if ( context.nodeType === 9 ) {
  3930. // Speed-up: Sizzle("body")
  3931. // The body element only exists once, optimize finding it
  3932. if ( query === "body" && context.body ) {
  3933. return makeArray( [ context.body ], extra );
  3934. // Speed-up: Sizzle("#ID")
  3935. } else if ( match && match[3] ) {
  3936. var elem = context.getElementById( match[3] );
  3937. // Check parentNode to catch when Blackberry 4.6 returns
  3938. // nodes that are no longer in the document #6963
  3939. if ( elem && elem.parentNode ) {
  3940. // Handle the case where IE and Opera return items
  3941. // by name instead of ID
  3942. if ( elem.id === match[3] ) {
  3943. return makeArray( [ elem ], extra );
  3944. }
  3945. } else {
  3946. return makeArray( [], extra );
  3947. }
  3948. }
  3949. try {
  3950. return makeArray( context.querySelectorAll(query), extra );
  3951. } catch(qsaError) {}
  3952. // qSA works strangely on Element-rooted queries
  3953. // We can work around this by specifying an extra ID on the root
  3954. // and working up from there (Thanks to Andrew Dupont for the technique)
  3955. // IE 8 doesn't work on object elements
  3956. } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  3957. var oldContext = context,
  3958. old = context.getAttribute( "id" ),
  3959. nid = old || id,
  3960. hasParent = context.parentNode,
  3961. relativeHierarchySelector = /^\s*[+~]/.test( query );
  3962. if ( !old ) {
  3963. context.setAttribute( "id", nid );
  3964. } else {
  3965. nid = nid.replace( /'/g, "\\$&" );
  3966. }
  3967. if ( relativeHierarchySelector && hasParent ) {
  3968. context = context.parentNode;
  3969. }
  3970. try {
  3971. if ( !relativeHierarchySelector || hasParent ) {
  3972. return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
  3973. }
  3974. } catch(pseudoError) {
  3975. } finally {
  3976. if ( !old ) {
  3977. oldContext.removeAttribute( "id" );
  3978. }
  3979. }
  3980. }
  3981. }
  3982. return oldSizzle(query, context, extra, seed);
  3983. };
  3984. for ( var prop in oldSizzle ) {
  3985. Sizzle[ prop ] = oldSizzle[ prop ];
  3986. }
  3987. // release memory in IE
  3988. div = null;
  3989. })();
  3990. }
  3991. (function(){
  3992. var html = document.documentElement,
  3993. matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
  3994. if ( matches ) {
  3995. // Check to see if it's possible to do matchesSelector
  3996. // on a disconnected node (IE 9 fails this)
  3997. var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
  3998. pseudoWorks = false;
  3999. try {
  4000. // This should fail with an exception
  4001. // Gecko does not error, returns false instead
  4002. matches.call( document.documentElement, "[test!='']:sizzle" );
  4003. } catch( pseudoError ) {
  4004. pseudoWorks = true;
  4005. }
  4006. Sizzle.matchesSelector = function( node, expr ) {
  4007. // Make sure that attribute selectors are quoted
  4008. expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
  4009. if ( !Sizzle.isXML( node ) ) {
  4010. try {
  4011. if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
  4012. var ret = matches.call( node, expr );
  4013. // IE 9's matchesSelector returns false on disconnected nodes
  4014. if ( ret || !disconnectedMatch ||
  4015. // As well, disconnected nodes are said to be in a document
  4016. // fragment in IE 9, so check for that
  4017. node.document && node.document.nodeType !== 11 ) {
  4018. return ret;
  4019. }
  4020. }
  4021. } catch(e) {}
  4022. }
  4023. return Sizzle(expr, null, null, [node]).length > 0;
  4024. };
  4025. }
  4026. })();
  4027. (function(){
  4028. var div = document.createElement("div");
  4029. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  4030. // Opera can't find a second classname (in 9.6)
  4031. // Also, make sure that getElementsByClassName actually exists
  4032. if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
  4033. return;
  4034. }
  4035. // Safari caches class attributes, doesn't catch changes (in 3.2)
  4036. div.lastChild.className = "e";
  4037. if ( div.getElementsByClassName("e").length === 1 ) {
  4038. return;
  4039. }
  4040. Expr.order.splice(1, 0, "CLASS");
  4041. Expr.find.CLASS = function( match, context, isXML ) {
  4042. if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
  4043. return context.getElementsByClassName(match[1]);
  4044. }
  4045. };
  4046. // release memory in IE
  4047. div = null;
  4048. })();
  4049. function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  4050. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  4051. var elem = checkSet[i];
  4052. if ( elem ) {
  4053. var match = false;
  4054. elem = elem[dir];
  4055. while ( elem ) {
  4056. if ( elem.sizcache === doneName ) {
  4057. match = checkSet[elem.sizset];
  4058. break;
  4059. }
  4060. if ( elem.nodeType === 1 && !isXML ){
  4061. elem.sizcache = doneName;
  4062. elem.sizset = i;
  4063. }
  4064. if ( elem.nodeName.toLowerCase() === cur ) {
  4065. match = elem;
  4066. break;
  4067. }
  4068. elem = elem[dir];
  4069. }
  4070. checkSet[i] = match;
  4071. }
  4072. }
  4073. }
  4074. function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  4075. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  4076. var elem = checkSet[i];
  4077. if ( elem ) {
  4078. var match = false;
  4079. elem = elem[dir];
  4080. while ( elem ) {
  4081. if ( elem.sizcache === doneName ) {
  4082. match = checkSet[elem.sizset];
  4083. break;
  4084. }
  4085. if ( elem.nodeType === 1 ) {
  4086. if ( !isXML ) {
  4087. elem.sizcache = doneName;
  4088. elem.sizset = i;
  4089. }
  4090. if ( typeof cur !== "string" ) {
  4091. if ( elem === cur ) {
  4092. match = true;
  4093. break;
  4094. }
  4095. } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
  4096. match = elem;
  4097. break;
  4098. }
  4099. }
  4100. elem = elem[dir];
  4101. }
  4102. checkSet[i] = match;
  4103. }
  4104. }
  4105. }
  4106. if ( document.documentElement.contains ) {
  4107. Sizzle.contains = function( a, b ) {
  4108. return a !== b && (a.contains ? a.contains(b) : true);
  4109. };
  4110. } else if ( document.documentElement.compareDocumentPosition ) {
  4111. Sizzle.contains = function( a, b ) {
  4112. return !!(a.compareDocumentPosition(b) & 16);
  4113. };
  4114. } else {
  4115. Sizzle.contains = function() {
  4116. return false;
  4117. };
  4118. }
  4119. Sizzle.isXML = function( elem ) {
  4120. // documentElement is verified for cases where it doesn't yet exist
  4121. // (such as loading iframes in IE - #4833)
  4122. var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
  4123. return documentElement ? documentElement.nodeName !== "HTML" : false;
  4124. };
  4125. var posProcess = function( selector, context ) {
  4126. var match,
  4127. tmpSet = [],
  4128. later = "",
  4129. root = context.nodeType ? [context] : context;
  4130. // Position selectors must be done after the filter
  4131. // And so must :not(positional) so we move all PSEUDOs to the end
  4132. while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
  4133. later += match[0];
  4134. selector = selector.replace( Expr.match.PSEUDO, "" );
  4135. }
  4136. selector = Expr.relative[selector] ? selector + "*" : selector;
  4137. for ( var i = 0, l = root.length; i < l; i++ ) {
  4138. Sizzle( selector, root[i], tmpSet );
  4139. }
  4140. return Sizzle.filter( later, tmpSet );
  4141. };
  4142. // EXPOSE
  4143. jQuery.find = Sizzle;
  4144. jQuery.expr = Sizzle.selectors;
  4145. jQuery.expr[":"] = jQuery.expr.filters;
  4146. jQuery.unique = Sizzle.uniqueSort;
  4147. jQuery.text = Sizzle.getText;
  4148. jQuery.isXMLDoc = Sizzle.isXML;
  4149. jQuery.contains = Sizzle.contains;
  4150. })();
  4151. var runtil = /Until$/,
  4152. rparentsprev = /^(?:parents|prevUntil|prevAll)/,
  4153. // Note: This RegExp should be improved, or likely pulled from Sizzle
  4154. rmultiselector = /,/,
  4155. isSimple = /^.[^:#\[\.,]*$/,
  4156. slice = Array.prototype.slice,
  4157. POS = jQuery.expr.match.POS,
  4158. // methods guaranteed to produce a unique set when starting from a unique set
  4159. guaranteedUnique = {
  4160. children: true,
  4161. contents: true,
  4162. next: true,
  4163. prev: true
  4164. };
  4165. jQuery.fn.extend({
  4166. find: function( selector ) {
  4167. var self = this,
  4168. i, l;
  4169. if ( typeof selector !== "string" ) {
  4170. return jQuery( selector ).filter(function() {
  4171. for ( i = 0, l = self.length; i < l; i++ ) {
  4172. if ( jQuery.contains( self[ i ], this ) ) {
  4173. return true;
  4174. }
  4175. }
  4176. });
  4177. }
  4178. var ret = this.pushStack( "", "find", selector ),
  4179. length, n, r;
  4180. for ( i = 0, l = this.length; i < l; i++ ) {
  4181. length = ret.length;
  4182. jQuery.find( selector, this[i], ret );
  4183. if ( i > 0 ) {
  4184. // Make sure that the results are unique
  4185. for ( n = length; n < ret.length; n++ ) {
  4186. for ( r = 0; r < length; r++ ) {
  4187. if ( ret[r] === ret[n] ) {
  4188. ret.splice(n--, 1);
  4189. break;
  4190. }
  4191. }
  4192. }
  4193. }
  4194. }
  4195. return ret;
  4196. },
  4197. has: function( target ) {
  4198. var targets = jQuery( target );
  4199. return this.filter(function() {
  4200. for ( var i = 0, l = targets.length; i < l; i++ ) {
  4201. if ( jQuery.contains( this, targets[i] ) ) {
  4202. return true;
  4203. }
  4204. }
  4205. });
  4206. },
  4207. not: function( selector ) {
  4208. return this.pushStack( winnow(this, selector, false), "not", selector);
  4209. },
  4210. filter: function( selector ) {
  4211. return this.pushStack( winnow(this, selector, true), "filter", selector );
  4212. },
  4213. is: function( selector ) {
  4214. return !!selector && ( typeof selector === "string" ?
  4215. jQuery.filter( selector, this ).length > 0 :
  4216. this.filter( selector ).length > 0 );
  4217. },
  4218. closest: function( selectors, context ) {
  4219. var ret = [], i, l, cur = this[0];
  4220. // Array
  4221. if ( jQuery.isArray( selectors ) ) {
  4222. var match, selector,
  4223. matches = {},
  4224. level = 1;
  4225. if ( cur && selectors.length ) {
  4226. for ( i = 0, l = selectors.length; i < l; i++ ) {
  4227. selector = selectors[i];
  4228. if ( !matches[ selector ] ) {
  4229. matches[ selector ] = POS.test( selector ) ?
  4230. jQuery( selector, context || this.context ) :
  4231. selector;
  4232. }
  4233. }
  4234. while ( cur && cur.ownerDocument && cur !== context ) {
  4235. for ( selector in matches ) {
  4236. match = matches[ selector ];
  4237. if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
  4238. ret.push({ selector: selector, elem: cur, level: level });
  4239. }
  4240. }
  4241. cur = cur.parentNode;
  4242. level++;
  4243. }
  4244. }
  4245. return ret;
  4246. }
  4247. // String
  4248. var pos = POS.test( selectors ) || typeof selectors !== "string" ?
  4249. jQuery( selectors, context || this.context ) :
  4250. 0;
  4251. for ( i = 0, l = this.length; i < l; i++ ) {
  4252. cur = this[i];
  4253. while ( cur ) {
  4254. if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
  4255. ret.push( cur );
  4256. break;
  4257. } else {
  4258. cur = cur.parentNode;
  4259. if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
  4260. break;
  4261. }
  4262. }
  4263. }
  4264. }
  4265. ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
  4266. return this.pushStack( ret, "closest", selectors );
  4267. },
  4268. // Determine the position of an element within
  4269. // the matched set of elements
  4270. index: function( elem ) {
  4271. if ( !elem || typeof elem === "string" ) {
  4272. return jQuery.inArray( this[0],
  4273. // If it receives a string, the selector is used
  4274. // If it receives nothing, the siblings are used
  4275. elem ? jQuery( elem ) : this.parent().children() );
  4276. }
  4277. // Locate the position of the desired element
  4278. return jQuery.inArray(
  4279. // If it receives a jQuery object, the first element is used
  4280. elem.jquery ? elem[0] : elem, this );
  4281. },
  4282. add: function( selector, context ) {
  4283. var set = typeof selector === "string" ?
  4284. jQuery( selector, context ) :
  4285. jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
  4286. all = jQuery.merge( this.get(), set );
  4287. return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
  4288. all :
  4289. jQuery.unique( all ) );
  4290. },
  4291. andSelf: function() {
  4292. return this.add( this.prevObject );
  4293. }
  4294. });
  4295. // A painfully simple check to see if an element is disconnected
  4296. // from a document (should be improved, where feasible).
  4297. function isDisconnected( node ) {
  4298. return !node || !node.parentNode || node.parentNode.nodeType === 11;
  4299. }
  4300. jQuery.each({
  4301. parent: function( elem ) {
  4302. var parent = elem.parentNode;
  4303. return parent && parent.nodeType !== 11 ? parent : null;
  4304. },
  4305. parents: function( elem ) {
  4306. return jQuery.dir( elem, "parentNode" );
  4307. },
  4308. parentsUntil: function( elem, i, until ) {
  4309. return jQuery.dir( elem, "parentNode", until );
  4310. },
  4311. next: function( elem ) {
  4312. return jQuery.nth( elem, 2, "nextSibling" );
  4313. },
  4314. prev: function( elem ) {
  4315. return jQuery.nth( elem, 2, "previousSibling" );
  4316. },
  4317. nextAll: function( elem ) {
  4318. return jQuery.dir( elem, "nextSibling" );
  4319. },
  4320. prevAll: function( elem ) {
  4321. return jQuery.dir( elem, "previousSibling" );
  4322. },
  4323. nextUntil: function( elem, i, until ) {
  4324. return jQuery.dir( elem, "nextSibling", until );
  4325. },
  4326. prevUntil: function( elem, i, until ) {
  4327. return jQuery.dir( elem, "previousSibling", until );
  4328. },
  4329. siblings: function( elem ) {
  4330. return jQuery.sibling( elem.parentNode.firstChild, elem );
  4331. },
  4332. children: function( elem ) {
  4333. return jQuery.sibling( elem.firstChild );
  4334. },
  4335. contents: function( elem ) {
  4336. return jQuery.nodeName( elem, "iframe" ) ?
  4337. elem.contentDocument || elem.contentWindow.document :
  4338. jQuery.makeArray( elem.childNodes );
  4339. }
  4340. }, function( name, fn ) {
  4341. jQuery.fn[ name ] = function( until, selector ) {
  4342. var ret = jQuery.map( this, fn, until ),
  4343. // The variable 'args' was introduced in
  4344. // https://github.com/jquery/jquery/commit/52a0238
  4345. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4346. // http://code.google.com/p/v8/issues/detail?id=1050
  4347. args = slice.call(arguments);
  4348. if ( !runtil.test( name ) ) {
  4349. selector = until;
  4350. }
  4351. if ( selector && typeof selector === "string" ) {
  4352. ret = jQuery.filter( selector, ret );
  4353. }
  4354. ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
  4355. if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
  4356. ret = ret.reverse();
  4357. }
  4358. return this.pushStack( ret, name, args.join(",") );
  4359. };
  4360. });
  4361. jQuery.extend({
  4362. filter: function( expr, elems, not ) {
  4363. if ( not ) {
  4364. expr = ":not(" + expr + ")";
  4365. }
  4366. return elems.length === 1 ?
  4367. jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
  4368. jQuery.find.matches(expr, elems);
  4369. },
  4370. dir: function( elem, dir, until ) {
  4371. var matched = [],
  4372. cur = elem[ dir ];
  4373. while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
  4374. if ( cur.nodeType === 1 ) {
  4375. matched.push( cur );
  4376. }
  4377. cur = cur[dir];
  4378. }
  4379. return matched;
  4380. },
  4381. nth: function( cur, result, dir, elem ) {
  4382. result = result || 1;
  4383. var num = 0;
  4384. for ( ; cur; cur = cur[dir] ) {
  4385. if ( cur.nodeType === 1 && ++num === result ) {
  4386. break;
  4387. }
  4388. }
  4389. return cur;
  4390. },
  4391. sibling: function( n, elem ) {
  4392. var r = [];
  4393. for ( ; n; n = n.nextSibling ) {
  4394. if ( n.nodeType === 1 && n !== elem ) {
  4395. r.push( n );
  4396. }
  4397. }
  4398. return r;
  4399. }
  4400. });
  4401. // Implement the identical functionality for filter and not
  4402. function winnow( elements, qualifier, keep ) {
  4403. // Can't pass null or undefined to indexOf in Firefox 4
  4404. // Set to 0 to skip string check
  4405. qualifier = qualifier || 0;
  4406. if ( jQuery.isFunction( qualifier ) ) {
  4407. return jQuery.grep(elements, function( elem, i ) {
  4408. var retVal = !!qualifier.call( elem, i, elem );
  4409. return retVal === keep;
  4410. });
  4411. } else if ( qualifier.nodeType ) {
  4412. return jQuery.grep(elements, function( elem, i ) {
  4413. return (elem === qualifier) === keep;
  4414. });
  4415. } else if ( typeof qualifier === "string" ) {
  4416. var filtered = jQuery.grep(elements, function( elem ) {
  4417. return elem.nodeType === 1;
  4418. });
  4419. if ( isSimple.test( qualifier ) ) {
  4420. return jQuery.filter(qualifier, filtered, !keep);
  4421. } else {
  4422. qualifier = jQuery.filter( qualifier, filtered );
  4423. }
  4424. }
  4425. return jQuery.grep(elements, function( elem, i ) {
  4426. return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  4427. });
  4428. }
  4429. var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
  4430. rleadingWhitespace = /^\s+/,
  4431. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  4432. rtagName = /<([\w:]+)/,
  4433. rtbody = /<tbody/i,
  4434. rhtml = /<|&#?\w+;/,
  4435. rnocache = /<(?:script|object|embed|option|style)/i,
  4436. // checked="checked" or checked
  4437. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4438. rscriptType = /\/(java|ecma)script/i,
  4439. rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
  4440. wrapMap = {
  4441. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4442. legend: [ 1, "<fieldset>", "</fieldset>" ],
  4443. thead: [ 1, "<table>", "</table>" ],
  4444. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4445. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4446. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  4447. area: [ 1, "<map>", "</map>" ],
  4448. _default: [ 0, "", "" ]
  4449. };
  4450. wrapMap.optgroup = wrapMap.option;
  4451. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4452. wrapMap.th = wrapMap.td;
  4453. // IE can't serialize <link> and <script> tags normally
  4454. if ( !jQuery.support.htmlSerialize ) {
  4455. wrapMap._default = [ 1, "div<div>", "</div>" ];
  4456. }
  4457. jQuery.fn.extend({
  4458. text: function( text ) {
  4459. if ( jQuery.isFunction(text) ) {
  4460. return this.each(function(i) {
  4461. var self = jQuery( this );
  4462. self.text( text.call(this, i, self.text()) );
  4463. });
  4464. }
  4465. if ( typeof text !== "object" && text !== undefined ) {
  4466. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  4467. }
  4468. return jQuery.text( this );
  4469. },
  4470. wrapAll: function( html ) {
  4471. if ( jQuery.isFunction( html ) ) {
  4472. return this.each(function(i) {
  4473. jQuery(this).wrapAll( html.call(this, i) );
  4474. });
  4475. }
  4476. if ( this[0] ) {
  4477. // The elements to wrap the target around
  4478. var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
  4479. if ( this[0].parentNode ) {
  4480. wrap.insertBefore( this[0] );
  4481. }
  4482. wrap.map(function() {
  4483. var elem = this;
  4484. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  4485. elem = elem.firstChild;
  4486. }
  4487. return elem;
  4488. }).append( this );
  4489. }
  4490. return this;
  4491. },
  4492. wrapInner: function( html ) {
  4493. if ( jQuery.isFunction( html ) ) {
  4494. return this.each(function(i) {
  4495. jQuery(this).wrapInner( html.call(this, i) );
  4496. });
  4497. }
  4498. return this.each(function() {
  4499. var self = jQuery( this ),
  4500. contents = self.contents();
  4501. if ( contents.length ) {
  4502. contents.wrapAll( html );
  4503. } else {
  4504. self.append( html );
  4505. }
  4506. });
  4507. },
  4508. wrap: function( html ) {
  4509. return this.each(function() {
  4510. jQuery( this ).wrapAll( html );
  4511. });
  4512. },
  4513. unwrap: function() {
  4514. return this.parent().each(function() {
  4515. if ( !jQuery.nodeName( this, "body" ) ) {
  4516. jQuery( this ).replaceWith( this.childNodes );
  4517. }
  4518. }).end();
  4519. },
  4520. append: function() {
  4521. return this.domManip(arguments, true, function( elem ) {
  4522. if ( this.nodeType === 1 ) {
  4523. this.appendChild( elem );
  4524. }
  4525. });
  4526. },
  4527. prepend: function() {
  4528. return this.domManip(arguments, true, function( elem ) {
  4529. if ( this.nodeType === 1 ) {
  4530. this.insertBefore( elem, this.firstChild );
  4531. }
  4532. });
  4533. },
  4534. before: function() {
  4535. if ( this[0] && this[0].parentNode ) {
  4536. return this.domManip(arguments, false, function( elem ) {
  4537. this.parentNode.insertBefore( elem, this );
  4538. });
  4539. } else if ( arguments.length ) {
  4540. var set = jQuery(arguments[0]);
  4541. set.push.apply( set, this.toArray() );
  4542. return this.pushStack( set, "before", arguments );
  4543. }
  4544. },
  4545. after: function() {
  4546. if ( this[0] && this[0].parentNode ) {
  4547. return this.domManip(arguments, false, function( elem ) {
  4548. this.parentNode.insertBefore( elem, this.nextSibling );
  4549. });
  4550. } else if ( arguments.length ) {
  4551. var set = this.pushStack( this, "after", arguments );
  4552. set.push.apply( set, jQuery(arguments[0]).toArray() );
  4553. return set;
  4554. }
  4555. },
  4556. // keepData is for internal use only--do not document
  4557. remove: function( selector, keepData ) {
  4558. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4559. if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
  4560. if ( !keepData && elem.nodeType === 1 ) {
  4561. jQuery.cleanData( elem.getElementsByTagName("*") );
  4562. jQuery.cleanData( [ elem ] );
  4563. }
  4564. if ( elem.parentNode ) {
  4565. elem.parentNode.removeChild( elem );
  4566. }
  4567. }
  4568. }
  4569. return this;
  4570. },
  4571. empty: function() {
  4572. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4573. // Remove element nodes and prevent memory leaks
  4574. if ( elem.nodeType === 1 ) {
  4575. jQuery.cleanData( elem.getElementsByTagName("*") );
  4576. }
  4577. // Remove any remaining nodes
  4578. while ( elem.firstChild ) {
  4579. elem.removeChild( elem.firstChild );
  4580. }
  4581. }
  4582. return this;
  4583. },
  4584. clone: function( dataAndEvents, deepDataAndEvents ) {
  4585. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4586. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4587. return this.map( function () {
  4588. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4589. });
  4590. },
  4591. html: function( value ) {
  4592. if ( value === undefined ) {
  4593. return this[0] && this[0].nodeType === 1 ?
  4594. this[0].innerHTML.replace(rinlinejQuery, "") :
  4595. null;
  4596. // See if we can take a shortcut and just use innerHTML
  4597. } else if ( typeof value === "string" && !rnocache.test( value ) &&
  4598. (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
  4599. !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
  4600. value = value.replace(rxhtmlTag, "<$1></$2>");
  4601. try {
  4602. for ( var i = 0, l = this.length; i < l; i++ ) {
  4603. // Remove element nodes and prevent memory leaks
  4604. if ( this[i].nodeType === 1 ) {
  4605. jQuery.cleanData( this[i].getElementsByTagName("*") );
  4606. this[i].innerHTML = value;
  4607. }
  4608. }
  4609. // If using innerHTML throws an exception, use the fallback method
  4610. } catch(e) {
  4611. this.empty().append( value );
  4612. }
  4613. } else if ( jQuery.isFunction( value ) ) {
  4614. this.each(function(i){
  4615. var self = jQuery( this );
  4616. self.html( value.call(this, i, self.html()) );
  4617. });
  4618. } else {
  4619. this.empty().append( value );
  4620. }
  4621. return this;
  4622. },
  4623. replaceWith: function( value ) {
  4624. if ( this[0] && this[0].parentNode ) {
  4625. // Make sure that the elements are removed from the DOM before they are inserted
  4626. // this can help fix replacing a parent with child elements
  4627. if ( jQuery.isFunction( value ) ) {
  4628. return this.each(function(i) {
  4629. var self = jQuery(this), old = self.html();
  4630. self.replaceWith( value.call( this, i, old ) );
  4631. });
  4632. }
  4633. if ( typeof value !== "string" ) {
  4634. value = jQuery( value ).detach();
  4635. }
  4636. return this.each(function() {
  4637. var next = this.nextSibling,
  4638. parent = this.parentNode;
  4639. jQuery( this ).remove();
  4640. if ( next ) {
  4641. jQuery(next).before( value );
  4642. } else {
  4643. jQuery(parent).append( value );
  4644. }
  4645. });
  4646. } else {
  4647. return this.length ?
  4648. this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
  4649. this;
  4650. }
  4651. },
  4652. detach: function( selector ) {
  4653. return this.remove( selector, true );
  4654. },
  4655. domManip: function( args, table, callback ) {
  4656. var results, first, fragment, parent,
  4657. value = args[0],
  4658. scripts = [];
  4659. // We can't cloneNode fragments that contain checked, in WebKit
  4660. if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
  4661. return this.each(function() {
  4662. jQuery(this).domManip( args, table, callback, true );
  4663. });
  4664. }
  4665. if ( jQuery.isFunction(value) ) {
  4666. return this.each(function(i) {
  4667. var self = jQuery(this);
  4668. args[0] = value.call(this, i, table ? self.html() : undefined);
  4669. self.domManip( args, table, callback );
  4670. });
  4671. }
  4672. if ( this[0] ) {
  4673. parent = value && value.parentNode;
  4674. // If we're in a fragment, just use that instead of building a new one
  4675. if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
  4676. results = { fragment: parent };
  4677. } else {
  4678. results = jQuery.buildFragment( args, this, scripts );
  4679. }
  4680. fragment = results.fragment;
  4681. if ( fragment.childNodes.length === 1 ) {
  4682. first = fragment = fragment.firstChild;
  4683. } else {
  4684. first = fragment.firstChild;
  4685. }
  4686. if ( first ) {
  4687. table = table && jQuery.nodeName( first, "tr" );
  4688. for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
  4689. callback.call(
  4690. table ?
  4691. root(this[i], first) :
  4692. this[i],
  4693. // Make sure that we do not leak memory by inadvertently discarding
  4694. // the original fragment (which might have attached data) instead of
  4695. // using it; in addition, use the original fragment object for the last
  4696. // item instead of first because it can end up being emptied incorrectly
  4697. // in certain situations (Bug #8070).
  4698. // Fragments from the fragment cache must always be cloned and never used
  4699. // in place.
  4700. results.cacheable || (l > 1 && i < lastIndex) ?
  4701. jQuery.clone( fragment, true, true ) :
  4702. fragment
  4703. );
  4704. }
  4705. }
  4706. if ( scripts.length ) {
  4707. jQuery.each( scripts, evalScript );
  4708. }
  4709. }
  4710. return this;
  4711. }
  4712. });
  4713. function root( elem, cur ) {
  4714. return jQuery.nodeName(elem, "table") ?
  4715. (elem.getElementsByTagName("tbody")[0] ||
  4716. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  4717. elem;
  4718. }
  4719. function cloneCopyEvent( src, dest ) {
  4720. if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
  4721. return;
  4722. }
  4723. var internalKey = jQuery.expando,
  4724. oldData = jQuery.data( src ),
  4725. curData = jQuery.data( dest, oldData );
  4726. // Switch to use the internal data object, if it exists, for the next
  4727. // stage of data copying
  4728. if ( (oldData = oldData[ internalKey ]) ) {
  4729. var events = oldData.events;
  4730. curData = curData[ internalKey ] = jQuery.extend({}, oldData);
  4731. if ( events ) {
  4732. delete curData.handle;
  4733. curData.events = {};
  4734. for ( var type in events ) {
  4735. for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
  4736. jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
  4737. }
  4738. }
  4739. }
  4740. }
  4741. }
  4742. function cloneFixAttributes( src, dest ) {
  4743. var nodeName;
  4744. // We do not need to do anything for non-Elements
  4745. if ( dest.nodeType !== 1 ) {
  4746. return;
  4747. }
  4748. // clearAttributes removes the attributes, which we don't want,
  4749. // but also removes the attachEvent events, which we *do* want
  4750. if ( dest.clearAttributes ) {
  4751. dest.clearAttributes();
  4752. }
  4753. // mergeAttributes, in contrast, only merges back on the
  4754. // original attributes, not the events
  4755. if ( dest.mergeAttributes ) {
  4756. dest.mergeAttributes( src );
  4757. }
  4758. nodeName = dest.nodeName.toLowerCase();
  4759. // IE6-8 fail to clone children inside object elements that use
  4760. // the proprietary classid attribute value (rather than the type
  4761. // attribute) to identify the type of content to display
  4762. if ( nodeName === "object" ) {
  4763. dest.outerHTML = src.outerHTML;
  4764. } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
  4765. // IE6-8 fails to persist the checked state of a cloned checkbox
  4766. // or radio button. Worse, IE6-7 fail to give the cloned element
  4767. // a checked appearance if the defaultChecked value isn't also set
  4768. if ( src.checked ) {
  4769. dest.defaultChecked = dest.checked = src.checked;
  4770. }
  4771. // IE6-7 get confused and end up setting the value of a cloned
  4772. // checkbox/radio button to an empty string instead of "on"
  4773. if ( dest.value !== src.value ) {
  4774. dest.value = src.value;
  4775. }
  4776. // IE6-8 fails to return the selected option to the default selected
  4777. // state when cloning options
  4778. } else if ( nodeName === "option" ) {
  4779. dest.selected = src.defaultSelected;
  4780. // IE6-8 fails to set the defaultValue to the correct value when
  4781. // cloning other types of input fields
  4782. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4783. dest.defaultValue = src.defaultValue;
  4784. }
  4785. // Event data gets referenced instead of copied if the expando
  4786. // gets copied too
  4787. dest.removeAttribute( jQuery.expando );
  4788. }
  4789. jQuery.buildFragment = function( args, nodes, scripts ) {
  4790. var fragment, cacheable, cacheresults,
  4791. doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
  4792. // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
  4793. // Cloning options loses the selected state, so don't cache them
  4794. // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
  4795. // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
  4796. if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
  4797. args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
  4798. cacheable = true;
  4799. cacheresults = jQuery.fragments[ args[0] ];
  4800. if ( cacheresults && cacheresults !== 1 ) {
  4801. fragment = cacheresults;
  4802. }
  4803. }
  4804. if ( !fragment ) {
  4805. fragment = doc.createDocumentFragment();
  4806. jQuery.clean( args, doc, fragment, scripts );
  4807. }
  4808. if ( cacheable ) {
  4809. jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
  4810. }
  4811. return { fragment: fragment, cacheable: cacheable };
  4812. };
  4813. jQuery.fragments = {};
  4814. jQuery.each({
  4815. appendTo: "append",
  4816. prependTo: "prepend",
  4817. insertBefore: "before",
  4818. insertAfter: "after",
  4819. replaceAll: "replaceWith"
  4820. }, function( name, original ) {
  4821. jQuery.fn[ name ] = function( selector ) {
  4822. var ret = [],
  4823. insert = jQuery( selector ),
  4824. parent = this.length === 1 && this[0].parentNode;
  4825. if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
  4826. insert[ original ]( this[0] );
  4827. return this;
  4828. } else {
  4829. for ( var i = 0, l = insert.length; i < l; i++ ) {
  4830. var elems = (i > 0 ? this.clone(true) : this).get();
  4831. jQuery( insert[i] )[ original ]( elems );
  4832. ret = ret.concat( elems );
  4833. }
  4834. return this.pushStack( ret, name, insert.selector );
  4835. }
  4836. };
  4837. });
  4838. function getAll( elem ) {
  4839. if ( "getElementsByTagName" in elem ) {
  4840. return elem.getElementsByTagName( "*" );
  4841. } else if ( "querySelectorAll" in elem ) {
  4842. return elem.querySelectorAll( "*" );
  4843. } else {
  4844. return [];
  4845. }
  4846. }
  4847. // Used in clean, fixes the defaultChecked property
  4848. function fixDefaultChecked( elem ) {
  4849. if ( elem.type === "checkbox" || elem.type === "radio" ) {
  4850. elem.defaultChecked = elem.checked;
  4851. }
  4852. }
  4853. // Finds all inputs and passes them to fixDefaultChecked
  4854. function findInputs( elem ) {
  4855. if ( jQuery.nodeName( elem, "input" ) ) {
  4856. fixDefaultChecked( elem );
  4857. } else if ( elem.getElementsByTagName ) {
  4858. jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
  4859. }
  4860. }
  4861. jQuery.extend({
  4862. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4863. var clone = elem.cloneNode(true),
  4864. srcElements,
  4865. destElements,
  4866. i;
  4867. if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
  4868. (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
  4869. // IE copies events bound via attachEvent when using cloneNode.
  4870. // Calling detachEvent on the clone will also remove the events
  4871. // from the original. In order to get around this, we use some
  4872. // proprietary methods to clear the events. Thanks to MooTools
  4873. // guys for this hotness.
  4874. cloneFixAttributes( elem, clone );
  4875. // Using Sizzle here is crazy slow, so we use getElementsByTagName
  4876. // instead
  4877. srcElements = getAll( elem );
  4878. destElements = getAll( clone );
  4879. // Weird iteration because IE will replace the length property
  4880. // with an element if you are cloning the body and one of the
  4881. // elements on the page has a name or id of "length"
  4882. for ( i = 0; srcElements[i]; ++i ) {
  4883. cloneFixAttributes( srcElements[i], destElements[i] );
  4884. }
  4885. }
  4886. // Copy the events from the original to the clone
  4887. if ( dataAndEvents ) {
  4888. cloneCopyEvent( elem, clone );
  4889. if ( deepDataAndEvents ) {
  4890. srcElements = getAll( elem );
  4891. destElements = getAll( clone );
  4892. for ( i = 0; srcElements[i]; ++i ) {
  4893. cloneCopyEvent( srcElements[i], destElements[i] );
  4894. }
  4895. }
  4896. }
  4897. // Return the cloned set
  4898. return clone;
  4899. },
  4900. clean: function( elems, context, fragment, scripts ) {
  4901. var checkScriptType;
  4902. context = context || document;
  4903. // !context.createElement fails in IE with an error but returns typeof 'object'
  4904. if ( typeof context.createElement === "undefined" ) {
  4905. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  4906. }
  4907. var ret = [], j;
  4908. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  4909. if ( typeof elem === "number" ) {
  4910. elem += "";
  4911. }
  4912. if ( !elem ) {
  4913. continue;
  4914. }
  4915. // Convert html string into DOM nodes
  4916. if ( typeof elem === "string" ) {
  4917. if ( !rhtml.test( elem ) ) {
  4918. elem = context.createTextNode( elem );
  4919. } else {
  4920. // Fix "XHTML"-style tags in all browsers
  4921. elem = elem.replace(rxhtmlTag, "<$1></$2>");
  4922. // Trim whitespace, otherwise indexOf won't work as expected
  4923. var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
  4924. wrap = wrapMap[ tag ] || wrapMap._default,
  4925. depth = wrap[0],
  4926. div = context.createElement("div");
  4927. // Go to html and back, then peel off extra wrappers
  4928. div.innerHTML = wrap[1] + elem + wrap[2];
  4929. // Move to the right depth
  4930. while ( depth-- ) {
  4931. div = div.lastChild;
  4932. }
  4933. // Remove IE's autoinserted <tbody> from table fragments
  4934. if ( !jQuery.support.tbody ) {
  4935. // String was a <table>, *may* have spurious <tbody>
  4936. var hasBody = rtbody.test(elem),
  4937. tbody = tag === "table" && !hasBody ?
  4938. div.firstChild && div.firstChild.childNodes :
  4939. // String was a bare <thead> or <tfoot>
  4940. wrap[1] === "<table>" && !hasBody ?
  4941. div.childNodes :
  4942. [];
  4943. for ( j = tbody.length - 1; j >= 0 ; --j ) {
  4944. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
  4945. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  4946. }
  4947. }
  4948. }
  4949. // IE completely kills leading whitespace when innerHTML is used
  4950. if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  4951. div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
  4952. }
  4953. elem = div.childNodes;
  4954. }
  4955. }
  4956. // Resets defaultChecked for any radios and checkboxes
  4957. // about to be appended to the DOM in IE 6/7 (#8060)
  4958. var len;
  4959. if ( !jQuery.support.appendChecked ) {
  4960. if ( elem[0] && typeof (len = elem.length) === "number" ) {
  4961. for ( j = 0; j < len; j++ ) {
  4962. findInputs( elem[j] );
  4963. }
  4964. } else {
  4965. findInputs( elem );
  4966. }
  4967. }
  4968. if ( elem.nodeType ) {
  4969. ret.push( elem );
  4970. } else {
  4971. ret = jQuery.merge( ret, elem );
  4972. }
  4973. }
  4974. if ( fragment ) {
  4975. checkScriptType = function( elem ) {
  4976. return !elem.type || rscriptType.test( elem.type );
  4977. };
  4978. for ( i = 0; ret[i]; i++ ) {
  4979. if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  4980. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  4981. } else {
  4982. if ( ret[i].nodeType === 1 ) {
  4983. var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
  4984. ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
  4985. }
  4986. fragment.appendChild( ret[i] );
  4987. }
  4988. }
  4989. }
  4990. return ret;
  4991. },
  4992. cleanData: function( elems ) {
  4993. var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
  4994. deleteExpando = jQuery.support.deleteExpando;
  4995. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  4996. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  4997. continue;
  4998. }
  4999. id = elem[ jQuery.expando ];
  5000. if ( id ) {
  5001. data = cache[ id ] && cache[ id ][ internalKey ];
  5002. if ( data && data.events ) {
  5003. for ( var type in data.events ) {
  5004. if ( special[ type ] ) {
  5005. jQuery.event.remove( elem, type );
  5006. // This is a shortcut to avoid jQuery.event.remove's overhead
  5007. } else {
  5008. jQuery.removeEvent( elem, type, data.handle );
  5009. }
  5010. }
  5011. // Null the DOM reference to avoid IE6/7/8 leak (#7054)
  5012. if ( data.handle ) {
  5013. data.handle.elem = null;
  5014. }
  5015. }
  5016. if ( deleteExpando ) {
  5017. delete elem[ jQuery.expando ];
  5018. } else if ( elem.removeAttribute ) {
  5019. elem.removeAttribute( jQuery.expando );
  5020. }
  5021. delete cache[ id ];
  5022. }
  5023. }
  5024. }
  5025. });
  5026. function evalScript( i, elem ) {
  5027. if ( elem.src ) {
  5028. jQuery.ajax({
  5029. url: elem.src,
  5030. async: false,
  5031. dataType: "script"
  5032. });
  5033. } else {
  5034. jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
  5035. }
  5036. if ( elem.parentNode ) {
  5037. elem.parentNode.removeChild( elem );
  5038. }
  5039. }
  5040. var ralpha = /alpha\([^)]*\)/i,
  5041. ropacity = /opacity=([^)]*)/,
  5042. rdashAlpha = /-([a-z])/ig,
  5043. // fixed for IE9, see #8346
  5044. rupper = /([A-Z]|^ms)/g,
  5045. rnumpx = /^-?\d+(?:px)?$/i,
  5046. rnum = /^-?\d/,
  5047. rrelNum = /^[+\-]=/,
  5048. rrelNumFilter = /[^+\-\.\de]+/g,
  5049. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5050. cssWidth = [ "Left", "Right" ],
  5051. cssHeight = [ "Top", "Bottom" ],
  5052. curCSS,
  5053. getComputedStyle,
  5054. currentStyle,
  5055. fcamelCase = function( all, letter ) {
  5056. return letter.toUpperCase();
  5057. };
  5058. jQuery.fn.css = function( name, value ) {
  5059. // Setting 'undefined' is a no-op
  5060. if ( arguments.length === 2 && value === undefined ) {
  5061. return this;
  5062. }
  5063. return jQuery.access( this, name, value, true, function( elem, name, value ) {
  5064. return value !== undefined ?
  5065. jQuery.style( elem, name, value ) :
  5066. jQuery.css( elem, name );
  5067. });
  5068. };
  5069. jQuery.extend({
  5070. // Add in style property hooks for overriding the default
  5071. // behavior of getting and setting a style property
  5072. cssHooks: {
  5073. opacity: {
  5074. get: function( elem, computed ) {
  5075. if ( computed ) {
  5076. // We should always get a number back from opacity
  5077. var ret = curCSS( elem, "opacity", "opacity" );
  5078. return ret === "" ? "1" : ret;
  5079. } else {
  5080. return elem.style.opacity;
  5081. }
  5082. }
  5083. }
  5084. },
  5085. // Exclude the following css properties to add px
  5086. cssNumber: {
  5087. "zIndex": true,
  5088. "fontWeight": true,
  5089. "opacity": true,
  5090. "zoom": true,
  5091. "lineHeight": true,
  5092. "widows": true,
  5093. "orphans": true
  5094. },
  5095. // Add in properties whose names you wish to fix before
  5096. // setting or getting the value
  5097. cssProps: {
  5098. // normalize float css property
  5099. "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
  5100. },
  5101. // Get and set the style property on a DOM Node
  5102. style: function( elem, name, value, extra ) {
  5103. // Don't set styles on text and comment nodes
  5104. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5105. return;
  5106. }
  5107. // Make sure that we're working with the right name
  5108. var ret, type, origName = jQuery.camelCase( name ),
  5109. style = elem.style, hooks = jQuery.cssHooks[ origName ];
  5110. name = jQuery.cssProps[ origName ] || origName;
  5111. // Check if we're setting a value
  5112. if ( value !== undefined ) {
  5113. type = typeof value;
  5114. // Make sure that NaN and null values aren't set. See: #7116
  5115. if ( type === "number" && isNaN( value ) || value == null ) {
  5116. return;
  5117. }
  5118. // convert relative number strings (+= or -=) to relative numbers. #7345
  5119. if ( type === "string" && rrelNum.test( value ) ) {
  5120. value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
  5121. }
  5122. // If a number was passed in, add 'px' to the (except for certain CSS properties)
  5123. if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
  5124. value += "px";
  5125. }
  5126. // If a hook was provided, use that value, otherwise just set the specified value
  5127. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
  5128. // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
  5129. // Fixes bug #5509
  5130. try {
  5131. style[ name ] = value;
  5132. } catch(e) {}
  5133. }
  5134. } else {
  5135. // If a hook was provided get the non-computed value from there
  5136. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  5137. return ret;
  5138. }
  5139. // Otherwise just get the value from the style object
  5140. return style[ name ];
  5141. }
  5142. },
  5143. css: function( elem, name, extra ) {
  5144. var ret, hooks;
  5145. // Make sure that we're working with the right name
  5146. name = jQuery.camelCase( name );
  5147. hooks = jQuery.cssHooks[ name ];
  5148. name = jQuery.cssProps[ name ] || name;
  5149. // cssFloat needs a special treatment
  5150. if ( name === "cssFloat" ) {
  5151. name = "float";
  5152. }
  5153. // If a hook was provided get the computed value from there
  5154. if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
  5155. return ret;
  5156. // Otherwise, if a way to get the computed value exists, use that
  5157. } else if ( curCSS ) {
  5158. return curCSS( elem, name );
  5159. }
  5160. },
  5161. // A method for quickly swapping in/out CSS properties to get correct calculations
  5162. swap: function( elem, options, callback ) {
  5163. var old = {};
  5164. // Remember the old values, and insert the new ones
  5165. for ( var name in options ) {
  5166. old[ name ] = elem.style[ name ];
  5167. elem.style[ name ] = options[ name ];
  5168. }
  5169. callback.call( elem );
  5170. // Revert the old values
  5171. for ( name in options ) {
  5172. elem.style[ name ] = old[ name ];
  5173. }
  5174. },
  5175. camelCase: function( string ) {
  5176. return string.replace( rdashAlpha, fcamelCase );
  5177. }
  5178. });
  5179. // DEPRECATED, Use jQuery.css() instead
  5180. jQuery.curCSS = jQuery.css;
  5181. jQuery.each(["height", "width"], function( i, name ) {
  5182. jQuery.cssHooks[ name ] = {
  5183. get: function( elem, computed, extra ) {
  5184. var val;
  5185. if ( computed ) {
  5186. if ( elem.offsetWidth !== 0 ) {
  5187. val = getWH( elem, name, extra );
  5188. } else {
  5189. jQuery.swap( elem, cssShow, function() {
  5190. val = getWH( elem, name, extra );
  5191. });
  5192. }
  5193. if ( val <= 0 ) {
  5194. val = curCSS( elem, name, name );
  5195. if ( val === "0px" && currentStyle ) {
  5196. val = currentStyle( elem, name, name );
  5197. }
  5198. if ( val != null ) {
  5199. // Should return "auto" instead of 0, use 0 for
  5200. // temporary backwards-compat
  5201. return val === "" || val === "auto" ? "0px" : val;
  5202. }
  5203. }
  5204. if ( val < 0 || val == null ) {
  5205. val = elem.style[ name ];
  5206. // Should return "auto" instead of 0, use 0 for
  5207. // temporary backwards-compat
  5208. return val === "" || val === "auto" ? "0px" : val;
  5209. }
  5210. return typeof val === "string" ? val : val + "px";
  5211. }
  5212. },
  5213. set: function( elem, value ) {
  5214. if ( rnumpx.test( value ) ) {
  5215. // ignore negative width and height values #1599
  5216. value = parseFloat(value);
  5217. if ( value >= 0 ) {
  5218. return value + "px";
  5219. }
  5220. } else {
  5221. return value;
  5222. }
  5223. }
  5224. };
  5225. });
  5226. if ( !jQuery.support.opacity ) {
  5227. jQuery.cssHooks.opacity = {
  5228. get: function( elem, computed ) {
  5229. // IE uses filters for opacity
  5230. return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
  5231. ( parseFloat( RegExp.$1 ) / 100 ) + "" :
  5232. computed ? "1" : "";
  5233. },
  5234. set: function( elem, value ) {
  5235. var style = elem.style,
  5236. currentStyle = elem.currentStyle;
  5237. // IE has trouble with opacity if it does not have layout
  5238. // Force it by setting the zoom level
  5239. style.zoom = 1;
  5240. // Set the alpha filter to set the opacity
  5241. var opacity = jQuery.isNaN( value ) ?
  5242. "" :
  5243. "alpha(opacity=" + value * 100 + ")",
  5244. filter = currentStyle && currentStyle.filter || style.filter || "";
  5245. style.filter = ralpha.test( filter ) ?
  5246. filter.replace( ralpha, opacity ) :
  5247. filter + " " + opacity;
  5248. }
  5249. };
  5250. }
  5251. jQuery(function() {
  5252. // This hook cannot be added until DOM ready because the support test
  5253. // for it is not run until after DOM ready
  5254. if ( !jQuery.support.reliableMarginRight ) {
  5255. jQuery.cssHooks.marginRight = {
  5256. get: function( elem, computed ) {
  5257. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  5258. // Work around by temporarily setting element display to inline-block
  5259. var ret;
  5260. jQuery.swap( elem, { "display": "inline-block" }, function() {
  5261. if ( computed ) {
  5262. ret = curCSS( elem, "margin-right", "marginRight" );
  5263. } else {
  5264. ret = elem.style.marginRight;
  5265. }
  5266. });
  5267. return ret;
  5268. }
  5269. };
  5270. }
  5271. });
  5272. if ( document.defaultView && document.defaultView.getComputedStyle ) {
  5273. getComputedStyle = function( elem, name ) {
  5274. var ret, defaultView, computedStyle;
  5275. name = name.replace( rupper, "-$1" ).toLowerCase();
  5276. if ( !(defaultView = elem.ownerDocument.defaultView) ) {
  5277. return undefined;
  5278. }
  5279. if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
  5280. ret = computedStyle.getPropertyValue( name );
  5281. if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
  5282. ret = jQuery.style( elem, name );
  5283. }
  5284. }
  5285. return ret;
  5286. };
  5287. }
  5288. if ( document.documentElement.currentStyle ) {
  5289. currentStyle = function( elem, name ) {
  5290. var left,
  5291. ret = elem.currentStyle && elem.currentStyle[ name ],
  5292. rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
  5293. style = elem.style;
  5294. // From the awesome hack by Dean Edwards
  5295. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  5296. // If we're not dealing with a regular pixel number
  5297. // but a number that has a weird ending, we need to convert it to pixels
  5298. if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
  5299. // Remember the original values
  5300. left = style.left;
  5301. // Put in the new values to get a computed value out
  5302. if ( rsLeft ) {
  5303. elem.runtimeStyle.left = elem.currentStyle.left;
  5304. }
  5305. style.left = name === "fontSize" ? "1em" : (ret || 0);
  5306. ret = style.pixelLeft + "px";
  5307. // Revert the changed values
  5308. style.left = left;
  5309. if ( rsLeft ) {
  5310. elem.runtimeStyle.left = rsLeft;
  5311. }
  5312. }
  5313. return ret === "" ? "auto" : ret;
  5314. };
  5315. }
  5316. curCSS = getComputedStyle || currentStyle;
  5317. function getWH( elem, name, extra ) {
  5318. var which = name === "width" ? cssWidth : cssHeight,
  5319. val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
  5320. if ( extra === "border" ) {
  5321. return val;
  5322. }
  5323. jQuery.each( which, function() {
  5324. if ( !extra ) {
  5325. val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
  5326. }
  5327. if ( extra === "margin" ) {
  5328. val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
  5329. } else {
  5330. val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
  5331. }
  5332. });
  5333. return val;
  5334. }
  5335. if ( jQuery.expr && jQuery.expr.filters ) {
  5336. jQuery.expr.filters.hidden = function( elem ) {
  5337. var width = elem.offsetWidth,
  5338. height = elem.offsetHeight;
  5339. return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
  5340. };
  5341. jQuery.expr.filters.visible = function( elem ) {
  5342. return !jQuery.expr.filters.hidden( elem );
  5343. };
  5344. }
  5345. var r20 = /%20/g,
  5346. rbracket = /\[\]$/,
  5347. rCRLF = /\r?\n/g,
  5348. rhash = /#.*$/,
  5349. rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
  5350. rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
  5351. // #7653, #8125, #8152: local protocol detection
  5352. rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
  5353. rnoContent = /^(?:GET|HEAD)$/,
  5354. rprotocol = /^\/\//,
  5355. rquery = /\?/,
  5356. rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  5357. rselectTextarea = /^(?:select|textarea)/i,
  5358. rspacesAjax = /\s+/,
  5359. rts = /([?&])_=[^&]*/,
  5360. rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
  5361. // Keep a copy of the old load method
  5362. _load = jQuery.fn.load,
  5363. /* Prefilters
  5364. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  5365. * 2) These are called:
  5366. * - BEFORE asking for a transport
  5367. * - AFTER param serialization (s.data is a string if s.processData is true)
  5368. * 3) key is the dataType
  5369. * 4) the catchall symbol "*" can be used
  5370. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  5371. */
  5372. prefilters = {},
  5373. /* Transports bindings
  5374. * 1) key is the dataType
  5375. * 2) the catchall symbol "*" can be used
  5376. * 3) selection will start with transport dataType and THEN go to "*" if needed
  5377. */
  5378. transports = {},
  5379. // Document location
  5380. ajaxLocation,
  5381. // Document location segments
  5382. ajaxLocParts;
  5383. // #8138, IE may throw an exception when accessing
  5384. // a field from window.location if document.domain has been set
  5385. try {
  5386. ajaxLocation = location.href;
  5387. } catch( e ) {
  5388. // Use the href attribute of an A element
  5389. // since IE will modify it given document.location
  5390. ajaxLocation = document.createElement( "a" );
  5391. ajaxLocation.href = "";
  5392. ajaxLocation = ajaxLocation.href;
  5393. }
  5394. // Segment location into parts
  5395. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  5396. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  5397. function addToPrefiltersOrTransports( structure ) {
  5398. // dataTypeExpression is optional and defaults to "*"
  5399. return function( dataTypeExpression, func ) {
  5400. if ( typeof dataTypeExpression !== "string" ) {
  5401. func = dataTypeExpression;
  5402. dataTypeExpression = "*";
  5403. }
  5404. if ( jQuery.isFunction( func ) ) {
  5405. var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
  5406. i = 0,
  5407. length = dataTypes.length,
  5408. dataType,
  5409. list,
  5410. placeBefore;
  5411. // For each dataType in the dataTypeExpression
  5412. for(; i < length; i++ ) {
  5413. dataType = dataTypes[ i ];
  5414. // We control if we're asked to add before
  5415. // any existing element
  5416. placeBefore = /^\+/.test( dataType );
  5417. if ( placeBefore ) {
  5418. dataType = dataType.substr( 1 ) || "*";
  5419. }
  5420. list = structure[ dataType ] = structure[ dataType ] || [];
  5421. // then we add to the structure accordingly
  5422. list[ placeBefore ? "unshift" : "push" ]( func );
  5423. }
  5424. }
  5425. };
  5426. }
  5427. // Base inspection function for prefilters and transports
  5428. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
  5429. dataType /* internal */, inspected /* internal */ ) {
  5430. dataType = dataType || options.dataTypes[ 0 ];
  5431. inspected = inspected || {};
  5432. inspected[ dataType ] = true;
  5433. var list = structure[ dataType ],
  5434. i = 0,
  5435. length = list ? list.length : 0,
  5436. executeOnly = ( structure === prefilters ),
  5437. selection;
  5438. for(; i < length && ( executeOnly || !selection ); i++ ) {
  5439. selection = list[ i ]( options, originalOptions, jqXHR );
  5440. // If we got redirected to another dataType
  5441. // we try there if executing only and not done already
  5442. if ( typeof selection === "string" ) {
  5443. if ( !executeOnly || inspected[ selection ] ) {
  5444. selection = undefined;
  5445. } else {
  5446. options.dataTypes.unshift( selection );
  5447. selection = inspectPrefiltersOrTransports(
  5448. structure, options, originalOptions, jqXHR, selection, inspected );
  5449. }
  5450. }
  5451. }
  5452. // If we're only executing or nothing was selected
  5453. // we try the catchall dataType if not done already
  5454. if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
  5455. selection = inspectPrefiltersOrTransports(
  5456. structure, options, originalOptions, jqXHR, "*", inspected );
  5457. }
  5458. // unnecessary when only executing (prefilters)
  5459. // but it'll be ignored by the caller in that case
  5460. return selection;
  5461. }
  5462. jQuery.fn.extend({
  5463. load: function( url, params, callback ) {
  5464. if ( typeof url !== "string" && _load ) {
  5465. return _load.apply( this, arguments );
  5466. // Don't do a request if no elements are being requested
  5467. } else if ( !this.length ) {
  5468. return this;
  5469. }
  5470. var off = url.indexOf( " " );
  5471. if ( off >= 0 ) {
  5472. var selector = url.slice( off, url.length );
  5473. url = url.slice( 0, off );
  5474. }
  5475. // Default to a GET request
  5476. var type = "GET";
  5477. // If the second parameter was provided
  5478. if ( params ) {
  5479. // If it's a function
  5480. if ( jQuery.isFunction( params ) ) {
  5481. // We assume that it's the callback
  5482. callback = params;
  5483. params = undefined;
  5484. // Otherwise, build a param string
  5485. } else if ( typeof params === "object" ) {
  5486. params = jQuery.param( params, jQuery.ajaxSettings.traditional );
  5487. type = "POST";
  5488. }
  5489. }
  5490. var self = this;
  5491. // Request the remote document
  5492. jQuery.ajax({
  5493. url: url,
  5494. type: type,
  5495. dataType: "html",
  5496. data: params,
  5497. // Complete callback (responseText is used internally)
  5498. complete: function( jqXHR, status, responseText ) {
  5499. // Store the response as specified by the jqXHR object
  5500. responseText = jqXHR.responseText;
  5501. // If successful, inject the HTML into all the matched elements
  5502. if ( jqXHR.isResolved() ) {
  5503. // #4825: Get the actual response in case
  5504. // a dataFilter is present in ajaxSettings
  5505. jqXHR.done(function( r ) {
  5506. responseText = r;
  5507. });
  5508. // See if a selector was specified
  5509. self.html( selector ?
  5510. // Create a dummy div to hold the results
  5511. jQuery("<div>")
  5512. // inject the contents of the document in, removing the scripts
  5513. // to avoid any 'Permission Denied' errors in IE
  5514. .append(responseText.replace(rscript, ""))
  5515. // Locate the specified elements
  5516. .find(selector) :
  5517. // If not, just inject the full result
  5518. responseText );
  5519. }
  5520. if ( callback ) {
  5521. self.each( callback, [ responseText, status, jqXHR ] );
  5522. }
  5523. }
  5524. });
  5525. return this;
  5526. },
  5527. serialize: function() {
  5528. return jQuery.param( this.serializeArray() );
  5529. },
  5530. serializeArray: function() {
  5531. return this.map(function(){
  5532. return this.elements ? jQuery.makeArray( this.elements ) : this;
  5533. })
  5534. .filter(function(){
  5535. return this.name && !this.disabled &&
  5536. ( this.checked || rselectTextarea.test( this.nodeName ) ||
  5537. rinput.test( this.type ) );
  5538. })
  5539. .map(function( i, elem ){
  5540. var val = jQuery( this ).val();
  5541. return val == null ?
  5542. null :
  5543. jQuery.isArray( val ) ?
  5544. jQuery.map( val, function( val, i ){
  5545. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  5546. }) :
  5547. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  5548. }).get();
  5549. }
  5550. });
  5551. // Attach a bunch of functions for handling common AJAX events
  5552. jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
  5553. jQuery.fn[ o ] = function( f ){
  5554. return this.bind( o, f );
  5555. };
  5556. });
  5557. jQuery.each( [ "get", "post" ], function( i, method ) {
  5558. jQuery[ method ] = function( url, data, callback, type ) {
  5559. // shift arguments if data argument was omitted
  5560. if ( jQuery.isFunction( data ) ) {
  5561. type = type || callback;
  5562. callback = data;
  5563. data = undefined;
  5564. }
  5565. return jQuery.ajax({
  5566. type: method,
  5567. url: url,
  5568. data: data,
  5569. success: callback,
  5570. dataType: type
  5571. });
  5572. };
  5573. });
  5574. jQuery.extend({
  5575. getScript: function( url, callback ) {
  5576. return jQuery.get( url, undefined, callback, "script" );
  5577. },
  5578. getJSON: function( url, data, callback ) {
  5579. return jQuery.get( url, data, callback, "json" );
  5580. },
  5581. // Creates a full fledged settings object into target
  5582. // with both ajaxSettings and settings fields.
  5583. // If target is omitted, writes into ajaxSettings.
  5584. ajaxSetup: function ( target, settings ) {
  5585. if ( !settings ) {
  5586. // Only one parameter, we extend ajaxSettings
  5587. settings = target;
  5588. target = jQuery.extend( true, jQuery.ajaxSettings, settings );
  5589. } else {
  5590. // target was provided, we extend into it
  5591. jQuery.extend( true, target, jQuery.ajaxSettings, settings );
  5592. }
  5593. // Flatten fields we don't want deep extended
  5594. for( var field in { context: 1, url: 1 } ) {
  5595. if ( field in settings ) {
  5596. target[ field ] = settings[ field ];
  5597. } else if( field in jQuery.ajaxSettings ) {
  5598. target[ field ] = jQuery.ajaxSettings[ field ];
  5599. }
  5600. }
  5601. return target;
  5602. },
  5603. ajaxSettings: {
  5604. url: ajaxLocation,
  5605. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  5606. global: true,
  5607. type: "GET",
  5608. contentType: "application/x-www-form-urlencoded",
  5609. processData: true,
  5610. async: true,
  5611. /*
  5612. timeout: 0,
  5613. data: null,
  5614. dataType: null,
  5615. username: null,
  5616. password: null,
  5617. cache: null,
  5618. traditional: false,
  5619. headers: {},
  5620. */
  5621. accepts: {
  5622. xml: "application/xml, text/xml",
  5623. html: "text/html",
  5624. text: "text/plain",
  5625. json: "application/json, text/javascript",
  5626. "*": "*/*"
  5627. },
  5628. contents: {
  5629. xml: /xml/,
  5630. html: /html/,
  5631. json: /json/
  5632. },
  5633. responseFields: {
  5634. xml: "responseXML",
  5635. text: "responseText"
  5636. },
  5637. // List of data converters
  5638. // 1) key format is "source_type destination_type" (a single space in-between)
  5639. // 2) the catchall symbol "*" can be used for source_type
  5640. converters: {
  5641. // Convert anything to text
  5642. "* text": window.String,
  5643. // Text to html (true = no transformation)
  5644. "text html": true,
  5645. // Evaluate text as a json expression
  5646. "text json": jQuery.parseJSON,
  5647. // Parse text as xml
  5648. "text xml": jQuery.parseXML
  5649. }
  5650. },
  5651. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  5652. ajaxTransport: addToPrefiltersOrTransports( transports ),
  5653. // Main method
  5654. ajax: function( url, options ) {
  5655. // If url is an object, simulate pre-1.5 signature
  5656. if ( typeof url === "object" ) {
  5657. options = url;
  5658. url = undefined;
  5659. }
  5660. // Force options to be an object
  5661. options = options || {};
  5662. var // Create the final options object
  5663. s = jQuery.ajaxSetup( {}, options ),
  5664. // Callbacks context
  5665. callbackContext = s.context || s,
  5666. // Context for global events
  5667. // It's the callbackContext if one was provided in the options
  5668. // and if it's a DOM node or a jQuery collection
  5669. globalEventContext = callbackContext !== s &&
  5670. ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
  5671. jQuery( callbackContext ) : jQuery.event,
  5672. // Deferreds
  5673. deferred = jQuery.Deferred(),
  5674. completeDeferred = jQuery._Deferred(),
  5675. // Status-dependent callbacks
  5676. statusCode = s.statusCode || {},
  5677. // ifModified key
  5678. ifModifiedKey,
  5679. // Headers (they are sent all at once)
  5680. requestHeaders = {},
  5681. requestHeadersNames = {},
  5682. // Response headers
  5683. responseHeadersString,
  5684. responseHeaders,
  5685. // transport
  5686. transport,
  5687. // timeout handle
  5688. timeoutTimer,
  5689. // Cross-domain detection vars
  5690. parts,
  5691. // The jqXHR state
  5692. state = 0,
  5693. // To know if global events are to be dispatched
  5694. fireGlobals,
  5695. // Loop variable
  5696. i,
  5697. // Fake xhr
  5698. jqXHR = {
  5699. readyState: 0,
  5700. // Caches the header
  5701. setRequestHeader: function( name, value ) {
  5702. if ( !state ) {
  5703. var lname = name.toLowerCase();
  5704. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  5705. requestHeaders[ name ] = value;
  5706. }
  5707. return this;
  5708. },
  5709. // Raw string
  5710. getAllResponseHeaders: function() {
  5711. return state === 2 ? responseHeadersString : null;
  5712. },
  5713. // Builds headers hashtable if needed
  5714. getResponseHeader: function( key ) {
  5715. var match;
  5716. if ( state === 2 ) {
  5717. if ( !responseHeaders ) {
  5718. responseHeaders = {};
  5719. while( ( match = rheaders.exec( responseHeadersString ) ) ) {
  5720. responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
  5721. }
  5722. }
  5723. match = responseHeaders[ key.toLowerCase() ];
  5724. }
  5725. return match === undefined ? null : match;
  5726. },
  5727. // Overrides response content-type header
  5728. overrideMimeType: function( type ) {
  5729. if ( !state ) {
  5730. s.mimeType = type;
  5731. }
  5732. return this;
  5733. },
  5734. // Cancel the request
  5735. abort: function( statusText ) {
  5736. statusText = statusText || "abort";
  5737. if ( transport ) {
  5738. transport.abort( statusText );
  5739. }
  5740. done( 0, statusText );
  5741. return this;
  5742. }
  5743. };
  5744. // Callback for when everything is done
  5745. // It is defined here because jslint complains if it is declared
  5746. // at the end of the function (which would be more logical and readable)
  5747. function done( status, statusText, responses, headers ) {
  5748. // Called once
  5749. if ( state === 2 ) {
  5750. return;
  5751. }
  5752. // State is "done" now
  5753. state = 2;
  5754. // Clear timeout if it exists
  5755. if ( timeoutTimer ) {
  5756. clearTimeout( timeoutTimer );
  5757. }
  5758. // Dereference transport for early garbage collection
  5759. // (no matter how long the jqXHR object will be used)
  5760. transport = undefined;
  5761. // Cache response headers
  5762. responseHeadersString = headers || "";
  5763. // Set readyState
  5764. jqXHR.readyState = status ? 4 : 0;
  5765. var isSuccess,
  5766. success,
  5767. error,
  5768. response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
  5769. lastModified,
  5770. etag;
  5771. // If successful, handle type chaining
  5772. if ( status >= 200 && status < 300 || status === 304 ) {
  5773. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  5774. if ( s.ifModified ) {
  5775. if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
  5776. jQuery.lastModified[ ifModifiedKey ] = lastModified;
  5777. }
  5778. if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
  5779. jQuery.etag[ ifModifiedKey ] = etag;
  5780. }
  5781. }
  5782. // If not modified
  5783. if ( status === 304 ) {
  5784. statusText = "notmodified";
  5785. isSuccess = true;
  5786. // If we have data
  5787. } else {
  5788. try {
  5789. success = ajaxConvert( s, response );
  5790. statusText = "success";
  5791. isSuccess = true;
  5792. } catch(e) {
  5793. // We have a parsererror
  5794. statusText = "parsererror";
  5795. error = e;
  5796. }
  5797. }
  5798. } else {
  5799. // We extract error from statusText
  5800. // then normalize statusText and status for non-aborts
  5801. error = statusText;
  5802. if( !statusText || status ) {
  5803. statusText = "error";
  5804. if ( status < 0 ) {
  5805. status = 0;
  5806. }
  5807. }
  5808. }
  5809. // Set data for the fake xhr object
  5810. jqXHR.status = status;
  5811. jqXHR.statusText = statusText;
  5812. // Success/Error
  5813. if ( isSuccess ) {
  5814. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  5815. } else {
  5816. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  5817. }
  5818. // Status-dependent callbacks
  5819. jqXHR.statusCode( statusCode );
  5820. statusCode = undefined;
  5821. if ( fireGlobals ) {
  5822. globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
  5823. [ jqXHR, s, isSuccess ? success : error ] );
  5824. }
  5825. // Complete
  5826. completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
  5827. if ( fireGlobals ) {
  5828. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
  5829. // Handle the global AJAX counter
  5830. if ( !( --jQuery.active ) ) {
  5831. jQuery.event.trigger( "ajaxStop" );
  5832. }
  5833. }
  5834. }
  5835. // Attach deferreds
  5836. deferred.promise( jqXHR );
  5837. jqXHR.success = jqXHR.done;
  5838. jqXHR.error = jqXHR.fail;
  5839. jqXHR.complete = completeDeferred.done;
  5840. // Status-dependent callbacks
  5841. jqXHR.statusCode = function( map ) {
  5842. if ( map ) {
  5843. var tmp;
  5844. if ( state < 2 ) {
  5845. for( tmp in map ) {
  5846. statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
  5847. }
  5848. } else {
  5849. tmp = map[ jqXHR.status ];
  5850. jqXHR.then( tmp, tmp );
  5851. }
  5852. }
  5853. return this;
  5854. };
  5855. // Remove hash character (#7531: and string promotion)
  5856. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  5857. // We also use the url parameter if available
  5858. s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  5859. // Extract dataTypes list
  5860. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
  5861. // Determine if a cross-domain request is in order
  5862. if ( s.crossDomain == null ) {
  5863. parts = rurl.exec( s.url.toLowerCase() );
  5864. s.crossDomain = !!( parts &&
  5865. ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
  5866. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
  5867. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
  5868. );
  5869. }
  5870. // Convert data if not already a string
  5871. if ( s.data && s.processData && typeof s.data !== "string" ) {
  5872. s.data = jQuery.param( s.data, s.traditional );
  5873. }
  5874. // Apply prefilters
  5875. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  5876. // If request was aborted inside a prefiler, stop there
  5877. if ( state === 2 ) {
  5878. return false;
  5879. }
  5880. // We can fire global events as of now if asked to
  5881. fireGlobals = s.global;
  5882. // Uppercase the type
  5883. s.type = s.type.toUpperCase();
  5884. // Determine if request has content
  5885. s.hasContent = !rnoContent.test( s.type );
  5886. // Watch for a new set of requests
  5887. if ( fireGlobals && jQuery.active++ === 0 ) {
  5888. jQuery.event.trigger( "ajaxStart" );
  5889. }
  5890. // More options handling for requests with no content
  5891. if ( !s.hasContent ) {
  5892. // If data is available, append data to url
  5893. if ( s.data ) {
  5894. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
  5895. }
  5896. // Get ifModifiedKey before adding the anti-cache parameter
  5897. ifModifiedKey = s.url;
  5898. // Add anti-cache in url if needed
  5899. if ( s.cache === false ) {
  5900. var ts = jQuery.now(),
  5901. // try replacing _= if it is there
  5902. ret = s.url.replace( rts, "$1_=" + ts );
  5903. // if nothing was replaced, add timestamp to the end
  5904. s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
  5905. }
  5906. }
  5907. // Set the correct header, if data is being sent
  5908. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  5909. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  5910. }
  5911. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  5912. if ( s.ifModified ) {
  5913. ifModifiedKey = ifModifiedKey || s.url;
  5914. if ( jQuery.lastModified[ ifModifiedKey ] ) {
  5915. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
  5916. }
  5917. if ( jQuery.etag[ ifModifiedKey ] ) {
  5918. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
  5919. }
  5920. }
  5921. // Set the Accepts header for the server, depending on the dataType
  5922. jqXHR.setRequestHeader(
  5923. "Accept",
  5924. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
  5925. s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
  5926. s.accepts[ "*" ]
  5927. );
  5928. // Check for headers option
  5929. for ( i in s.headers ) {
  5930. jqXHR.setRequestHeader( i, s.headers[ i ] );
  5931. }
  5932. // Allow custom headers/mimetypes and early abort
  5933. if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  5934. // Abort if not done already
  5935. jqXHR.abort();
  5936. return false;
  5937. }
  5938. // Install callbacks on deferreds
  5939. for ( i in { success: 1, error: 1, complete: 1 } ) {
  5940. jqXHR[ i ]( s[ i ] );
  5941. }
  5942. // Get transport
  5943. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  5944. // If no transport, we auto-abort
  5945. if ( !transport ) {
  5946. done( -1, "No Transport" );
  5947. } else {
  5948. jqXHR.readyState = 1;
  5949. // Send global event
  5950. if ( fireGlobals ) {
  5951. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  5952. }
  5953. // Timeout
  5954. if ( s.async && s.timeout > 0 ) {
  5955. timeoutTimer = setTimeout( function(){
  5956. jqXHR.abort( "timeout" );
  5957. }, s.timeout );
  5958. }
  5959. try {
  5960. state = 1;
  5961. transport.send( requestHeaders, done );
  5962. } catch (e) {
  5963. // Propagate exception as error if not done
  5964. if ( status < 2 ) {
  5965. done( -1, e );
  5966. // Simply rethrow otherwise
  5967. } else {
  5968. jQuery.error( e );
  5969. }
  5970. }
  5971. }
  5972. return jqXHR;
  5973. },
  5974. // Serialize an array of form elements or a set of
  5975. // key/values into a query string
  5976. param: function( a, traditional ) {
  5977. var s = [],
  5978. add = function( key, value ) {
  5979. // If value is a function, invoke it and return its value
  5980. value = jQuery.isFunction( value ) ? value() : value;
  5981. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  5982. };
  5983. // Set traditional to true for jQuery <= 1.3.2 behavior.
  5984. if ( traditional === undefined ) {
  5985. traditional = jQuery.ajaxSettings.traditional;
  5986. }
  5987. // If an array was passed in, assume that it is an array of form elements.
  5988. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  5989. // Serialize the form elements
  5990. jQuery.each( a, function() {
  5991. add( this.name, this.value );
  5992. });
  5993. } else {
  5994. // If traditional, encode the "old" way (the way 1.3.2 or older
  5995. // did it), otherwise encode params recursively.
  5996. for ( var prefix in a ) {
  5997. buildParams( prefix, a[ prefix ], traditional, add );
  5998. }
  5999. }
  6000. // Return the resulting serialization
  6001. return s.join( "&" ).replace( r20, "+" );
  6002. }
  6003. });
  6004. function buildParams( prefix, obj, traditional, add ) {
  6005. if ( jQuery.isArray( obj ) ) {
  6006. // Serialize array item.
  6007. jQuery.each( obj, function( i, v ) {
  6008. if ( traditional || rbracket.test( prefix ) ) {
  6009. // Treat each array item as a scalar.
  6010. add( prefix, v );
  6011. } else {
  6012. // If array item is non-scalar (array or object), encode its
  6013. // numeric index to resolve deserialization ambiguity issues.
  6014. // Note that rack (as of 1.0.0) can't currently deserialize
  6015. // nested arrays properly, and attempting to do so may cause
  6016. // a server error. Possible fixes are to modify rack's
  6017. // deserialization algorithm or to provide an option or flag
  6018. // to force array serialization to be shallow.
  6019. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
  6020. }
  6021. });
  6022. } else if ( !traditional && obj != null && typeof obj === "object" ) {
  6023. // Serialize object item.
  6024. for ( var name in obj ) {
  6025. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6026. }
  6027. } else {
  6028. // Serialize scalar item.
  6029. add( prefix, obj );
  6030. }
  6031. }
  6032. // This is still on the jQuery object... for now
  6033. // Want to move this to jQuery.ajax some day
  6034. jQuery.extend({
  6035. // Counter for holding the number of active queries
  6036. active: 0,
  6037. // Last-Modified header cache for next request
  6038. lastModified: {},
  6039. etag: {}
  6040. });
  6041. /* Handles responses to an ajax request:
  6042. * - sets all responseXXX fields accordingly
  6043. * - finds the right dataType (mediates between content-type and expected dataType)
  6044. * - returns the corresponding response
  6045. */
  6046. function ajaxHandleResponses( s, jqXHR, responses ) {
  6047. var contents = s.contents,
  6048. dataTypes = s.dataTypes,
  6049. responseFields = s.responseFields,
  6050. ct,
  6051. type,
  6052. finalDataType,
  6053. firstDataType;
  6054. // Fill responseXXX fields
  6055. for( type in responseFields ) {
  6056. if ( type in responses ) {
  6057. jqXHR[ responseFields[type] ] = responses[ type ];
  6058. }
  6059. }
  6060. // Remove auto dataType and get content-type in the process
  6061. while( dataTypes[ 0 ] === "*" ) {
  6062. dataTypes.shift();
  6063. if ( ct === undefined ) {
  6064. ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
  6065. }
  6066. }
  6067. // Check if we're dealing with a known content-type
  6068. if ( ct ) {
  6069. for ( type in contents ) {
  6070. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  6071. dataTypes.unshift( type );
  6072. break;
  6073. }
  6074. }
  6075. }
  6076. // Check to see if we have a response for the expected dataType
  6077. if ( dataTypes[ 0 ] in responses ) {
  6078. finalDataType = dataTypes[ 0 ];
  6079. } else {
  6080. // Try convertible dataTypes
  6081. for ( type in responses ) {
  6082. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
  6083. finalDataType = type;
  6084. break;
  6085. }
  6086. if ( !firstDataType ) {
  6087. firstDataType = type;
  6088. }
  6089. }
  6090. // Or just use first one
  6091. finalDataType = finalDataType || firstDataType;
  6092. }
  6093. // If we found a dataType
  6094. // We add the dataType to the list if needed
  6095. // and return the corresponding response
  6096. if ( finalDataType ) {
  6097. if ( finalDataType !== dataTypes[ 0 ] ) {
  6098. dataTypes.unshift( finalDataType );
  6099. }
  6100. return responses[ finalDataType ];
  6101. }
  6102. }
  6103. // Chain conversions given the request and the original response
  6104. function ajaxConvert( s, response ) {
  6105. // Apply the dataFilter if provided
  6106. if ( s.dataFilter ) {
  6107. response = s.dataFilter( response, s.dataType );
  6108. }
  6109. var dataTypes = s.dataTypes,
  6110. converters = {},
  6111. i,
  6112. key,
  6113. length = dataTypes.length,
  6114. tmp,
  6115. // Current and previous dataTypes
  6116. current = dataTypes[ 0 ],
  6117. prev,
  6118. // Conversion expression
  6119. conversion,
  6120. // Conversion function
  6121. conv,
  6122. // Conversion functions (transitive conversion)
  6123. conv1,
  6124. conv2;
  6125. // For each dataType in the chain
  6126. for( i = 1; i < length; i++ ) {
  6127. // Create converters map
  6128. // with lowercased keys
  6129. if ( i === 1 ) {
  6130. for( key in s.converters ) {
  6131. if( typeof key === "string" ) {
  6132. converters[ key.toLowerCase() ] = s.converters[ key ];
  6133. }
  6134. }
  6135. }
  6136. // Get the dataTypes
  6137. prev = current;
  6138. current = dataTypes[ i ];
  6139. // If current is auto dataType, update it to prev
  6140. if( current === "*" ) {
  6141. current = prev;
  6142. // If no auto and dataTypes are actually different
  6143. } else if ( prev !== "*" && prev !== current ) {
  6144. // Get the converter
  6145. conversion = prev + " " + current;
  6146. conv = converters[ conversion ] || converters[ "* " + current ];
  6147. // If there is no direct converter, search transitively
  6148. if ( !conv ) {
  6149. conv2 = undefined;
  6150. for( conv1 in converters ) {
  6151. tmp = conv1.split( " " );
  6152. if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
  6153. conv2 = converters[ tmp[1] + " " + current ];
  6154. if ( conv2 ) {
  6155. conv1 = converters[ conv1 ];
  6156. if ( conv1 === true ) {
  6157. conv = conv2;
  6158. } else if ( conv2 === true ) {
  6159. conv = conv1;
  6160. }
  6161. break;
  6162. }
  6163. }
  6164. }
  6165. }
  6166. // If we found no converter, dispatch an error
  6167. if ( !( conv || conv2 ) ) {
  6168. jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
  6169. }
  6170. // If found converter is not an equivalence
  6171. if ( conv !== true ) {
  6172. // Convert with 1 or 2 converters accordingly
  6173. response = conv ? conv( response ) : conv2( conv1(response) );
  6174. }
  6175. }
  6176. }
  6177. return response;
  6178. }
  6179. var jsc = jQuery.now(),
  6180. jsre = /(\=)\?(&|$)|\?\?/i;
  6181. // Default jsonp settings
  6182. jQuery.ajaxSetup({
  6183. jsonp: "callback",
  6184. jsonpCallback: function() {
  6185. return jQuery.expando + "_" + ( jsc++ );
  6186. }
  6187. });
  6188. // Detect, normalize options and install callbacks for jsonp requests
  6189. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  6190. var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
  6191. ( typeof s.data === "string" );
  6192. if ( s.dataTypes[ 0 ] === "jsonp" ||
  6193. s.jsonp !== false && ( jsre.test( s.url ) ||
  6194. inspectData && jsre.test( s.data ) ) ) {
  6195. var responseContainer,
  6196. jsonpCallback = s.jsonpCallback =
  6197. jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
  6198. previous = window[ jsonpCallback ],
  6199. url = s.url,
  6200. data = s.data,
  6201. replace = "$1" + jsonpCallback + "$2";
  6202. if ( s.jsonp !== false ) {
  6203. url = url.replace( jsre, replace );
  6204. if ( s.url === url ) {
  6205. if ( inspectData ) {
  6206. data = data.replace( jsre, replace );
  6207. }
  6208. if ( s.data === data ) {
  6209. // Add callback manually
  6210. url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
  6211. }
  6212. }
  6213. }
  6214. s.url = url;
  6215. s.data = data;
  6216. // Install callback
  6217. window[ jsonpCallback ] = function( response ) {
  6218. responseContainer = [ response ];
  6219. };
  6220. // Clean-up function
  6221. jqXHR.always(function() {
  6222. // Set callback back to previous value
  6223. window[ jsonpCallback ] = previous;
  6224. // Call if it was a function and we have a response
  6225. if ( responseContainer && jQuery.isFunction( previous ) ) {
  6226. window[ jsonpCallback ]( responseContainer[ 0 ] );
  6227. }
  6228. });
  6229. // Use data converter to retrieve json after script execution
  6230. s.converters["script json"] = function() {
  6231. if ( !responseContainer ) {
  6232. jQuery.error( jsonpCallback + " was not called" );
  6233. }
  6234. return responseContainer[ 0 ];
  6235. };
  6236. // force json dataType
  6237. s.dataTypes[ 0 ] = "json";
  6238. // Delegate to script
  6239. return "script";
  6240. }
  6241. });
  6242. // Install script dataType
  6243. jQuery.ajaxSetup({
  6244. accepts: {
  6245. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  6246. },
  6247. contents: {
  6248. script: /javascript|ecmascript/
  6249. },
  6250. converters: {
  6251. "text script": function( text ) {
  6252. jQuery.globalEval( text );
  6253. return text;
  6254. }
  6255. }
  6256. });
  6257. // Handle cache's special case and global
  6258. jQuery.ajaxPrefilter( "script", function( s ) {
  6259. if ( s.cache === undefined ) {
  6260. s.cache = false;
  6261. }
  6262. if ( s.crossDomain ) {
  6263. s.type = "GET";
  6264. s.global = false;
  6265. }
  6266. });
  6267. // Bind script tag hack transport
  6268. jQuery.ajaxTransport( "script", function(s) {
  6269. // This transport only deals with cross domain requests
  6270. if ( s.crossDomain ) {
  6271. var script,
  6272. head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
  6273. return {
  6274. send: function( _, callback ) {
  6275. script = document.createElement( "script" );
  6276. script.async = "async";
  6277. if ( s.scriptCharset ) {
  6278. script.charset = s.scriptCharset;
  6279. }
  6280. script.src = s.url;
  6281. // Attach handlers for all browsers
  6282. script.onload = script.onreadystatechange = function( _, isAbort ) {
  6283. if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
  6284. // Handle memory leak in IE
  6285. script.onload = script.onreadystatechange = null;
  6286. // Remove the script
  6287. if ( head && script.parentNode ) {
  6288. head.removeChild( script );
  6289. }
  6290. // Dereference the script
  6291. script = undefined;
  6292. // Callback if not abort
  6293. if ( !isAbort ) {
  6294. callback( 200, "success" );
  6295. }
  6296. }
  6297. };
  6298. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  6299. // This arises when a base node is used (#2709 and #4378).
  6300. head.insertBefore( script, head.firstChild );
  6301. },
  6302. abort: function() {
  6303. if ( script ) {
  6304. script.onload( 0, 1 );
  6305. }
  6306. }
  6307. };
  6308. }
  6309. });
  6310. var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
  6311. xhrOnUnloadAbort = window.ActiveXObject ? function() {
  6312. // Abort all pending requests
  6313. for ( var key in xhrCallbacks ) {
  6314. xhrCallbacks[ key ]( 0, 1 );
  6315. }
  6316. } : false,
  6317. xhrId = 0,
  6318. xhrCallbacks;
  6319. // Functions to create xhrs
  6320. function createStandardXHR() {
  6321. try {
  6322. return new window.XMLHttpRequest();
  6323. } catch( e ) {}
  6324. }
  6325. function createActiveXHR() {
  6326. try {
  6327. return new window.ActiveXObject( "Microsoft.XMLHTTP" );
  6328. } catch( e ) {}
  6329. }
  6330. // Create the request object
  6331. // (This is still attached to ajaxSettings for backward compatibility)
  6332. jQuery.ajaxSettings.xhr = window.ActiveXObject ?
  6333. /* Microsoft failed to properly
  6334. * implement the XMLHttpRequest in IE7 (can't request local files),
  6335. * so we use the ActiveXObject when it is available
  6336. * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
  6337. * we need a fallback.
  6338. */
  6339. function() {
  6340. return !this.isLocal && createStandardXHR() || createActiveXHR();
  6341. } :
  6342. // For all other browsers, use the standard XMLHttpRequest object
  6343. createStandardXHR;
  6344. // Determine support properties
  6345. (function( xhr ) {
  6346. jQuery.extend( jQuery.support, {
  6347. ajax: !!xhr,
  6348. cors: !!xhr && ( "withCredentials" in xhr )
  6349. });
  6350. })( jQuery.ajaxSettings.xhr() );
  6351. // Create transport if the browser can provide an xhr
  6352. if ( jQuery.support.ajax ) {
  6353. jQuery.ajaxTransport(function( s ) {
  6354. // Cross domain only allowed if supported through XMLHttpRequest
  6355. if ( !s.crossDomain || jQuery.support.cors ) {
  6356. var callback;
  6357. return {
  6358. send: function( headers, complete ) {
  6359. // Get a new xhr
  6360. var xhr = s.xhr(),
  6361. handle,
  6362. i;
  6363. // Open the socket
  6364. // Passing null username, generates a login popup on Opera (#2865)
  6365. if ( s.username ) {
  6366. xhr.open( s.type, s.url, s.async, s.username, s.password );
  6367. } else {
  6368. xhr.open( s.type, s.url, s.async );
  6369. }
  6370. // Apply custom fields if provided
  6371. if ( s.xhrFields ) {
  6372. for ( i in s.xhrFields ) {
  6373. xhr[ i ] = s.xhrFields[ i ];
  6374. }
  6375. }
  6376. // Override mime type if needed
  6377. if ( s.mimeType && xhr.overrideMimeType ) {
  6378. xhr.overrideMimeType( s.mimeType );
  6379. }
  6380. // X-Requested-With header
  6381. // For cross-domain requests, seeing as conditions for a preflight are
  6382. // akin to a jigsaw puzzle, we simply never set it to be sure.
  6383. // (it can always be set on a per-request basis or even using ajaxSetup)
  6384. // For same-domain requests, won't change header if already provided.
  6385. if ( !s.crossDomain && !headers["X-Requested-With"] ) {
  6386. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  6387. }
  6388. // Need an extra try/catch for cross domain requests in Firefox 3
  6389. try {
  6390. for ( i in headers ) {
  6391. xhr.setRequestHeader( i, headers[ i ] );
  6392. }
  6393. } catch( _ ) {}
  6394. // Do send the request
  6395. // This may raise an exception which is actually
  6396. // handled in jQuery.ajax (so no try/catch here)
  6397. xhr.send( ( s.hasContent && s.data ) || null );
  6398. // Listener
  6399. callback = function( _, isAbort ) {
  6400. var status,
  6401. statusText,
  6402. responseHeaders,
  6403. responses,
  6404. xml;
  6405. // Firefox throws exceptions when accessing properties
  6406. // of an xhr when a network error occured
  6407. // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
  6408. try {
  6409. // Was never called and is aborted or complete
  6410. if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
  6411. // Only called once
  6412. callback = undefined;
  6413. // Do not keep as active anymore
  6414. if ( handle ) {
  6415. xhr.onreadystatechange = jQuery.noop;
  6416. if ( xhrOnUnloadAbort ) {
  6417. delete xhrCallbacks[ handle ];
  6418. }
  6419. }
  6420. // If it's an abort
  6421. if ( isAbort ) {
  6422. // Abort it manually if needed
  6423. if ( xhr.readyState !== 4 ) {
  6424. xhr.abort();
  6425. }
  6426. } else {
  6427. status = xhr.status;
  6428. responseHeaders = xhr.getAllResponseHeaders();
  6429. responses = {};
  6430. xml = xhr.responseXML;
  6431. // Construct response list
  6432. if ( xml && xml.documentElement /* #4958 */ ) {
  6433. responses.xml = xml;
  6434. }
  6435. responses.text = xhr.responseText;
  6436. // Firefox throws an exception when accessing
  6437. // statusText for faulty cross-domain requests
  6438. try {
  6439. statusText = xhr.statusText;
  6440. } catch( e ) {
  6441. // We normalize with Webkit giving an empty statusText
  6442. statusText = "";
  6443. }
  6444. // Filter status for non standard behaviors
  6445. // If the request is local and we have data: assume a success
  6446. // (success with no data won't get notified, that's the best we
  6447. // can do given current implementations)
  6448. if ( !status && s.isLocal && !s.crossDomain ) {
  6449. status = responses.text ? 200 : 404;
  6450. // IE - #1450: sometimes returns 1223 when it should be 204
  6451. } else if ( status === 1223 ) {
  6452. status = 204;
  6453. }
  6454. }
  6455. }
  6456. } catch( firefoxAccessException ) {
  6457. if ( !isAbort ) {
  6458. complete( -1, firefoxAccessException );
  6459. }
  6460. }
  6461. // Call complete if needed
  6462. if ( responses ) {
  6463. complete( status, statusText, responses, responseHeaders );
  6464. }
  6465. };
  6466. // if we're in sync mode or it's in cache
  6467. // and has been retrieved directly (IE6 & IE7)
  6468. // we need to manually fire the callback
  6469. if ( !s.async || xhr.readyState === 4 ) {
  6470. callback();
  6471. } else {
  6472. handle = ++xhrId;
  6473. if ( xhrOnUnloadAbort ) {
  6474. // Create the active xhrs callbacks list if needed
  6475. // and attach the unload handler
  6476. if ( !xhrCallbacks ) {
  6477. xhrCallbacks = {};
  6478. jQuery( window ).unload( xhrOnUnloadAbort );
  6479. }
  6480. // Add to list of active xhrs callbacks
  6481. xhrCallbacks[ handle ] = callback;
  6482. }
  6483. xhr.onreadystatechange = callback;
  6484. }
  6485. },
  6486. abort: function() {
  6487. if ( callback ) {
  6488. callback(0,1);
  6489. }
  6490. }
  6491. };
  6492. }
  6493. });
  6494. }
  6495. var elemdisplay = {},
  6496. iframe, iframeDoc,
  6497. rfxtypes = /^(?:toggle|show|hide)$/,
  6498. rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
  6499. timerId,
  6500. fxAttrs = [
  6501. // height animations
  6502. [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  6503. // width animations
  6504. [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  6505. // opacity animations
  6506. [ "opacity" ]
  6507. ],
  6508. fxNow,
  6509. requestAnimationFrame = window.webkitRequestAnimationFrame ||
  6510. window.mozRequestAnimationFrame ||
  6511. window.oRequestAnimationFrame;
  6512. jQuery.fn.extend({
  6513. show: function( speed, easing, callback ) {
  6514. var elem, display;
  6515. if ( speed || speed === 0 ) {
  6516. return this.animate( genFx("show", 3), speed, easing, callback);
  6517. } else {
  6518. for ( var i = 0, j = this.length; i < j; i++ ) {
  6519. elem = this[i];
  6520. if ( elem.style ) {
  6521. display = elem.style.display;
  6522. // Reset the inline display of this element to learn if it is
  6523. // being hidden by cascaded rules or not
  6524. if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
  6525. display = elem.style.display = "";
  6526. }
  6527. // Set elements which have been overridden with display: none
  6528. // in a stylesheet to whatever the default browser style is
  6529. // for such an element
  6530. if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
  6531. jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
  6532. }
  6533. }
  6534. }
  6535. // Set the display of most of the elements in a second loop
  6536. // to avoid the constant reflow
  6537. for ( i = 0; i < j; i++ ) {
  6538. elem = this[i];
  6539. if ( elem.style ) {
  6540. display = elem.style.display;
  6541. if ( display === "" || display === "none" ) {
  6542. elem.style.display = jQuery._data(elem, "olddisplay") || "";
  6543. }
  6544. }
  6545. }
  6546. return this;
  6547. }
  6548. },
  6549. hide: function( speed, easing, callback ) {
  6550. if ( speed || speed === 0 ) {
  6551. return this.animate( genFx("hide", 3), speed, easing, callback);
  6552. } else {
  6553. for ( var i = 0, j = this.length; i < j; i++ ) {
  6554. if ( this[i].style ) {
  6555. var display = jQuery.css( this[i], "display" );
  6556. if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
  6557. jQuery._data( this[i], "olddisplay", display );
  6558. }
  6559. }
  6560. }
  6561. // Set the display of the elements in a second loop
  6562. // to avoid the constant reflow
  6563. for ( i = 0; i < j; i++ ) {
  6564. if ( this[i].style ) {
  6565. this[i].style.display = "none";
  6566. }
  6567. }
  6568. return this;
  6569. }
  6570. },
  6571. // Save the old toggle function
  6572. _toggle: jQuery.fn.toggle,
  6573. toggle: function( fn, fn2, callback ) {
  6574. var bool = typeof fn === "boolean";
  6575. if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
  6576. this._toggle.apply( this, arguments );
  6577. } else if ( fn == null || bool ) {
  6578. this.each(function() {
  6579. var state = bool ? fn : jQuery(this).is(":hidden");
  6580. jQuery(this)[ state ? "show" : "hide" ]();
  6581. });
  6582. } else {
  6583. this.animate(genFx("toggle", 3), fn, fn2, callback);
  6584. }
  6585. return this;
  6586. },
  6587. fadeTo: function( speed, to, easing, callback ) {
  6588. return this.filter(":hidden").css("opacity", 0).show().end()
  6589. .animate({opacity: to}, speed, easing, callback);
  6590. },
  6591. animate: function( prop, speed, easing, callback ) {
  6592. var optall = jQuery.speed(speed, easing, callback);
  6593. if ( jQuery.isEmptyObject( prop ) ) {
  6594. return this.each( optall.complete, [ false ] );
  6595. }
  6596. // Do not change referenced properties as per-property easing will be lost
  6597. prop = jQuery.extend( {}, prop );
  6598. return this[ optall.queue === false ? "each" : "queue" ](function() {
  6599. // XXX 'this' does not always have a nodeName when running the
  6600. // test suite
  6601. if ( optall.queue === false ) {
  6602. jQuery._mark( this );
  6603. }
  6604. var opt = jQuery.extend( {}, optall ),
  6605. isElement = this.nodeType === 1,
  6606. hidden = isElement && jQuery(this).is(":hidden"),
  6607. name, val, p,
  6608. display, e,
  6609. parts, start, end, unit;
  6610. // will store per property easing and be used to determine when an animation is complete
  6611. opt.animatedProperties = {};
  6612. for ( p in prop ) {
  6613. // property name normalization
  6614. name = jQuery.camelCase( p );
  6615. if ( p !== name ) {
  6616. prop[ name ] = prop[ p ];
  6617. delete prop[ p ];
  6618. }
  6619. val = prop[ name ];
  6620. // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
  6621. if ( jQuery.isArray( val ) ) {
  6622. opt.animatedProperties[ name ] = val[ 1 ];
  6623. val = prop[ name ] = val[ 0 ];
  6624. } else {
  6625. opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
  6626. }
  6627. if ( val === "hide" && hidden || val === "show" && !hidden ) {
  6628. return opt.complete.call( this );
  6629. }
  6630. if ( isElement && ( name === "height" || name === "width" ) ) {
  6631. // Make sure that nothing sneaks out
  6632. // Record all 3 overflow attributes because IE does not
  6633. // change the overflow attribute when overflowX and
  6634. // overflowY are set to the same value
  6635. opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
  6636. // Set display property to inline-block for height/width
  6637. // animations on inline elements that are having width/height
  6638. // animated
  6639. if ( jQuery.css( this, "display" ) === "inline" &&
  6640. jQuery.css( this, "float" ) === "none" ) {
  6641. if ( !jQuery.support.inlineBlockNeedsLayout ) {
  6642. this.style.display = "inline-block";
  6643. } else {
  6644. display = defaultDisplay( this.nodeName );
  6645. // inline-level elements accept inline-block;
  6646. // block-level elements need to be inline with layout
  6647. if ( display === "inline" ) {
  6648. this.style.display = "inline-block";
  6649. } else {
  6650. this.style.display = "inline";
  6651. this.style.zoom = 1;
  6652. }
  6653. }
  6654. }
  6655. }
  6656. }
  6657. if ( opt.overflow != null ) {
  6658. this.style.overflow = "hidden";
  6659. }
  6660. for ( p in prop ) {
  6661. e = new jQuery.fx( this, opt, p );
  6662. val = prop[ p ];
  6663. if ( rfxtypes.test(val) ) {
  6664. e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
  6665. } else {
  6666. parts = rfxnum.exec( val );
  6667. start = e.cur();
  6668. if ( parts ) {
  6669. end = parseFloat( parts[2] );
  6670. unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
  6671. // We need to compute starting value
  6672. if ( unit !== "px" ) {
  6673. jQuery.style( this, p, (end || 1) + unit);
  6674. start = ((end || 1) / e.cur()) * start;
  6675. jQuery.style( this, p, start + unit);
  6676. }
  6677. // If a +=/-= token was provided, we're doing a relative animation
  6678. if ( parts[1] ) {
  6679. end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
  6680. }
  6681. e.custom( start, end, unit );
  6682. } else {
  6683. e.custom( start, val, "" );
  6684. }
  6685. }
  6686. }
  6687. // For JS strict compliance
  6688. return true;
  6689. });
  6690. },
  6691. stop: function( clearQueue, gotoEnd ) {
  6692. if ( clearQueue ) {
  6693. this.queue([]);
  6694. }
  6695. this.each(function() {
  6696. var timers = jQuery.timers,
  6697. i = timers.length;
  6698. // clear marker counters if we know they won't be
  6699. if ( !gotoEnd ) {
  6700. jQuery._unmark( true, this );
  6701. }
  6702. while ( i-- ) {
  6703. if ( timers[i].elem === this ) {
  6704. if (gotoEnd) {
  6705. // force the next step to be the last
  6706. timers[i](true);
  6707. }
  6708. timers.splice(i, 1);
  6709. }
  6710. }
  6711. });
  6712. // start the next in the queue if the last step wasn't forced
  6713. if ( !gotoEnd ) {
  6714. this.dequeue();
  6715. }
  6716. return this;
  6717. }
  6718. });
  6719. // Animations created synchronously will run synchronously
  6720. function createFxNow() {
  6721. setTimeout( clearFxNow, 0 );
  6722. return ( fxNow = jQuery.now() );
  6723. }
  6724. function clearFxNow() {
  6725. fxNow = undefined;
  6726. }
  6727. // Generate parameters to create a standard animation
  6728. function genFx( type, num ) {
  6729. var obj = {};
  6730. jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
  6731. obj[ this ] = type;
  6732. });
  6733. return obj;
  6734. }
  6735. // Generate shortcuts for custom animations
  6736. jQuery.each({
  6737. slideDown: genFx("show", 1),
  6738. slideUp: genFx("hide", 1),
  6739. slideToggle: genFx("toggle", 1),
  6740. fadeIn: { opacity: "show" },
  6741. fadeOut: { opacity: "hide" },
  6742. fadeToggle: { opacity: "toggle" }
  6743. }, function( name, props ) {
  6744. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6745. return this.animate( props, speed, easing, callback );
  6746. };
  6747. });
  6748. jQuery.extend({
  6749. speed: function( speed, easing, fn ) {
  6750. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  6751. complete: fn || !fn && easing ||
  6752. jQuery.isFunction( speed ) && speed,
  6753. duration: speed,
  6754. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  6755. };
  6756. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  6757. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
  6758. // Queueing
  6759. opt.old = opt.complete;
  6760. opt.complete = function( noUnmark ) {
  6761. if ( opt.queue !== false ) {
  6762. jQuery.dequeue( this );
  6763. } else if ( noUnmark !== false ) {
  6764. jQuery._unmark( this );
  6765. }
  6766. if ( jQuery.isFunction( opt.old ) ) {
  6767. opt.old.call( this );
  6768. }
  6769. };
  6770. return opt;
  6771. },
  6772. easing: {
  6773. linear: function( p, n, firstNum, diff ) {
  6774. return firstNum + diff * p;
  6775. },
  6776. swing: function( p, n, firstNum, diff ) {
  6777. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  6778. }
  6779. },
  6780. timers: [],
  6781. fx: function( elem, options, prop ) {
  6782. this.options = options;
  6783. this.elem = elem;
  6784. this.prop = prop;
  6785. options.orig = options.orig || {};
  6786. }
  6787. });
  6788. jQuery.fx.prototype = {
  6789. // Simple function for setting a style value
  6790. update: function() {
  6791. if ( this.options.step ) {
  6792. this.options.step.call( this.elem, this.now, this );
  6793. }
  6794. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  6795. },
  6796. // Get the current size
  6797. cur: function() {
  6798. if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
  6799. return this.elem[ this.prop ];
  6800. }
  6801. var parsed,
  6802. r = jQuery.css( this.elem, this.prop );
  6803. // Empty strings, null, undefined and "auto" are converted to 0,
  6804. // complex values such as "rotate(1rad)" are returned as is,
  6805. // simple values such as "10px" are parsed to Float.
  6806. return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
  6807. },
  6808. // Start an animation from one number to another
  6809. custom: function( from, to, unit ) {
  6810. var self = this,
  6811. fx = jQuery.fx,
  6812. raf;
  6813. this.startTime = fxNow || createFxNow();
  6814. this.start = from;
  6815. this.end = to;
  6816. this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
  6817. this.now = this.start;
  6818. this.pos = this.state = 0;
  6819. function t( gotoEnd ) {
  6820. return self.step(gotoEnd);
  6821. }
  6822. t.elem = this.elem;
  6823. if ( t() && jQuery.timers.push(t) && !timerId ) {
  6824. // Use requestAnimationFrame instead of setInterval if available
  6825. if ( requestAnimationFrame ) {
  6826. timerId = 1;
  6827. raf = function() {
  6828. // When timerId gets set to null at any point, this stops
  6829. if ( timerId ) {
  6830. requestAnimationFrame( raf );
  6831. fx.tick();
  6832. }
  6833. };
  6834. requestAnimationFrame( raf );
  6835. } else {
  6836. timerId = setInterval( fx.tick, fx.interval );
  6837. }
  6838. }
  6839. },
  6840. // Simple 'show' function
  6841. show: function() {
  6842. // Remember where we started, so that we can go back to it later
  6843. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6844. this.options.show = true;
  6845. // Begin the animation
  6846. // Make sure that we start at a small width/height to avoid any
  6847. // flash of content
  6848. this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
  6849. // Start by showing the element
  6850. jQuery( this.elem ).show();
  6851. },
  6852. // Simple 'hide' function
  6853. hide: function() {
  6854. // Remember where we started, so that we can go back to it later
  6855. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6856. this.options.hide = true;
  6857. // Begin the animation
  6858. this.custom(this.cur(), 0);
  6859. },
  6860. // Each step of an animation
  6861. step: function( gotoEnd ) {
  6862. var t = fxNow || createFxNow(),
  6863. done = true,
  6864. elem = this.elem,
  6865. options = this.options,
  6866. i, n;
  6867. if ( gotoEnd || t >= options.duration + this.startTime ) {
  6868. this.now = this.end;
  6869. this.pos = this.state = 1;
  6870. this.update();
  6871. options.animatedProperties[ this.prop ] = true;
  6872. for ( i in options.animatedProperties ) {
  6873. if ( options.animatedProperties[i] !== true ) {
  6874. done = false;
  6875. }
  6876. }
  6877. if ( done ) {
  6878. // Reset the overflow
  6879. if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
  6880. jQuery.each( [ "", "X", "Y" ], function (index, value) {
  6881. elem.style[ "overflow" + value ] = options.overflow[index];
  6882. });
  6883. }
  6884. // Hide the element if the "hide" operation was done
  6885. if ( options.hide ) {
  6886. jQuery(elem).hide();
  6887. }
  6888. // Reset the properties, if the item has been hidden or shown
  6889. if ( options.hide || options.show ) {
  6890. for ( var p in options.animatedProperties ) {
  6891. jQuery.style( elem, p, options.orig[p] );
  6892. }
  6893. }
  6894. // Execute the complete function
  6895. options.complete.call( elem );
  6896. }
  6897. return false;
  6898. } else {
  6899. // classical easing cannot be used with an Infinity duration
  6900. if ( options.duration == Infinity ) {
  6901. this.now = t;
  6902. } else {
  6903. n = t - this.startTime;
  6904. this.state = n / options.duration;
  6905. // Perform the easing function, defaults to swing
  6906. this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
  6907. this.now = this.start + ((this.end - this.start) * this.pos);
  6908. }
  6909. // Perform the next step of the animation
  6910. this.update();
  6911. }
  6912. return true;
  6913. }
  6914. };
  6915. jQuery.extend( jQuery.fx, {
  6916. tick: function() {
  6917. for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
  6918. if ( !timers[i]() ) {
  6919. timers.splice(i--, 1);
  6920. }
  6921. }
  6922. if ( !timers.length ) {
  6923. jQuery.fx.stop();
  6924. }
  6925. },
  6926. interval: 13,
  6927. stop: function() {
  6928. clearInterval( timerId );
  6929. timerId = null;
  6930. },
  6931. speeds: {
  6932. slow: 600,
  6933. fast: 200,
  6934. // Default speed
  6935. _default: 400
  6936. },
  6937. step: {
  6938. opacity: function( fx ) {
  6939. jQuery.style( fx.elem, "opacity", fx.now );
  6940. },
  6941. _default: function( fx ) {
  6942. if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
  6943. fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
  6944. } else {
  6945. fx.elem[ fx.prop ] = fx.now;
  6946. }
  6947. }
  6948. }
  6949. });
  6950. if ( jQuery.expr && jQuery.expr.filters ) {
  6951. jQuery.expr.filters.animated = function( elem ) {
  6952. return jQuery.grep(jQuery.timers, function( fn ) {
  6953. return elem === fn.elem;
  6954. }).length;
  6955. };
  6956. }
  6957. // Try to restore the default display value of an element
  6958. function defaultDisplay( nodeName ) {
  6959. if ( !elemdisplay[ nodeName ] ) {
  6960. var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
  6961. display = elem.css( "display" );
  6962. elem.remove();
  6963. // If the simple way fails,
  6964. // get element's real default display by attaching it to a temp iframe
  6965. if ( display === "none" || display === "" ) {
  6966. // No iframe to use yet, so create it
  6967. if ( !iframe ) {
  6968. iframe = document.createElement( "iframe" );
  6969. iframe.frameBorder = iframe.width = iframe.height = 0;
  6970. }
  6971. document.body.appendChild( iframe );
  6972. // Create a cacheable copy of the iframe document on first call.
  6973. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
  6974. // document to it, Webkit & Firefox won't allow reusing the iframe document
  6975. if ( !iframeDoc || !iframe.createElement ) {
  6976. iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
  6977. iframeDoc.write( "<!doctype><html><body></body></html>" );
  6978. }
  6979. elem = iframeDoc.createElement( nodeName );
  6980. iframeDoc.body.appendChild( elem );
  6981. display = jQuery.css( elem, "display" );
  6982. document.body.removeChild( iframe );
  6983. }
  6984. // Store the correct default display
  6985. elemdisplay[ nodeName ] = display;
  6986. }
  6987. return elemdisplay[ nodeName ];
  6988. }
  6989. var rtable = /^t(?:able|d|h)$/i,
  6990. rroot = /^(?:body|html)$/i;
  6991. if ( "getBoundingClientRect" in document.documentElement ) {
  6992. jQuery.fn.offset = function( options ) {
  6993. var elem = this[0], box;
  6994. if ( options ) {
  6995. return this.each(function( i ) {
  6996. jQuery.offset.setOffset( this, options, i );
  6997. });
  6998. }
  6999. if ( !elem || !elem.ownerDocument ) {
  7000. return null;
  7001. }
  7002. if ( elem === elem.ownerDocument.body ) {
  7003. return jQuery.offset.bodyOffset( elem );
  7004. }
  7005. try {
  7006. box = elem.getBoundingClientRect();
  7007. } catch(e) {}
  7008. var doc = elem.ownerDocument,
  7009. docElem = doc.documentElement;
  7010. // Make sure we're not dealing with a disconnected DOM node
  7011. if ( !box || !jQuery.contains( docElem, elem ) ) {
  7012. return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
  7013. }
  7014. var body = doc.body,
  7015. win = getWindow(doc),
  7016. clientTop = docElem.clientTop || body.clientTop || 0,
  7017. clientLeft = docElem.clientLeft || body.clientLeft || 0,
  7018. scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
  7019. scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
  7020. top = box.top + scrollTop - clientTop,
  7021. left = box.left + scrollLeft - clientLeft;
  7022. return { top: top, left: left };
  7023. };
  7024. } else {
  7025. jQuery.fn.offset = function( options ) {
  7026. var elem = this[0];
  7027. if ( options ) {
  7028. return this.each(function( i ) {
  7029. jQuery.offset.setOffset( this, options, i );
  7030. });
  7031. }
  7032. if ( !elem || !elem.ownerDocument ) {
  7033. return null;
  7034. }
  7035. if ( elem === elem.ownerDocument.body ) {
  7036. return jQuery.offset.bodyOffset( elem );
  7037. }
  7038. jQuery.offset.initialize();
  7039. var computedStyle,
  7040. offsetParent = elem.offsetParent,
  7041. prevOffsetParent = elem,
  7042. doc = elem.ownerDocument,
  7043. docElem = doc.documentElement,
  7044. body = doc.body,
  7045. defaultView = doc.defaultView,
  7046. prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
  7047. top = elem.offsetTop,
  7048. left = elem.offsetLeft;
  7049. while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
  7050. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  7051. break;
  7052. }
  7053. computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
  7054. top -= elem.scrollTop;
  7055. left -= elem.scrollLeft;
  7056. if ( elem === offsetParent ) {
  7057. top += elem.offsetTop;
  7058. left += elem.offsetLeft;
  7059. if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
  7060. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  7061. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  7062. }
  7063. prevOffsetParent = offsetParent;
  7064. offsetParent = elem.offsetParent;
  7065. }
  7066. if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
  7067. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  7068. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  7069. }
  7070. prevComputedStyle = computedStyle;
  7071. }
  7072. if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
  7073. top += body.offsetTop;
  7074. left += body.offsetLeft;
  7075. }
  7076. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  7077. top += Math.max( docElem.scrollTop, body.scrollTop );
  7078. left += Math.max( docElem.scrollLeft, body.scrollLeft );
  7079. }
  7080. return { top: top, left: left };
  7081. };
  7082. }
  7083. jQuery.offset = {
  7084. initialize: function() {
  7085. var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
  7086. html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
  7087. jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
  7088. container.innerHTML = html;
  7089. body.insertBefore( container, body.firstChild );
  7090. innerDiv = container.firstChild;
  7091. checkDiv = innerDiv.firstChild;
  7092. td = innerDiv.nextSibling.firstChild.firstChild;
  7093. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  7094. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  7095. checkDiv.style.position = "fixed";
  7096. checkDiv.style.top = "20px";
  7097. // safari subtracts parent border width here which is 5px
  7098. this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
  7099. checkDiv.style.position = checkDiv.style.top = "";
  7100. innerDiv.style.overflow = "hidden";
  7101. innerDiv.style.position = "relative";
  7102. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  7103. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
  7104. body.removeChild( container );
  7105. jQuery.offset.initialize = jQuery.noop;
  7106. },
  7107. bodyOffset: function( body ) {
  7108. var top = body.offsetTop,
  7109. left = body.offsetLeft;
  7110. jQuery.offset.initialize();
  7111. if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
  7112. top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
  7113. left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
  7114. }
  7115. return { top: top, left: left };
  7116. },
  7117. setOffset: function( elem, options, i ) {
  7118. var position = jQuery.css( elem, "position" );
  7119. // set position first, in-case top/left are set even on static elem
  7120. if ( position === "static" ) {
  7121. elem.style.position = "relative";
  7122. }
  7123. var curElem = jQuery( elem ),
  7124. curOffset = curElem.offset(),
  7125. curCSSTop = jQuery.css( elem, "top" ),
  7126. curCSSLeft = jQuery.css( elem, "left" ),
  7127. calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
  7128. props = {}, curPosition = {}, curTop, curLeft;
  7129. // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
  7130. if ( calculatePosition ) {
  7131. curPosition = curElem.position();
  7132. curTop = curPosition.top;
  7133. curLeft = curPosition.left;
  7134. } else {
  7135. curTop = parseFloat( curCSSTop ) || 0;
  7136. curLeft = parseFloat( curCSSLeft ) || 0;
  7137. }
  7138. if ( jQuery.isFunction( options ) ) {
  7139. options = options.call( elem, i, curOffset );
  7140. }
  7141. if (options.top != null) {
  7142. props.top = (options.top - curOffset.top) + curTop;
  7143. }
  7144. if (options.left != null) {
  7145. props.left = (options.left - curOffset.left) + curLeft;
  7146. }
  7147. if ( "using" in options ) {
  7148. options.using.call( elem, props );
  7149. } else {
  7150. curElem.css( props );
  7151. }
  7152. }
  7153. };
  7154. jQuery.fn.extend({
  7155. position: function() {
  7156. if ( !this[0] ) {
  7157. return null;
  7158. }
  7159. var elem = this[0],
  7160. // Get *real* offsetParent
  7161. offsetParent = this.offsetParent(),
  7162. // Get correct offsets
  7163. offset = this.offset(),
  7164. parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
  7165. // Subtract element margins
  7166. // note: when an element has margin: auto the offsetLeft and marginLeft
  7167. // are the same in Safari causing offset.left to incorrectly be 0
  7168. offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
  7169. offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
  7170. // Add offsetParent borders
  7171. parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
  7172. parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
  7173. // Subtract the two offsets
  7174. return {
  7175. top: offset.top - parentOffset.top,
  7176. left: offset.left - parentOffset.left
  7177. };
  7178. },
  7179. offsetParent: function() {
  7180. return this.map(function() {
  7181. var offsetParent = this.offsetParent || document.body;
  7182. while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
  7183. offsetParent = offsetParent.offsetParent;
  7184. }
  7185. return offsetParent;
  7186. });
  7187. }
  7188. });
  7189. // Create scrollLeft and scrollTop methods
  7190. jQuery.each( ["Left", "Top"], function( i, name ) {
  7191. var method = "scroll" + name;
  7192. jQuery.fn[ method ] = function( val ) {
  7193. var elem, win;
  7194. if ( val === undefined ) {
  7195. elem = this[ 0 ];
  7196. if ( !elem ) {
  7197. return null;
  7198. }
  7199. win = getWindow( elem );
  7200. // Return the scroll offset
  7201. return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
  7202. jQuery.support.boxModel && win.document.documentElement[ method ] ||
  7203. win.document.body[ method ] :
  7204. elem[ method ];
  7205. }
  7206. // Set the scroll offset
  7207. return this.each(function() {
  7208. win = getWindow( this );
  7209. if ( win ) {
  7210. win.scrollTo(
  7211. !i ? val : jQuery( win ).scrollLeft(),
  7212. i ? val : jQuery( win ).scrollTop()
  7213. );
  7214. } else {
  7215. this[ method ] = val;
  7216. }
  7217. });
  7218. };
  7219. });
  7220. function getWindow( elem ) {
  7221. return jQuery.isWindow( elem ) ?
  7222. elem :
  7223. elem.nodeType === 9 ?
  7224. elem.defaultView || elem.parentWindow :
  7225. false;
  7226. }
  7227. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  7228. jQuery.each([ "Height", "Width" ], function( i, name ) {
  7229. var type = name.toLowerCase();
  7230. // innerHeight and innerWidth
  7231. jQuery.fn["inner" + name] = function() {
  7232. return this[0] ?
  7233. parseFloat( jQuery.css( this[0], type, "padding" ) ) :
  7234. null;
  7235. };
  7236. // outerHeight and outerWidth
  7237. jQuery.fn["outer" + name] = function( margin ) {
  7238. return this[0] ?
  7239. parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
  7240. null;
  7241. };
  7242. jQuery.fn[ type ] = function( size ) {
  7243. // Get window width or height
  7244. var elem = this[0];
  7245. if ( !elem ) {
  7246. return size == null ? null : this;
  7247. }
  7248. if ( jQuery.isFunction( size ) ) {
  7249. return this.each(function( i ) {
  7250. var self = jQuery( this );
  7251. self[ type ]( size.call( this, i, self[ type ]() ) );
  7252. });
  7253. }
  7254. if ( jQuery.isWindow( elem ) ) {
  7255. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  7256. // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
  7257. var docElemProp = elem.document.documentElement[ "client" + name ];
  7258. return elem.document.compatMode === "CSS1Compat" && docElemProp ||
  7259. elem.document.body[ "client" + name ] || docElemProp;
  7260. // Get document width or height
  7261. } else if ( elem.nodeType === 9 ) {
  7262. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  7263. return Math.max(
  7264. elem.documentElement["client" + name],
  7265. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  7266. elem.body["offset" + name], elem.documentElement["offset" + name]
  7267. );
  7268. // Get or set width or height on the element
  7269. } else if ( size === undefined ) {
  7270. var orig = jQuery.css( elem, type ),
  7271. ret = parseFloat( orig );
  7272. return jQuery.isNaN( ret ) ? orig : ret;
  7273. // Set the width or height on the element (default to pixels if value is unitless)
  7274. } else {
  7275. return this.css( type, typeof size === "string" ? size : size + "px" );
  7276. }
  7277. };
  7278. });
  7279. window.jQuery = window.$ = jQuery;
  7280. })(window);