jquery-basis.js 166 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239
  1. /*!
  2. * jQuery JavaScript Library v1.4.2
  3. * http://jquery.com/
  4. *
  5. * Copyright 2010, 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 2010, The Dojo Foundation
  12. * Released under the MIT, BSD, and GPL Licenses.
  13. *
  14. * Date: Sat Feb 13 22:33:48 2010 -0500
  15. */
  16. (function( window, undefined ) {
  17. // Define a local copy of jQuery
  18. var jQuery = function( selector, context ) {
  19. // The jQuery object is actually just the init constructor 'enhanced'
  20. return new jQuery.fn.init( selector, context );
  21. },
  22. // Map over jQuery in case of overwrite
  23. _jQuery = window.jQuery,
  24. // Map over the $ in case of overwrite
  25. _$ = window.$,
  26. // Use the correct document accordingly with window argument (sandbox)
  27. document = window.document,
  28. // A central reference to the root jQuery(document)
  29. rootjQuery,
  30. // A simple way to check for HTML strings or ID strings
  31. // (both of which we optimize for)
  32. quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,
  33. // Is it a simple selector
  34. isSimple = /^.[^:#\[\.,]*$/,
  35. // Check if a string has a non-whitespace character in it
  36. rnotwhite = /\S/,
  37. // Used for trimming whitespace
  38. rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
  39. // Match a standalone tag
  40. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  41. // Keep a UserAgent string for use with jQuery.browser
  42. userAgent = navigator.userAgent,
  43. // For matching the engine and version of the browser
  44. browserMatch,
  45. // Has the ready events already been bound?
  46. readyBound = false,
  47. // The functions to execute on DOM ready
  48. readyList = [],
  49. // The ready event handler
  50. DOMContentLoaded,
  51. // Save a reference to some core methods
  52. toString = Object.prototype.toString,
  53. hasOwnProperty = Object.prototype.hasOwnProperty,
  54. push = Array.prototype.push,
  55. slice = Array.prototype.slice,
  56. indexOf = Array.prototype.indexOf;
  57. jQuery.fn = jQuery.prototype = {
  58. init: function( selector, context ) {
  59. var match, elem, ret, doc;
  60. // Handle $(""), $(null), or $(undefined)
  61. if ( !selector ) {
  62. return this;
  63. }
  64. // Handle $(DOMElement)
  65. if ( selector.nodeType ) {
  66. this.context = this[0] = selector;
  67. this.length = 1;
  68. return this;
  69. }
  70. // The body element only exists once, optimize finding it
  71. if ( selector === "body" && !context ) {
  72. this.context = document;
  73. this[0] = document.body;
  74. this.selector = "body";
  75. this.length = 1;
  76. return this;
  77. }
  78. // Handle HTML strings
  79. if ( typeof selector === "string" ) {
  80. // Are we dealing with HTML string or an ID?
  81. match = quickExpr.exec( selector );
  82. // Verify a match, and that no context was specified for #id
  83. if ( match && (match[1] || !context) ) {
  84. // HANDLE: $(html) -> $(array)
  85. if ( match[1] ) {
  86. doc = (context ? context.ownerDocument || context : document);
  87. // If a single string is passed in and it's a single tag
  88. // just do a createElement and skip the rest
  89. ret = rsingleTag.exec( selector );
  90. if ( ret ) {
  91. if ( jQuery.isPlainObject( context ) ) {
  92. selector = [ document.createElement( ret[1] ) ];
  93. jQuery.fn.attr.call( selector, context, true );
  94. } else {
  95. selector = [ doc.createElement( ret[1] ) ];
  96. }
  97. } else {
  98. ret = buildFragment( [ match[1] ], [ doc ] );
  99. selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
  100. }
  101. return jQuery.merge( this, selector );
  102. // HANDLE: $("#id")
  103. } else {
  104. elem = document.getElementById( match[2] );
  105. if ( elem ) {
  106. // Handle the case where IE and Opera return items
  107. // by name instead of ID
  108. if ( elem.id !== match[2] ) {
  109. return rootjQuery.find( selector );
  110. }
  111. // Otherwise, we inject the element directly into the jQuery object
  112. this.length = 1;
  113. this[0] = elem;
  114. }
  115. this.context = document;
  116. this.selector = selector;
  117. return this;
  118. }
  119. // HANDLE: $("TAG")
  120. } else if ( !context && /^\w+$/.test( selector ) ) {
  121. this.selector = selector;
  122. this.context = document;
  123. selector = document.getElementsByTagName( selector );
  124. return jQuery.merge( this, selector );
  125. // HANDLE: $(expr, $(...))
  126. } else if ( !context || context.jquery ) {
  127. return (context || rootjQuery).find( selector );
  128. // HANDLE: $(expr, context)
  129. // (which is just equivalent to: $(context).find(expr)
  130. } else {
  131. return jQuery( context ).find( selector );
  132. }
  133. // HANDLE: $(function)
  134. // Shortcut for document ready
  135. } else if ( jQuery.isFunction( selector ) ) {
  136. return rootjQuery.ready( selector );
  137. }
  138. if (selector.selector !== undefined) {
  139. this.selector = selector.selector;
  140. this.context = selector.context;
  141. }
  142. return jQuery.makeArray( selector, this );
  143. },
  144. // Start with an empty selector
  145. selector: "",
  146. // The current version of jQuery being used
  147. jquery: "1.4.2",
  148. // The default length of a jQuery object is 0
  149. length: 0,
  150. // The number of elements contained in the matched element set
  151. size: function() {
  152. return this.length;
  153. },
  154. toArray: function() {
  155. return slice.call( this, 0 );
  156. },
  157. // Get the Nth element in the matched element set OR
  158. // Get the whole matched element set as a clean array
  159. get: function( num ) {
  160. return num == null ?
  161. // Return a 'clean' array
  162. this.toArray() :
  163. // Return just the object
  164. ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
  165. },
  166. // Take an array of elements and push it onto the stack
  167. // (returning the new matched element set)
  168. pushStack: function( elems, name, selector ) {
  169. // Build a new jQuery matched element set
  170. var ret = jQuery();
  171. if ( jQuery.isArray( elems ) ) {
  172. push.apply( ret, elems );
  173. } else {
  174. jQuery.merge( ret, elems );
  175. }
  176. // Add the old object onto the stack (as a reference)
  177. ret.prevObject = this;
  178. ret.context = this.context;
  179. if ( name === "find" ) {
  180. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  181. } else if ( name ) {
  182. ret.selector = this.selector + "." + name + "(" + selector + ")";
  183. }
  184. // Return the newly-formed element set
  185. return ret;
  186. },
  187. // Execute a callback for every element in the matched set.
  188. // (You can seed the arguments with an array of args, but this is
  189. // only used internally.)
  190. each: function( callback, args ) {
  191. return jQuery.each( this, callback, args );
  192. },
  193. ready: function( fn ) {
  194. // Attach the listeners
  195. jQuery.bindReady();
  196. // If the DOM is already ready
  197. if ( jQuery.isReady ) {
  198. // Execute the function immediately
  199. fn.call( document, jQuery );
  200. // Otherwise, remember the function for later
  201. } else if ( readyList ) {
  202. // Add the function to the wait list
  203. readyList.push( fn );
  204. }
  205. return this;
  206. },
  207. eq: function( i ) {
  208. return i === -1 ?
  209. this.slice( i ) :
  210. this.slice( i, +i + 1 );
  211. },
  212. first: function() {
  213. return this.eq( 0 );
  214. },
  215. last: function() {
  216. return this.eq( -1 );
  217. },
  218. slice: function() {
  219. return this.pushStack( slice.apply( this, arguments ),
  220. "slice", slice.call(arguments).join(",") );
  221. },
  222. map: function( callback ) {
  223. return this.pushStack( jQuery.map(this, function( elem, i ) {
  224. return callback.call( elem, i, elem );
  225. }));
  226. },
  227. end: function() {
  228. return this.prevObject || jQuery(null);
  229. },
  230. // For internal use only.
  231. // Behaves like an Array's method, not like a jQuery method.
  232. push: push,
  233. sort: [].sort,
  234. splice: [].splice
  235. };
  236. // Give the init function the jQuery prototype for later instantiation
  237. jQuery.fn.init.prototype = jQuery.fn;
  238. jQuery.extend = jQuery.fn.extend = function() {
  239. // copy reference to target object
  240. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy;
  241. // Handle a deep copy situation
  242. if ( typeof target === "boolean" ) {
  243. deep = target;
  244. target = arguments[1] || {};
  245. // skip the boolean and the target
  246. i = 2;
  247. }
  248. // Handle case when target is a string or something (possible in deep copy)
  249. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  250. target = {};
  251. }
  252. // extend jQuery itself if only one argument is passed
  253. if ( length === i ) {
  254. target = this;
  255. --i;
  256. }
  257. for ( ; i < length; i++ ) {
  258. // Only deal with non-null/undefined values
  259. if ( (options = arguments[ i ]) != null ) {
  260. // Extend the base object
  261. for ( name in options ) {
  262. src = target[ name ];
  263. copy = options[ name ];
  264. // Prevent never-ending loop
  265. if ( target === copy ) {
  266. continue;
  267. }
  268. // Recurse if we're merging object literal values or arrays
  269. if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
  270. var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
  271. : jQuery.isArray(copy) ? [] : {};
  272. // Never move original objects, clone them
  273. target[ name ] = jQuery.extend( deep, clone, copy );
  274. // Don't bring in undefined values
  275. } else if ( copy !== undefined ) {
  276. target[ name ] = copy;
  277. }
  278. }
  279. }
  280. }
  281. // Return the modified object
  282. return target;
  283. };
  284. jQuery.extend({
  285. noConflict: function( deep ) {
  286. window.$ = _$;
  287. if ( deep ) {
  288. window.jQuery = _jQuery;
  289. }
  290. return jQuery;
  291. },
  292. // Is the DOM ready to be used? Set to true once it occurs.
  293. isReady: false,
  294. // Handle when the DOM is ready
  295. ready: function() {
  296. // Make sure that the DOM is not already loaded
  297. if ( !jQuery.isReady ) {
  298. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  299. if ( !document.body ) {
  300. return setTimeout( jQuery.ready, 13 );
  301. }
  302. // Remember that the DOM is ready
  303. jQuery.isReady = true;
  304. // If there are functions bound, to execute
  305. if ( readyList ) {
  306. // Execute all of them
  307. var fn, i = 0;
  308. while ( (fn = readyList[ i++ ]) ) {
  309. fn.call( document, jQuery );
  310. }
  311. // Reset the list of functions
  312. readyList = null;
  313. }
  314. // Trigger any bound ready events
  315. if ( jQuery.fn.triggerHandler ) {
  316. jQuery( document ).triggerHandler( "ready" );
  317. }
  318. }
  319. },
  320. bindReady: function() {
  321. if ( readyBound ) {
  322. return;
  323. }
  324. readyBound = true;
  325. // Catch cases where $(document).ready() is called after the
  326. // browser event has already occurred.
  327. if ( document.readyState === "complete" ) {
  328. return jQuery.ready();
  329. }
  330. // Mozilla, Opera and webkit nightlies currently support this event
  331. if ( document.addEventListener ) {
  332. // Use the handy event callback
  333. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  334. // A fallback to window.onload, that will always work
  335. window.addEventListener( "load", jQuery.ready, false );
  336. // If IE event model is used
  337. } else if ( document.attachEvent ) {
  338. // ensure firing before onload,
  339. // maybe late but safe also for iframes
  340. document.attachEvent("onreadystatechange", DOMContentLoaded);
  341. // A fallback to window.onload, that will always work
  342. window.attachEvent( "onload", jQuery.ready );
  343. // If IE and not a frame
  344. // continually check to see if the document is ready
  345. var toplevel = false;
  346. try {
  347. toplevel = window.frameElement == null;
  348. } catch(e) {}
  349. if ( document.documentElement.doScroll && toplevel ) {
  350. doScrollCheck();
  351. }
  352. }
  353. },
  354. // See test/unit/core.js for details concerning isFunction.
  355. // Since version 1.3, DOM methods and functions like alert
  356. // aren't supported. They return false on IE (#2968).
  357. isFunction: function( obj ) {
  358. return toString.call(obj) === "[object Function]";
  359. },
  360. isArray: function( obj ) {
  361. return toString.call(obj) === "[object Array]";
  362. },
  363. isPlainObject: function( obj ) {
  364. // Must be an Object.
  365. // Because of IE, we also have to check the presence of the constructor property.
  366. // Make sure that DOM nodes and window objects don't pass through, as well
  367. if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) {
  368. return false;
  369. }
  370. // Not own constructor property must be Object
  371. if ( obj.constructor
  372. && !hasOwnProperty.call(obj, "constructor")
  373. && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
  374. return false;
  375. }
  376. // Own properties are enumerated firstly, so to speed up,
  377. // if last one is own, then all properties are own.
  378. var key;
  379. for ( key in obj ) {}
  380. return key === undefined || hasOwnProperty.call( obj, key );
  381. },
  382. isEmptyObject: function( obj ) {
  383. for ( var name in obj ) {
  384. return false;
  385. }
  386. return true;
  387. },
  388. error: function( msg ) {
  389. throw msg;
  390. },
  391. parseJSON: function( data ) {
  392. if ( typeof data !== "string" || !data ) {
  393. return null;
  394. }
  395. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  396. data = jQuery.trim( data );
  397. // Make sure the incoming data is actual JSON
  398. // Logic borrowed from http://json.org/json2.js
  399. if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
  400. .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
  401. .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
  402. // Try to use the native JSON parser first
  403. return window.JSON && window.JSON.parse ?
  404. window.JSON.parse( data ) :
  405. (new Function("return " + data))();
  406. } else {
  407. jQuery.error( "Invalid JSON: " + data );
  408. }
  409. },
  410. noop: function() {},
  411. // Evaluates a script in a global context
  412. globalEval: function( data ) {
  413. if ( data && rnotwhite.test(data) ) {
  414. // Inspired by code by Andrea Giammarchi
  415. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  416. var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement,
  417. script = document.createElement("script");
  418. if ( jQuery.support.scriptEval ) {
  419. script.appendChild( document.createTextNode( data ) );
  420. } else {
  421. script.text = data;
  422. }
  423. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  424. // This arises when a base node is used (#2709).
  425. head.insertBefore( script, head.firstChild );
  426. head.removeChild( script );
  427. }
  428. },
  429. nodeName: function( elem, name ) {
  430. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  431. },
  432. // args is for internal usage only
  433. each: function( object, callback, args ) {
  434. var name, i = 0,
  435. length = object.length,
  436. isObj = length === undefined || jQuery.isFunction(object);
  437. if ( args ) {
  438. if ( isObj ) {
  439. for ( name in object ) {
  440. if ( callback.apply( object[ name ], args ) === false ) {
  441. break;
  442. }
  443. }
  444. } else {
  445. for ( ; i < length; ) {
  446. if ( callback.apply( object[ i++ ], args ) === false ) {
  447. break;
  448. }
  449. }
  450. }
  451. // A special, fast, case for the most common use of each
  452. } else {
  453. if ( isObj ) {
  454. for ( name in object ) {
  455. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  456. break;
  457. }
  458. }
  459. } else {
  460. for ( var value = object[0];
  461. i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
  462. }
  463. }
  464. return object;
  465. },
  466. trim: function( text ) {
  467. return (text || "").replace( rtrim, "" );
  468. },
  469. // results is for internal usage only
  470. makeArray: function( array, results ) {
  471. var ret = results || [];
  472. if ( array != null ) {
  473. // The window, strings (and functions) also have 'length'
  474. // The extra typeof function check is to prevent crashes
  475. // in Safari 2 (See: #3039)
  476. if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) {
  477. push.call( ret, array );
  478. } else {
  479. jQuery.merge( ret, array );
  480. }
  481. }
  482. return ret;
  483. },
  484. inArray: function( elem, array ) {
  485. if ( array.indexOf ) {
  486. return array.indexOf( elem );
  487. }
  488. for ( var i = 0, length = array.length; i < length; i++ ) {
  489. if ( array[ i ] === elem ) {
  490. return i;
  491. }
  492. }
  493. return -1;
  494. },
  495. merge: function( first, second ) {
  496. var i = first.length, j = 0;
  497. if ( typeof second.length === "number" ) {
  498. for ( var l = second.length; j < l; j++ ) {
  499. first[ i++ ] = second[ j ];
  500. }
  501. } else {
  502. while ( second[j] !== undefined ) {
  503. first[ i++ ] = second[ j++ ];
  504. }
  505. }
  506. first.length = i;
  507. return first;
  508. },
  509. grep: function( elems, callback, inv ) {
  510. var ret = [];
  511. // Go through the array, only saving the items
  512. // that pass the validator function
  513. for ( var i = 0, length = elems.length; i < length; i++ ) {
  514. if ( !inv !== !callback( elems[ i ], i ) ) {
  515. ret.push( elems[ i ] );
  516. }
  517. }
  518. return ret;
  519. },
  520. // arg is for internal usage only
  521. map: function( elems, callback, arg ) {
  522. var ret = [], value;
  523. // Go through the array, translating each of the items to their
  524. // new value (or values).
  525. for ( var i = 0, length = elems.length; i < length; i++ ) {
  526. value = callback( elems[ i ], i, arg );
  527. if ( value != null ) {
  528. ret[ ret.length ] = value;
  529. }
  530. }
  531. return ret.concat.apply( [], ret );
  532. },
  533. // A global GUID counter for objects
  534. guid: 1,
  535. proxy: function( fn, proxy, thisObject ) {
  536. if ( arguments.length === 2 ) {
  537. if ( typeof proxy === "string" ) {
  538. thisObject = fn;
  539. fn = thisObject[ proxy ];
  540. proxy = undefined;
  541. } else if ( proxy && !jQuery.isFunction( proxy ) ) {
  542. thisObject = proxy;
  543. proxy = undefined;
  544. }
  545. }
  546. if ( !proxy && fn ) {
  547. proxy = function() {
  548. return fn.apply( thisObject || this, arguments );
  549. };
  550. }
  551. // Set the guid of unique handler to the same of original handler, so it can be removed
  552. if ( fn ) {
  553. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  554. }
  555. // So proxy can be declared as an argument
  556. return proxy;
  557. },
  558. // Use of jQuery.browser is frowned upon.
  559. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  560. uaMatch: function( ua ) {
  561. ua = ua.toLowerCase();
  562. var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
  563. /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
  564. /(msie) ([\w.]+)/.exec( ua ) ||
  565. !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
  566. [];
  567. return { browser: match[1] || "", version: match[2] || "0" };
  568. },
  569. browser: {}
  570. });
  571. browserMatch = jQuery.uaMatch( userAgent );
  572. if ( browserMatch.browser ) {
  573. jQuery.browser[ browserMatch.browser ] = true;
  574. jQuery.browser.version = browserMatch.version;
  575. }
  576. // Deprecated, use jQuery.browser.webkit instead
  577. if ( jQuery.browser.webkit ) {
  578. jQuery.browser.safari = true;
  579. }
  580. if ( indexOf ) {
  581. jQuery.inArray = function( elem, array ) {
  582. return indexOf.call( array, elem );
  583. };
  584. }
  585. // All jQuery objects should point back to these
  586. rootjQuery = jQuery(document);
  587. // Cleanup functions for the document ready method
  588. if ( document.addEventListener ) {
  589. DOMContentLoaded = function() {
  590. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  591. jQuery.ready();
  592. };
  593. } else if ( document.attachEvent ) {
  594. DOMContentLoaded = function() {
  595. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  596. if ( document.readyState === "complete" ) {
  597. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  598. jQuery.ready();
  599. }
  600. };
  601. }
  602. // The DOM ready check for Internet Explorer
  603. function doScrollCheck() {
  604. if ( jQuery.isReady ) {
  605. return;
  606. }
  607. try {
  608. // If IE is used, use the trick by Diego Perini
  609. // http://javascript.nwbox.com/IEContentLoaded/
  610. document.documentElement.doScroll("left");
  611. } catch( error ) {
  612. setTimeout( doScrollCheck, 1 );
  613. return;
  614. }
  615. // and execute any waiting functions
  616. jQuery.ready();
  617. }
  618. function evalScript( i, elem ) {
  619. if ( elem.src ) {
  620. jQuery.ajax({
  621. url: elem.src,
  622. async: false,
  623. dataType: "script"
  624. });
  625. } else {
  626. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  627. }
  628. if ( elem.parentNode ) {
  629. elem.parentNode.removeChild( elem );
  630. }
  631. }
  632. // Mutifunctional method to get and set values to a collection
  633. // The value/s can be optionally by executed if its a function
  634. function access( elems, key, value, exec, fn, pass ) {
  635. var length = elems.length;
  636. // Setting many attributes
  637. if ( typeof key === "object" ) {
  638. for ( var k in key ) {
  639. access( elems, k, key[k], exec, fn, value );
  640. }
  641. return elems;
  642. }
  643. // Setting one attribute
  644. if ( value !== undefined ) {
  645. // Optionally, function values get executed if exec is true
  646. exec = !pass && exec && jQuery.isFunction(value);
  647. for ( var i = 0; i < length; i++ ) {
  648. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  649. }
  650. return elems;
  651. }
  652. // Getting an attribute
  653. return length ? fn( elems[0], key ) : undefined;
  654. }
  655. function now() {
  656. return (new Date).getTime();
  657. }
  658. (function() {
  659. jQuery.support = {};
  660. var root = document.documentElement,
  661. script = document.createElement("script"),
  662. div = document.createElement("div"),
  663. id = "script" + now();
  664. div.style.display = "none";
  665. div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  666. var all = div.getElementsByTagName("*"),
  667. a = div.getElementsByTagName("a")[0];
  668. // Can't get basic test support
  669. if ( !all || !all.length || !a ) {
  670. return;
  671. }
  672. jQuery.support = {
  673. // IE strips leading whitespace when .innerHTML is used
  674. leadingWhitespace: div.firstChild.nodeType === 3,
  675. // Make sure that tbody elements aren't automatically inserted
  676. // IE will insert them into empty tables
  677. tbody: !div.getElementsByTagName("tbody").length,
  678. // Make sure that link elements get serialized correctly by innerHTML
  679. // This requires a wrapper element in IE
  680. htmlSerialize: !!div.getElementsByTagName("link").length,
  681. // Get the style information from getAttribute
  682. // (IE uses .cssText insted)
  683. style: /red/.test( a.getAttribute("style") ),
  684. // Make sure that URLs aren't manipulated
  685. // (IE normalizes it by default)
  686. hrefNormalized: a.getAttribute("href") === "/a",
  687. // Make sure that element opacity exists
  688. // (IE uses filter instead)
  689. // Use a regex to work around a WebKit issue. See #5145
  690. opacity: /^0.55$/.test( a.style.opacity ),
  691. // Verify style float existence
  692. // (IE uses styleFloat instead of cssFloat)
  693. cssFloat: !!a.style.cssFloat,
  694. // Make sure that if no value is specified for a checkbox
  695. // that it defaults to "on".
  696. // (WebKit defaults to "" instead)
  697. checkOn: div.getElementsByTagName("input")[0].value === "on",
  698. // Make sure that a selected-by-default option has a working selected property.
  699. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  700. optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
  701. parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
  702. // Will be defined later
  703. deleteExpando: true,
  704. checkClone: false,
  705. scriptEval: false,
  706. noCloneEvent: true,
  707. boxModel: null
  708. };
  709. script.type = "text/javascript";
  710. try {
  711. script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
  712. } catch(e) {}
  713. root.insertBefore( script, root.firstChild );
  714. // Make sure that the execution of code works by injecting a script
  715. // tag with appendChild/createTextNode
  716. // (IE doesn't support this, fails, and uses .text instead)
  717. if ( window[ id ] ) {
  718. jQuery.support.scriptEval = true;
  719. delete window[ id ];
  720. }
  721. // Test to see if it's possible to delete an expando from an element
  722. // Fails in Internet Explorer
  723. try {
  724. delete script.test;
  725. } catch(e) {
  726. jQuery.support.deleteExpando = false;
  727. }
  728. root.removeChild( script );
  729. if ( div.attachEvent && div.fireEvent ) {
  730. div.attachEvent("onclick", function click() {
  731. // Cloning a node shouldn't copy over any
  732. // bound event handlers (IE does this)
  733. jQuery.support.noCloneEvent = false;
  734. div.detachEvent("onclick", click);
  735. });
  736. div.cloneNode(true).fireEvent("onclick");
  737. }
  738. div = document.createElement("div");
  739. div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
  740. var fragment = document.createDocumentFragment();
  741. fragment.appendChild( div.firstChild );
  742. // WebKit doesn't clone checked state correctly in fragments
  743. jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
  744. // Figure out if the W3C box model works as expected
  745. // document.body must exist before we can do this
  746. jQuery(function() {
  747. var div = document.createElement("div");
  748. div.style.width = div.style.paddingLeft = "1px";
  749. document.body.appendChild( div );
  750. jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
  751. document.body.removeChild( div ).style.display = 'none';
  752. div = null;
  753. });
  754. // Technique from Juriy Zaytsev
  755. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  756. var eventSupported = function( eventName ) {
  757. var el = document.createElement("div");
  758. eventName = "on" + eventName;
  759. var isSupported = (eventName in el);
  760. if ( !isSupported ) {
  761. el.setAttribute(eventName, "return;");
  762. isSupported = typeof el[eventName] === "function";
  763. }
  764. el = null;
  765. return isSupported;
  766. };
  767. jQuery.support.submitBubbles = eventSupported("submit");
  768. jQuery.support.changeBubbles = eventSupported("change");
  769. // release memory in IE
  770. root = script = div = all = a = null;
  771. })();
  772. jQuery.props = {
  773. "for": "htmlFor",
  774. "class": "className",
  775. readonly: "readOnly",
  776. maxlength: "maxLength",
  777. cellspacing: "cellSpacing",
  778. rowspan: "rowSpan",
  779. colspan: "colSpan",
  780. tabindex: "tabIndex",
  781. usemap: "useMap",
  782. frameborder: "frameBorder"
  783. };
  784. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  785. jQuery.extend({
  786. cache: {},
  787. expando:expando,
  788. // The following elements throw uncatchable exceptions if you
  789. // attempt to add expando properties to them.
  790. noData: {
  791. "embed": true,
  792. "object": true,
  793. "applet": true
  794. },
  795. data: function( elem, name, data ) {
  796. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  797. return;
  798. }
  799. elem = elem == window ?
  800. windowData :
  801. elem;
  802. var id = elem[ expando ], cache = jQuery.cache, thisCache;
  803. if ( !id && typeof name === "string" && data === undefined ) {
  804. return null;
  805. }
  806. // Compute a unique ID for the element
  807. if ( !id ) {
  808. id = ++uuid;
  809. }
  810. // Avoid generating a new cache unless none exists and we
  811. // want to manipulate it.
  812. if ( typeof name === "object" ) {
  813. elem[ expando ] = id;
  814. thisCache = cache[ id ] = jQuery.extend(true, {}, name);
  815. } else if ( !cache[ id ] ) {
  816. elem[ expando ] = id;
  817. cache[ id ] = {};
  818. }
  819. thisCache = cache[ id ];
  820. // Prevent overriding the named cache with undefined values
  821. if ( data !== undefined ) {
  822. thisCache[ name ] = data;
  823. }
  824. return typeof name === "string" ? thisCache[ name ] : thisCache;
  825. },
  826. removeData: function( elem, name ) {
  827. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  828. return;
  829. }
  830. elem = elem == window ?
  831. windowData :
  832. elem;
  833. var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ];
  834. // If we want to remove a specific section of the element's data
  835. if ( name ) {
  836. if ( thisCache ) {
  837. // Remove the section of cache data
  838. delete thisCache[ name ];
  839. // If we've removed all the data, remove the element's cache
  840. if ( jQuery.isEmptyObject(thisCache) ) {
  841. jQuery.removeData( elem );
  842. }
  843. }
  844. // Otherwise, we want to remove all of the element's data
  845. } else {
  846. if ( jQuery.support.deleteExpando ) {
  847. delete elem[ jQuery.expando ];
  848. } else if ( elem.removeAttribute ) {
  849. elem.removeAttribute( jQuery.expando );
  850. }
  851. // Completely remove the data cache
  852. delete cache[ id ];
  853. }
  854. }
  855. });
  856. jQuery.fn.extend({
  857. data: function( key, value ) {
  858. if ( typeof key === "undefined" && this.length ) {
  859. return jQuery.data( this[0] );
  860. } else if ( typeof key === "object" ) {
  861. return this.each(function() {
  862. jQuery.data( this, key );
  863. });
  864. }
  865. var parts = key.split(".");
  866. parts[1] = parts[1] ? "." + parts[1] : "";
  867. if ( value === undefined ) {
  868. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  869. if ( data === undefined && this.length ) {
  870. data = jQuery.data( this[0], key );
  871. }
  872. return data === undefined && parts[1] ?
  873. this.data( parts[0] ) :
  874. data;
  875. } else {
  876. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
  877. jQuery.data( this, key, value );
  878. });
  879. }
  880. },
  881. removeData: function( key ) {
  882. return this.each(function() {
  883. jQuery.removeData( this, key );
  884. });
  885. }
  886. });
  887. jQuery.extend({
  888. queue: function( elem, type, data ) {
  889. if ( !elem ) {
  890. return;
  891. }
  892. type = (type || "fx") + "queue";
  893. var q = jQuery.data( elem, type );
  894. // Speed up dequeue by getting out quickly if this is just a lookup
  895. if ( !data ) {
  896. return q || [];
  897. }
  898. if ( !q || jQuery.isArray(data) ) {
  899. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  900. } else {
  901. q.push( data );
  902. }
  903. return q;
  904. },
  905. dequeue: function( elem, type ) {
  906. type = type || "fx";
  907. var queue = jQuery.queue( elem, type ), fn = queue.shift();
  908. // If the fx queue is dequeued, always remove the progress sentinel
  909. if ( fn === "inprogress" ) {
  910. fn = queue.shift();
  911. }
  912. if ( fn ) {
  913. // Add a progress sentinel to prevent the fx queue from being
  914. // automatically dequeued
  915. if ( type === "fx" ) {
  916. queue.unshift("inprogress");
  917. }
  918. fn.call(elem, function() {
  919. jQuery.dequeue(elem, type);
  920. });
  921. }
  922. }
  923. });
  924. jQuery.fn.extend({
  925. queue: function( type, data ) {
  926. if ( typeof type !== "string" ) {
  927. data = type;
  928. type = "fx";
  929. }
  930. if ( data === undefined ) {
  931. return jQuery.queue( this[0], type );
  932. }
  933. return this.each(function( i, elem ) {
  934. var queue = jQuery.queue( this, type, data );
  935. if ( type === "fx" && queue[0] !== "inprogress" ) {
  936. jQuery.dequeue( this, type );
  937. }
  938. });
  939. },
  940. dequeue: function( type ) {
  941. return this.each(function() {
  942. jQuery.dequeue( this, type );
  943. });
  944. },
  945. // Based off of the plugin by Clint Helfers, with permission.
  946. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  947. delay: function( time, type ) {
  948. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  949. type = type || "fx";
  950. return this.queue( type, function() {
  951. var elem = this;
  952. setTimeout(function() {
  953. jQuery.dequeue( elem, type );
  954. }, time );
  955. });
  956. },
  957. clearQueue: function( type ) {
  958. return this.queue( type || "fx", [] );
  959. }
  960. });
  961. var rclass = /[\n\t]/g,
  962. rspace = /\s+/,
  963. rreturn = /\r/g,
  964. rspecialurl = /href|src|style/,
  965. rtype = /(button|input)/i,
  966. rfocusable = /(button|input|object|select|textarea)/i,
  967. rclickable = /^(a|area)$/i,
  968. rradiocheck = /radio|checkbox/;
  969. jQuery.fn.extend({
  970. attr: function( name, value ) {
  971. return access( this, name, value, true, jQuery.attr );
  972. },
  973. removeAttr: function( name, fn ) {
  974. return this.each(function(){
  975. jQuery.attr( this, name, "" );
  976. if ( this.nodeType === 1 ) {
  977. this.removeAttribute( name );
  978. }
  979. });
  980. },
  981. addClass: function( value ) {
  982. if ( jQuery.isFunction(value) ) {
  983. return this.each(function(i) {
  984. var self = jQuery(this);
  985. self.addClass( value.call(this, i, self.attr("class")) );
  986. });
  987. }
  988. if ( value && typeof value === "string" ) {
  989. var classNames = (value || "").split( rspace );
  990. for ( var i = 0, l = this.length; i < l; i++ ) {
  991. var elem = this[i];
  992. if ( elem.nodeType === 1 ) {
  993. if ( !elem.className ) {
  994. elem.className = value;
  995. } else {
  996. var className = " " + elem.className + " ", setClass = elem.className;
  997. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  998. if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
  999. setClass += " " + classNames[c];
  1000. }
  1001. }
  1002. elem.className = jQuery.trim( setClass );
  1003. }
  1004. }
  1005. }
  1006. }
  1007. return this;
  1008. },
  1009. removeClass: function( value ) {
  1010. if ( jQuery.isFunction(value) ) {
  1011. return this.each(function(i) {
  1012. var self = jQuery(this);
  1013. self.removeClass( value.call(this, i, self.attr("class")) );
  1014. });
  1015. }
  1016. if ( (value && typeof value === "string") || value === undefined ) {
  1017. var classNames = (value || "").split(rspace);
  1018. for ( var i = 0, l = this.length; i < l; i++ ) {
  1019. var elem = this[i];
  1020. if ( elem.nodeType === 1 && elem.className ) {
  1021. if ( value ) {
  1022. var className = (" " + elem.className + " ").replace(rclass, " ");
  1023. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1024. className = className.replace(" " + classNames[c] + " ", " ");
  1025. }
  1026. elem.className = jQuery.trim( className );
  1027. } else {
  1028. elem.className = "";
  1029. }
  1030. }
  1031. }
  1032. }
  1033. return this;
  1034. },
  1035. toggleClass: function( value, stateVal ) {
  1036. var type = typeof value, isBool = typeof stateVal === "boolean";
  1037. if ( jQuery.isFunction( value ) ) {
  1038. return this.each(function(i) {
  1039. var self = jQuery(this);
  1040. self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
  1041. });
  1042. }
  1043. return this.each(function() {
  1044. if ( type === "string" ) {
  1045. // toggle individual class names
  1046. var className, i = 0, self = jQuery(this),
  1047. state = stateVal,
  1048. classNames = value.split( rspace );
  1049. while ( (className = classNames[ i++ ]) ) {
  1050. // check each className given, space separated list
  1051. state = isBool ? state : !self.hasClass( className );
  1052. self[ state ? "addClass" : "removeClass" ]( className );
  1053. }
  1054. } else if ( type === "undefined" || type === "boolean" ) {
  1055. if ( this.className ) {
  1056. // store className if set
  1057. jQuery.data( this, "__className__", this.className );
  1058. }
  1059. // toggle whole className
  1060. this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
  1061. }
  1062. });
  1063. },
  1064. hasClass: function( selector ) {
  1065. var className = " " + selector + " ";
  1066. for ( var i = 0, l = this.length; i < l; i++ ) {
  1067. if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
  1068. return true;
  1069. }
  1070. }
  1071. return false;
  1072. },
  1073. val: function( value ) {
  1074. if ( value === undefined ) {
  1075. var elem = this[0];
  1076. if ( elem ) {
  1077. if ( jQuery.nodeName( elem, "option" ) ) {
  1078. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  1079. }
  1080. // We need to handle select boxes special
  1081. if ( jQuery.nodeName( elem, "select" ) ) {
  1082. var index = elem.selectedIndex,
  1083. values = [],
  1084. options = elem.options,
  1085. one = elem.type === "select-one";
  1086. // Nothing was selected
  1087. if ( index < 0 ) {
  1088. return null;
  1089. }
  1090. // Loop through all the selected options
  1091. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  1092. var option = options[ i ];
  1093. if ( option.selected ) {
  1094. // Get the specific value for the option
  1095. value = jQuery(option).val();
  1096. // We don't need an array for one selects
  1097. if ( one ) {
  1098. return value;
  1099. }
  1100. // Multi-Selects return an array
  1101. values.push( value );
  1102. }
  1103. }
  1104. return values;
  1105. }
  1106. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  1107. if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
  1108. return elem.getAttribute("value") === null ? "on" : elem.value;
  1109. }
  1110. // Everything else, we just grab the value
  1111. return (elem.value || "").replace(rreturn, "");
  1112. }
  1113. return undefined;
  1114. }
  1115. var isFunction = jQuery.isFunction(value);
  1116. return this.each(function(i) {
  1117. var self = jQuery(this), val = value;
  1118. if ( this.nodeType !== 1 ) {
  1119. return;
  1120. }
  1121. if ( isFunction ) {
  1122. val = value.call(this, i, self.val());
  1123. }
  1124. // Typecast each time if the value is a Function and the appended
  1125. // value is therefore different each time.
  1126. if ( typeof val === "number" ) {
  1127. val += "";
  1128. }
  1129. if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
  1130. this.checked = jQuery.inArray( self.val(), val ) >= 0;
  1131. } else if ( jQuery.nodeName( this, "select" ) ) {
  1132. var values = jQuery.makeArray(val);
  1133. jQuery( "option", this ).each(function() {
  1134. this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
  1135. });
  1136. if ( !values.length ) {
  1137. this.selectedIndex = -1;
  1138. }
  1139. } else {
  1140. this.value = val;
  1141. }
  1142. });
  1143. }
  1144. });
  1145. jQuery.extend({
  1146. attrFn: {
  1147. val: true,
  1148. css: true,
  1149. html: true,
  1150. text: true,
  1151. data: true,
  1152. width: true,
  1153. height: true,
  1154. offset: true
  1155. },
  1156. attr: function( elem, name, value, pass ) {
  1157. // don't set attributes on text and comment nodes
  1158. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1159. return undefined;
  1160. }
  1161. if ( pass && name in jQuery.attrFn ) {
  1162. return jQuery(elem)[name](value);
  1163. }
  1164. var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
  1165. // Whether we are setting (or getting)
  1166. set = value !== undefined;
  1167. // Try to normalize/fix the name
  1168. name = notxml && jQuery.props[ name ] || name;
  1169. // Only do all the following if this is a node (faster for style)
  1170. if ( elem.nodeType === 1 ) {
  1171. // These attributes require special treatment
  1172. var special = rspecialurl.test( name );
  1173. // Safari mis-reports the default selected property of an option
  1174. // Accessing the parent's selectedIndex property fixes it
  1175. if ( name === "selected" && !jQuery.support.optSelected ) {
  1176. var parent = elem.parentNode;
  1177. if ( parent ) {
  1178. parent.selectedIndex;
  1179. // Make sure that it also works with optgroups, see #5701
  1180. if ( parent.parentNode ) {
  1181. parent.parentNode.selectedIndex;
  1182. }
  1183. }
  1184. }
  1185. // If applicable, access the attribute via the DOM 0 way
  1186. if ( name in elem && notxml && !special ) {
  1187. if ( set ) {
  1188. // We can't allow the type property to be changed (since it causes problems in IE)
  1189. if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
  1190. jQuery.error( "type property can't be changed" );
  1191. }
  1192. elem[ name ] = value;
  1193. }
  1194. // browsers index elements by id/name on forms, give priority to attributes.
  1195. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
  1196. return elem.getAttributeNode( name ).nodeValue;
  1197. }
  1198. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1199. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1200. if ( name === "tabIndex" ) {
  1201. var attributeNode = elem.getAttributeNode( "tabIndex" );
  1202. return attributeNode && attributeNode.specified ?
  1203. attributeNode.value :
  1204. rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
  1205. 0 :
  1206. undefined;
  1207. }
  1208. return elem[ name ];
  1209. }
  1210. if ( !jQuery.support.style && notxml && name === "style" ) {
  1211. if ( set ) {
  1212. elem.style.cssText = "" + value;
  1213. }
  1214. return elem.style.cssText;
  1215. }
  1216. if ( set ) {
  1217. // convert the value to a string (all browsers do this but IE) see #1070
  1218. elem.setAttribute( name, "" + value );
  1219. }
  1220. var attr = !jQuery.support.hrefNormalized && notxml && special ?
  1221. // Some attributes require a special call on IE
  1222. elem.getAttribute( name, 2 ) :
  1223. elem.getAttribute( name );
  1224. // Non-existent attributes return null, we normalize to undefined
  1225. return attr === null ? undefined : attr;
  1226. }
  1227. // elem is actually elem.style ... set the style
  1228. // Using attr for specific style information is now deprecated. Use style instead.
  1229. return jQuery.style( elem, name, value );
  1230. }
  1231. });
  1232. var rnamespaces = /\.(.*)$/,
  1233. fcleanup = function( nm ) {
  1234. return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
  1235. return "\\" + ch;
  1236. });
  1237. };
  1238. /*
  1239. * A number of helper functions used for managing events.
  1240. * Many of the ideas behind this code originated from
  1241. * Dean Edwards' addEvent library.
  1242. */
  1243. jQuery.event = {
  1244. // Bind an event to an element
  1245. // Original by Dean Edwards
  1246. add: function( elem, types, handler, data ) {
  1247. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1248. return;
  1249. }
  1250. // For whatever reason, IE has trouble passing the window object
  1251. // around, causing it to be cloned in the process
  1252. if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) {
  1253. elem = window;
  1254. }
  1255. var handleObjIn, handleObj;
  1256. if ( handler.handler ) {
  1257. handleObjIn = handler;
  1258. handler = handleObjIn.handler;
  1259. }
  1260. // Make sure that the function being executed has a unique ID
  1261. if ( !handler.guid ) {
  1262. handler.guid = jQuery.guid++;
  1263. }
  1264. // Init the element's event structure
  1265. var elemData = jQuery.data( elem );
  1266. // If no elemData is found then we must be trying to bind to one of the
  1267. // banned noData elements
  1268. if ( !elemData ) {
  1269. return;
  1270. }
  1271. var events = elemData.events = elemData.events || {},
  1272. eventHandle = elemData.handle, eventHandle;
  1273. if ( !eventHandle ) {
  1274. elemData.handle = eventHandle = function() {
  1275. // Handle the second event of a trigger and when
  1276. // an event is called after a page has unloaded
  1277. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  1278. jQuery.event.handle.apply( eventHandle.elem, arguments ) :
  1279. undefined;
  1280. };
  1281. }
  1282. // Add elem as a property of the handle function
  1283. // This is to prevent a memory leak with non-native events in IE.
  1284. eventHandle.elem = elem;
  1285. // Handle multiple events separated by a space
  1286. // jQuery(...).bind("mouseover mouseout", fn);
  1287. types = types.split(" ");
  1288. var type, i = 0, namespaces;
  1289. while ( (type = types[ i++ ]) ) {
  1290. handleObj = handleObjIn ?
  1291. jQuery.extend({}, handleObjIn) :
  1292. { handler: handler, data: data };
  1293. // Namespaced event handlers
  1294. if ( type.indexOf(".") > -1 ) {
  1295. namespaces = type.split(".");
  1296. type = namespaces.shift();
  1297. handleObj.namespace = namespaces.slice(0).sort().join(".");
  1298. } else {
  1299. namespaces = [];
  1300. handleObj.namespace = "";
  1301. }
  1302. handleObj.type = type;
  1303. handleObj.guid = handler.guid;
  1304. // Get the current list of functions bound to this event
  1305. var handlers = events[ type ],
  1306. special = jQuery.event.special[ type ] || {};
  1307. // Init the event handler queue
  1308. if ( !handlers ) {
  1309. handlers = events[ type ] = [];
  1310. // Check for a special event handler
  1311. // Only use addEventListener/attachEvent if the special
  1312. // events handler returns false
  1313. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  1314. // Bind the global event handler to the element
  1315. if ( elem.addEventListener ) {
  1316. elem.addEventListener( type, eventHandle, false );
  1317. } else if ( elem.attachEvent ) {
  1318. elem.attachEvent( "on" + type, eventHandle );
  1319. }
  1320. }
  1321. }
  1322. if ( special.add ) {
  1323. special.add.call( elem, handleObj );
  1324. if ( !handleObj.handler.guid ) {
  1325. handleObj.handler.guid = handler.guid;
  1326. }
  1327. }
  1328. // Add the function to the element's handler list
  1329. handlers.push( handleObj );
  1330. // Keep track of which events have been used, for global triggering
  1331. jQuery.event.global[ type ] = true;
  1332. }
  1333. // Nullify elem to prevent memory leaks in IE
  1334. elem = null;
  1335. },
  1336. global: {},
  1337. // Detach an event or set of events from an element
  1338. remove: function( elem, types, handler, pos ) {
  1339. // don't do events on text and comment nodes
  1340. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1341. return;
  1342. }
  1343. var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
  1344. elemData = jQuery.data( elem ),
  1345. events = elemData && elemData.events;
  1346. if ( !elemData || !events ) {
  1347. return;
  1348. }
  1349. // types is actually an event object here
  1350. if ( types && types.type ) {
  1351. handler = types.handler;
  1352. types = types.type;
  1353. }
  1354. // Unbind all events for the element
  1355. if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
  1356. types = types || "";
  1357. for ( type in events ) {
  1358. jQuery.event.remove( elem, type + types );
  1359. }
  1360. return;
  1361. }
  1362. // Handle multiple events separated by a space
  1363. // jQuery(...).unbind("mouseover mouseout", fn);
  1364. types = types.split(" ");
  1365. while ( (type = types[ i++ ]) ) {
  1366. origType = type;
  1367. handleObj = null;
  1368. all = type.indexOf(".") < 0;
  1369. namespaces = [];
  1370. if ( !all ) {
  1371. // Namespaced event handlers
  1372. namespaces = type.split(".");
  1373. type = namespaces.shift();
  1374. namespace = new RegExp("(^|\\.)" +
  1375. jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
  1376. }
  1377. eventType = events[ type ];
  1378. if ( !eventType ) {
  1379. continue;
  1380. }
  1381. if ( !handler ) {
  1382. for ( var j = 0; j < eventType.length; j++ ) {
  1383. handleObj = eventType[ j ];
  1384. if ( all || namespace.test( handleObj.namespace ) ) {
  1385. jQuery.event.remove( elem, origType, handleObj.handler, j );
  1386. eventType.splice( j--, 1 );
  1387. }
  1388. }
  1389. continue;
  1390. }
  1391. special = jQuery.event.special[ type ] || {};
  1392. for ( var j = pos || 0; j < eventType.length; j++ ) {
  1393. handleObj = eventType[ j ];
  1394. if ( handler.guid === handleObj.guid ) {
  1395. // remove the given handler for the given type
  1396. if ( all || namespace.test( handleObj.namespace ) ) {
  1397. if ( pos == null ) {
  1398. eventType.splice( j--, 1 );
  1399. }
  1400. if ( special.remove ) {
  1401. special.remove.call( elem, handleObj );
  1402. }
  1403. }
  1404. if ( pos != null ) {
  1405. break;
  1406. }
  1407. }
  1408. }
  1409. // remove generic event handler if no more handlers exist
  1410. if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
  1411. if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
  1412. removeEvent( elem, type, elemData.handle );
  1413. }
  1414. ret = null;
  1415. delete events[ type ];
  1416. }
  1417. }
  1418. // Remove the expando if it's no longer used
  1419. if ( jQuery.isEmptyObject( events ) ) {
  1420. var handle = elemData.handle;
  1421. if ( handle ) {
  1422. handle.elem = null;
  1423. }
  1424. delete elemData.events;
  1425. delete elemData.handle;
  1426. if ( jQuery.isEmptyObject( elemData ) ) {
  1427. jQuery.removeData( elem );
  1428. }
  1429. }
  1430. },
  1431. // bubbling is internal
  1432. trigger: function( event, data, elem /*, bubbling */ ) {
  1433. // Event object or event type
  1434. var type = event.type || event,
  1435. bubbling = arguments[3];
  1436. if ( !bubbling ) {
  1437. event = typeof event === "object" ?
  1438. // jQuery.Event object
  1439. event[expando] ? event :
  1440. // Object literal
  1441. jQuery.extend( jQuery.Event(type), event ) :
  1442. // Just the event type (string)
  1443. jQuery.Event(type);
  1444. if ( type.indexOf("!") >= 0 ) {
  1445. event.type = type = type.slice(0, -1);
  1446. event.exclusive = true;
  1447. }
  1448. // Handle a global trigger
  1449. if ( !elem ) {
  1450. // Don't bubble custom events when global (to avoid too much overhead)
  1451. event.stopPropagation();
  1452. // Only trigger if we've ever bound an event for it
  1453. if ( jQuery.event.global[ type ] ) {
  1454. jQuery.each( jQuery.cache, function() {
  1455. if ( this.events && this.events[type] ) {
  1456. jQuery.event.trigger( event, data, this.handle.elem );
  1457. }
  1458. });
  1459. }
  1460. }
  1461. // Handle triggering a single element
  1462. // don't do events on text and comment nodes
  1463. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1464. return undefined;
  1465. }
  1466. // Clean up in case it is reused
  1467. event.result = undefined;
  1468. event.target = elem;
  1469. // Clone the incoming data, if any
  1470. data = jQuery.makeArray( data );
  1471. data.unshift( event );
  1472. }
  1473. event.currentTarget = elem;
  1474. // Trigger the event, it is assumed that "handle" is a function
  1475. var handle = jQuery.data( elem, "handle" );
  1476. if ( handle ) {
  1477. handle.apply( elem, data );
  1478. }
  1479. var parent = elem.parentNode || elem.ownerDocument;
  1480. // Trigger an inline bound script
  1481. try {
  1482. if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
  1483. if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
  1484. event.result = false;
  1485. }
  1486. }
  1487. // prevent IE from throwing an error for some elements with some event types, see #3533
  1488. } catch (e) {}
  1489. if ( !event.isPropagationStopped() && parent ) {
  1490. jQuery.event.trigger( event, data, parent, true );
  1491. } else if ( !event.isDefaultPrevented() ) {
  1492. var target = event.target, old,
  1493. isClick = jQuery.nodeName(target, "a") && type === "click",
  1494. special = jQuery.event.special[ type ] || {};
  1495. if ( (!special._default || special._default.call( elem, event ) === false) &&
  1496. !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
  1497. try {
  1498. if ( target[ type ] ) {
  1499. // Make sure that we don't accidentally re-trigger the onFOO events
  1500. old = target[ "on" + type ];
  1501. if ( old ) {
  1502. target[ "on" + type ] = null;
  1503. }
  1504. jQuery.event.triggered = true;
  1505. target[ type ]();
  1506. }
  1507. // prevent IE from throwing an error for some elements with some event types, see #3533
  1508. } catch (e) {}
  1509. if ( old ) {
  1510. target[ "on" + type ] = old;
  1511. }
  1512. jQuery.event.triggered = false;
  1513. }
  1514. }
  1515. },
  1516. handle: function( event ) {
  1517. var all, handlers, namespaces, namespace, events;
  1518. event = arguments[0] = jQuery.event.fix( event || window.event );
  1519. event.currentTarget = this;
  1520. // Namespaced event handlers
  1521. all = event.type.indexOf(".") < 0 && !event.exclusive;
  1522. if ( !all ) {
  1523. namespaces = event.type.split(".");
  1524. event.type = namespaces.shift();
  1525. namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
  1526. }
  1527. var events = jQuery.data(this, "events"), handlers = events[ event.type ];
  1528. if ( events && handlers ) {
  1529. // Clone the handlers to prevent manipulation
  1530. handlers = handlers.slice(0);
  1531. for ( var j = 0, l = handlers.length; j < l; j++ ) {
  1532. var handleObj = handlers[ j ];
  1533. // Filter the functions by class
  1534. if ( all || namespace.test( handleObj.namespace ) ) {
  1535. // Pass in a reference to the handler function itself
  1536. // So that we can later remove it
  1537. event.handler = handleObj.handler;
  1538. event.data = handleObj.data;
  1539. event.handleObj = handleObj;
  1540. var ret = handleObj.handler.apply( this, arguments );
  1541. if ( ret !== undefined ) {
  1542. event.result = ret;
  1543. if ( ret === false ) {
  1544. event.preventDefault();
  1545. event.stopPropagation();
  1546. }
  1547. }
  1548. if ( event.isImmediatePropagationStopped() ) {
  1549. break;
  1550. }
  1551. }
  1552. }
  1553. }
  1554. return event.result;
  1555. },
  1556. props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
  1557. fix: function( event ) {
  1558. if ( event[ expando ] ) {
  1559. return event;
  1560. }
  1561. // store a copy of the original event object
  1562. // and "clone" to set read-only properties
  1563. var originalEvent = event;
  1564. event = jQuery.Event( originalEvent );
  1565. for ( var i = this.props.length, prop; i; ) {
  1566. prop = this.props[ --i ];
  1567. event[ prop ] = originalEvent[ prop ];
  1568. }
  1569. // Fix target property, if necessary
  1570. if ( !event.target ) {
  1571. event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
  1572. }
  1573. // check if target is a textnode (safari)
  1574. if ( event.target.nodeType === 3 ) {
  1575. event.target = event.target.parentNode;
  1576. }
  1577. // Add relatedTarget, if necessary
  1578. if ( !event.relatedTarget && event.fromElement ) {
  1579. event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
  1580. }
  1581. // Calculate pageX/Y if missing and clientX/Y available
  1582. if ( event.pageX == null && event.clientX != null ) {
  1583. var doc = document.documentElement, body = document.body;
  1584. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  1585. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  1586. }
  1587. // Add which for key events
  1588. if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) {
  1589. event.which = event.charCode || event.keyCode;
  1590. }
  1591. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  1592. if ( !event.metaKey && event.ctrlKey ) {
  1593. event.metaKey = event.ctrlKey;
  1594. }
  1595. // Add which for click: 1 === left; 2 === middle; 3 === right
  1596. // Note: button is not normalized, so don't use it
  1597. if ( !event.which && event.button !== undefined ) {
  1598. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  1599. }
  1600. return event;
  1601. },
  1602. // Deprecated, use jQuery.guid instead
  1603. guid: 1E8,
  1604. // Deprecated, use jQuery.proxy instead
  1605. proxy: jQuery.proxy,
  1606. special: {
  1607. ready: {
  1608. // Make sure the ready event is setup
  1609. setup: jQuery.bindReady,
  1610. teardown: jQuery.noop
  1611. },
  1612. live: {
  1613. add: function( handleObj ) {
  1614. jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) );
  1615. },
  1616. remove: function( handleObj ) {
  1617. var remove = true,
  1618. type = handleObj.origType.replace(rnamespaces, "");
  1619. jQuery.each( jQuery.data(this, "events").live || [], function() {
  1620. if ( type === this.origType.replace(rnamespaces, "") ) {
  1621. remove = false;
  1622. return false;
  1623. }
  1624. });
  1625. if ( remove ) {
  1626. jQuery.event.remove( this, handleObj.origType, liveHandler );
  1627. }
  1628. }
  1629. },
  1630. beforeunload: {
  1631. setup: function( data, namespaces, eventHandle ) {
  1632. // We only want to do this special case on windows
  1633. if ( this.setInterval ) {
  1634. this.onbeforeunload = eventHandle;
  1635. }
  1636. return false;
  1637. },
  1638. teardown: function( namespaces, eventHandle ) {
  1639. if ( this.onbeforeunload === eventHandle ) {
  1640. this.onbeforeunload = null;
  1641. }
  1642. }
  1643. }
  1644. }
  1645. };
  1646. var removeEvent = document.removeEventListener ?
  1647. function( elem, type, handle ) {
  1648. elem.removeEventListener( type, handle, false );
  1649. } :
  1650. function( elem, type, handle ) {
  1651. elem.detachEvent( "on" + type, handle );
  1652. };
  1653. jQuery.Event = function( src ) {
  1654. // Allow instantiation without the 'new' keyword
  1655. if ( !this.preventDefault ) {
  1656. return new jQuery.Event( src );
  1657. }
  1658. // Event object
  1659. if ( src && src.type ) {
  1660. this.originalEvent = src;
  1661. this.type = src.type;
  1662. // Event type
  1663. } else {
  1664. this.type = src;
  1665. }
  1666. // timeStamp is buggy for some events on Firefox(#3843)
  1667. // So we won't rely on the native value
  1668. this.timeStamp = now();
  1669. // Mark it as fixed
  1670. this[ expando ] = true;
  1671. };
  1672. function returnFalse() {
  1673. return false;
  1674. }
  1675. function returnTrue() {
  1676. return true;
  1677. }
  1678. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  1679. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  1680. jQuery.Event.prototype = {
  1681. preventDefault: function() {
  1682. this.isDefaultPrevented = returnTrue;
  1683. var e = this.originalEvent;
  1684. if ( !e ) {
  1685. return;
  1686. }
  1687. // if preventDefault exists run it on the original event
  1688. if ( e.preventDefault ) {
  1689. e.preventDefault();
  1690. }
  1691. // otherwise set the returnValue property of the original event to false (IE)
  1692. e.returnValue = false;
  1693. },
  1694. stopPropagation: function() {
  1695. this.isPropagationStopped = returnTrue;
  1696. var e = this.originalEvent;
  1697. if ( !e ) {
  1698. return;
  1699. }
  1700. // if stopPropagation exists run it on the original event
  1701. if ( e.stopPropagation ) {
  1702. e.stopPropagation();
  1703. }
  1704. // otherwise set the cancelBubble property of the original event to true (IE)
  1705. e.cancelBubble = true;
  1706. },
  1707. stopImmediatePropagation: function() {
  1708. this.isImmediatePropagationStopped = returnTrue;
  1709. this.stopPropagation();
  1710. },
  1711. isDefaultPrevented: returnFalse,
  1712. isPropagationStopped: returnFalse,
  1713. isImmediatePropagationStopped: returnFalse
  1714. };
  1715. // Checks if an event happened on an element within another element
  1716. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  1717. var withinElement = function( event ) {
  1718. // Check if mouse(over|out) are still within the same parent element
  1719. var parent = event.relatedTarget;
  1720. // Firefox sometimes assigns relatedTarget a XUL element
  1721. // which we cannot access the parentNode property of
  1722. try {
  1723. // Traverse up the tree
  1724. while ( parent && parent !== this ) {
  1725. parent = parent.parentNode;
  1726. }
  1727. if ( parent !== this ) {
  1728. // set the correct event type
  1729. event.type = event.data;
  1730. // handle event if we actually just moused on to a non sub-element
  1731. jQuery.event.handle.apply( this, arguments );
  1732. }
  1733. // assuming we've left the element since we most likely mousedover a xul element
  1734. } catch(e) { }
  1735. },
  1736. // In case of event delegation, we only need to rename the event.type,
  1737. // liveHandler will take care of the rest.
  1738. delegate = function( event ) {
  1739. event.type = event.data;
  1740. jQuery.event.handle.apply( this, arguments );
  1741. };
  1742. // Create mouseenter and mouseleave events
  1743. jQuery.each({
  1744. mouseenter: "mouseover",
  1745. mouseleave: "mouseout"
  1746. }, function( orig, fix ) {
  1747. jQuery.event.special[ orig ] = {
  1748. setup: function( data ) {
  1749. jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
  1750. },
  1751. teardown: function( data ) {
  1752. jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
  1753. }
  1754. };
  1755. });
  1756. // submit delegation
  1757. if ( !jQuery.support.submitBubbles ) {
  1758. jQuery.event.special.submit = {
  1759. setup: function( data, namespaces ) {
  1760. if ( this.nodeName.toLowerCase() !== "form" ) {
  1761. jQuery.event.add(this, "click.specialSubmit", function( e ) {
  1762. var elem = e.target, type = elem.type;
  1763. if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
  1764. return trigger( "submit", this, arguments );
  1765. }
  1766. });
  1767. jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
  1768. var elem = e.target, type = elem.type;
  1769. if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
  1770. return trigger( "submit", this, arguments );
  1771. }
  1772. });
  1773. } else {
  1774. return false;
  1775. }
  1776. },
  1777. teardown: function( namespaces ) {
  1778. jQuery.event.remove( this, ".specialSubmit" );
  1779. }
  1780. };
  1781. }
  1782. // change delegation, happens here so we have bind.
  1783. if ( !jQuery.support.changeBubbles ) {
  1784. var formElems = /textarea|input|select/i,
  1785. changeFilters,
  1786. getVal = function( elem ) {
  1787. var type = elem.type, val = elem.value;
  1788. if ( type === "radio" || type === "checkbox" ) {
  1789. val = elem.checked;
  1790. } else if ( type === "select-multiple" ) {
  1791. val = elem.selectedIndex > -1 ?
  1792. jQuery.map( elem.options, function( elem ) {
  1793. return elem.selected;
  1794. }).join("-") :
  1795. "";
  1796. } else if ( elem.nodeName.toLowerCase() === "select" ) {
  1797. val = elem.selectedIndex;
  1798. }
  1799. return val;
  1800. },
  1801. testChange = function testChange( e ) {
  1802. var elem = e.target, data, val;
  1803. if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
  1804. return;
  1805. }
  1806. data = jQuery.data( elem, "_change_data" );
  1807. val = getVal(elem);
  1808. // the current data will be also retrieved by beforeactivate
  1809. if ( e.type !== "focusout" || elem.type !== "radio" ) {
  1810. jQuery.data( elem, "_change_data", val );
  1811. }
  1812. if ( data === undefined || val === data ) {
  1813. return;
  1814. }
  1815. if ( data != null || val ) {
  1816. e.type = "change";
  1817. return jQuery.event.trigger( e, arguments[1], elem );
  1818. }
  1819. };
  1820. jQuery.event.special.change = {
  1821. filters: {
  1822. focusout: testChange,
  1823. click: function( e ) {
  1824. var elem = e.target, type = elem.type;
  1825. if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
  1826. return testChange.call( this, e );
  1827. }
  1828. },
  1829. // Change has to be called before submit
  1830. // Keydown will be called before keypress, which is used in submit-event delegation
  1831. keydown: function( e ) {
  1832. var elem = e.target, type = elem.type;
  1833. if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
  1834. (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
  1835. type === "select-multiple" ) {
  1836. return testChange.call( this, e );
  1837. }
  1838. },
  1839. // Beforeactivate happens also before the previous element is blurred
  1840. // with this event you can't trigger a change event, but you can store
  1841. // information/focus[in] is not needed anymore
  1842. beforeactivate: function( e ) {
  1843. var elem = e.target;
  1844. jQuery.data( elem, "_change_data", getVal(elem) );
  1845. }
  1846. },
  1847. setup: function( data, namespaces ) {
  1848. if ( this.type === "file" ) {
  1849. return false;
  1850. }
  1851. for ( var type in changeFilters ) {
  1852. jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
  1853. }
  1854. return formElems.test( this.nodeName );
  1855. },
  1856. teardown: function( namespaces ) {
  1857. jQuery.event.remove( this, ".specialChange" );
  1858. return formElems.test( this.nodeName );
  1859. }
  1860. };
  1861. changeFilters = jQuery.event.special.change.filters;
  1862. }
  1863. function trigger( type, elem, args ) {
  1864. args[0].type = type;
  1865. return jQuery.event.handle.apply( elem, args );
  1866. }
  1867. // Create "bubbling" focus and blur events
  1868. if ( document.addEventListener ) {
  1869. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  1870. jQuery.event.special[ fix ] = {
  1871. setup: function() {
  1872. this.addEventListener( orig, handler, true );
  1873. },
  1874. teardown: function() {
  1875. this.removeEventListener( orig, handler, true );
  1876. }
  1877. };
  1878. function handler( e ) {
  1879. e = jQuery.event.fix( e );
  1880. e.type = fix;
  1881. return jQuery.event.handle.call( this, e );
  1882. }
  1883. });
  1884. }
  1885. jQuery.each(["bind", "one"], function( i, name ) {
  1886. jQuery.fn[ name ] = function( type, data, fn ) {
  1887. // Handle object literals
  1888. if ( typeof type === "object" ) {
  1889. for ( var key in type ) {
  1890. this[ name ](key, data, type[key], fn);
  1891. }
  1892. return this;
  1893. }
  1894. if ( jQuery.isFunction( data ) ) {
  1895. fn = data;
  1896. data = undefined;
  1897. }
  1898. var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
  1899. jQuery( this ).unbind( event, handler );
  1900. return fn.apply( this, arguments );
  1901. }) : fn;
  1902. if ( type === "unload" && name !== "one" ) {
  1903. this.one( type, data, fn );
  1904. } else {
  1905. for ( var i = 0, l = this.length; i < l; i++ ) {
  1906. jQuery.event.add( this[i], type, handler, data );
  1907. }
  1908. }
  1909. return this;
  1910. };
  1911. });
  1912. jQuery.fn.extend({
  1913. unbind: function( type, fn ) {
  1914. // Handle object literals
  1915. if ( typeof type === "object" && !type.preventDefault ) {
  1916. for ( var key in type ) {
  1917. this.unbind(key, type[key]);
  1918. }
  1919. } else {
  1920. for ( var i = 0, l = this.length; i < l; i++ ) {
  1921. jQuery.event.remove( this[i], type, fn );
  1922. }
  1923. }
  1924. return this;
  1925. },
  1926. delegate: function( selector, types, data, fn ) {
  1927. return this.live( types, data, fn, selector );
  1928. },
  1929. undelegate: function( selector, types, fn ) {
  1930. if ( arguments.length === 0 ) {
  1931. return this.unbind( "live" );
  1932. } else {
  1933. return this.die( types, null, fn, selector );
  1934. }
  1935. },
  1936. trigger: function( type, data ) {
  1937. return this.each(function() {
  1938. jQuery.event.trigger( type, data, this );
  1939. });
  1940. },
  1941. triggerHandler: function( type, data ) {
  1942. if ( this[0] ) {
  1943. var event = jQuery.Event( type );
  1944. event.preventDefault();
  1945. event.stopPropagation();
  1946. jQuery.event.trigger( event, data, this[0] );
  1947. return event.result;
  1948. }
  1949. },
  1950. toggle: function( fn ) {
  1951. // Save reference to arguments for access in closure
  1952. var args = arguments, i = 1;
  1953. // link all the functions, so any of them can unbind this click handler
  1954. while ( i < args.length ) {
  1955. jQuery.proxy( fn, args[ i++ ] );
  1956. }
  1957. return this.click( jQuery.proxy( fn, function( event ) {
  1958. // Figure out which function to execute
  1959. var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
  1960. jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
  1961. // Make sure that clicks stop
  1962. event.preventDefault();
  1963. // and execute the function
  1964. return args[ lastToggle ].apply( this, arguments ) || false;
  1965. }));
  1966. },
  1967. hover: function( fnOver, fnOut ) {
  1968. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  1969. }
  1970. });
  1971. var liveMap = {
  1972. focus: "focusin",
  1973. blur: "focusout",
  1974. mouseenter: "mouseover",
  1975. mouseleave: "mouseout"
  1976. };
  1977. jQuery.each(["live", "die"], function( i, name ) {
  1978. jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
  1979. var type, i = 0, match, namespaces, preType,
  1980. selector = origSelector || this.selector,
  1981. context = origSelector ? this : jQuery( this.context );
  1982. if ( jQuery.isFunction( data ) ) {
  1983. fn = data;
  1984. data = undefined;
  1985. }
  1986. types = (types || "").split(" ");
  1987. while ( (type = types[ i++ ]) != null ) {
  1988. match = rnamespaces.exec( type );
  1989. namespaces = "";
  1990. if ( match ) {
  1991. namespaces = match[0];
  1992. type = type.replace( rnamespaces, "" );
  1993. }
  1994. if ( type === "hover" ) {
  1995. types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
  1996. continue;
  1997. }
  1998. preType = type;
  1999. if ( type === "focus" || type === "blur" ) {
  2000. types.push( liveMap[ type ] + namespaces );
  2001. type = type + namespaces;
  2002. } else {
  2003. type = (liveMap[ type ] || type) + namespaces;
  2004. }
  2005. if ( name === "live" ) {
  2006. // bind live handler
  2007. context.each(function(){
  2008. jQuery.event.add( this, liveConvert( type, selector ),
  2009. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
  2010. });
  2011. } else {
  2012. // unbind live handler
  2013. context.unbind( liveConvert( type, selector ), fn );
  2014. }
  2015. }
  2016. return this;
  2017. }
  2018. });
  2019. function liveHandler( event ) {
  2020. var stop, elems = [], selectors = [], args = arguments,
  2021. related, match, handleObj, elem, j, i, l, data,
  2022. events = jQuery.data( this, "events" );
  2023. // Make sure we avoid non-left-click bubbling in Firefox (#3861)
  2024. if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
  2025. return;
  2026. }
  2027. event.liveFired = this;
  2028. var live = events.live.slice(0);
  2029. for ( j = 0; j < live.length; j++ ) {
  2030. handleObj = live[j];
  2031. if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
  2032. selectors.push( handleObj.selector );
  2033. } else {
  2034. live.splice( j--, 1 );
  2035. }
  2036. }
  2037. match = jQuery( event.target ).closest( selectors, event.currentTarget );
  2038. for ( i = 0, l = match.length; i < l; i++ ) {
  2039. for ( j = 0; j < live.length; j++ ) {
  2040. handleObj = live[j];
  2041. if ( match[i].selector === handleObj.selector ) {
  2042. elem = match[i].elem;
  2043. related = null;
  2044. // Those two events require additional checking
  2045. if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
  2046. related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
  2047. }
  2048. if ( !related || related !== elem ) {
  2049. elems.push({ elem: elem, handleObj: handleObj });
  2050. }
  2051. }
  2052. }
  2053. }
  2054. for ( i = 0, l = elems.length; i < l; i++ ) {
  2055. match = elems[i];
  2056. event.currentTarget = match.elem;
  2057. event.data = match.handleObj.data;
  2058. event.handleObj = match.handleObj;
  2059. if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
  2060. stop = false;
  2061. break;
  2062. }
  2063. }
  2064. return stop;
  2065. }
  2066. function liveConvert( type, selector ) {
  2067. return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
  2068. }
  2069. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  2070. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  2071. "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
  2072. // Handle event binding
  2073. jQuery.fn[ name ] = function( fn ) {
  2074. return fn ? this.bind( name, fn ) : this.trigger( name );
  2075. };
  2076. if ( jQuery.attrFn ) {
  2077. jQuery.attrFn[ name ] = true;
  2078. }
  2079. });
  2080. // Prevent memory leaks in IE
  2081. // Window isn't included so as not to unbind existing unload events
  2082. // More info:
  2083. // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
  2084. if ( window.attachEvent && !window.addEventListener ) {
  2085. window.attachEvent("onunload", function() {
  2086. for ( var id in jQuery.cache ) {
  2087. if ( jQuery.cache[ id ].handle ) {
  2088. // Try/Catch is to handle iframes being unloaded, see #4280
  2089. try {
  2090. jQuery.event.remove( jQuery.cache[ id ].handle.elem );
  2091. } catch(e) {}
  2092. }
  2093. }
  2094. });
  2095. }
  2096. /*!
  2097. * Sizzle CSS Selector Engine - v1.0
  2098. * Copyright 2009, The Dojo Foundation
  2099. * Released under the MIT, BSD, and GPL Licenses.
  2100. * More information: http://sizzlejs.com/
  2101. */
  2102. (function(){
  2103. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
  2104. done = 0,
  2105. toString = Object.prototype.toString,
  2106. hasDuplicate = false,
  2107. baseHasDuplicate = true;
  2108. // Here we check if the JavaScript engine is using some sort of
  2109. // optimization where it does not always call our comparison
  2110. // function. If that is the case, discard the hasDuplicate value.
  2111. // Thus far that includes Google Chrome.
  2112. [0, 0].sort(function(){
  2113. baseHasDuplicate = false;
  2114. return 0;
  2115. });
  2116. var Sizzle = function(selector, context, results, seed) {
  2117. results = results || [];
  2118. var origContext = context = context || document;
  2119. if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
  2120. return [];
  2121. }
  2122. if ( !selector || typeof selector !== "string" ) {
  2123. return results;
  2124. }
  2125. var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context),
  2126. soFar = selector;
  2127. // Reset the position of the chunker regexp (start from head)
  2128. while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
  2129. soFar = m[3];
  2130. parts.push( m[1] );
  2131. if ( m[2] ) {
  2132. extra = m[3];
  2133. break;
  2134. }
  2135. }
  2136. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  2137. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  2138. set = posProcess( parts[0] + parts[1], context );
  2139. } else {
  2140. set = Expr.relative[ parts[0] ] ?
  2141. [ context ] :
  2142. Sizzle( parts.shift(), context );
  2143. while ( parts.length ) {
  2144. selector = parts.shift();
  2145. if ( Expr.relative[ selector ] ) {
  2146. selector += parts.shift();
  2147. }
  2148. set = posProcess( selector, set );
  2149. }
  2150. }
  2151. } else {
  2152. // Take a shortcut and set the context if the root selector is an ID
  2153. // (but not if it'll be faster if the inner selector is an ID)
  2154. if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
  2155. Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
  2156. var ret = Sizzle.find( parts.shift(), context, contextXML );
  2157. context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
  2158. }
  2159. if ( context ) {
  2160. var ret = seed ?
  2161. { expr: parts.pop(), set: makeArray(seed) } :
  2162. Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
  2163. set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
  2164. if ( parts.length > 0 ) {
  2165. checkSet = makeArray(set);
  2166. } else {
  2167. prune = false;
  2168. }
  2169. while ( parts.length ) {
  2170. var cur = parts.pop(), pop = cur;
  2171. if ( !Expr.relative[ cur ] ) {
  2172. cur = "";
  2173. } else {
  2174. pop = parts.pop();
  2175. }
  2176. if ( pop == null ) {
  2177. pop = context;
  2178. }
  2179. Expr.relative[ cur ]( checkSet, pop, contextXML );
  2180. }
  2181. } else {
  2182. checkSet = parts = [];
  2183. }
  2184. }
  2185. if ( !checkSet ) {
  2186. checkSet = set;
  2187. }
  2188. if ( !checkSet ) {
  2189. Sizzle.error( cur || selector );
  2190. }
  2191. if ( toString.call(checkSet) === "[object Array]" ) {
  2192. if ( !prune ) {
  2193. results.push.apply( results, checkSet );
  2194. } else if ( context && context.nodeType === 1 ) {
  2195. for ( var i = 0; checkSet[i] != null; i++ ) {
  2196. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
  2197. results.push( set[i] );
  2198. }
  2199. }
  2200. } else {
  2201. for ( var i = 0; checkSet[i] != null; i++ ) {
  2202. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  2203. results.push( set[i] );
  2204. }
  2205. }
  2206. }
  2207. } else {
  2208. makeArray( checkSet, results );
  2209. }
  2210. if ( extra ) {
  2211. Sizzle( extra, origContext, results, seed );
  2212. Sizzle.uniqueSort( results );
  2213. }
  2214. return results;
  2215. };
  2216. Sizzle.uniqueSort = function(results){
  2217. if ( sortOrder ) {
  2218. hasDuplicate = baseHasDuplicate;
  2219. results.sort(sortOrder);
  2220. if ( hasDuplicate ) {
  2221. for ( var i = 1; i < results.length; i++ ) {
  2222. if ( results[i] === results[i-1] ) {
  2223. results.splice(i--, 1);
  2224. }
  2225. }
  2226. }
  2227. }
  2228. return results;
  2229. };
  2230. Sizzle.matches = function(expr, set){
  2231. return Sizzle(expr, null, null, set);
  2232. };
  2233. Sizzle.find = function(expr, context, isXML){
  2234. var set, match;
  2235. if ( !expr ) {
  2236. return [];
  2237. }
  2238. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  2239. var type = Expr.order[i], match;
  2240. if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
  2241. var left = match[1];
  2242. match.splice(1,1);
  2243. if ( left.substr( left.length - 1 ) !== "\\" ) {
  2244. match[1] = (match[1] || "").replace(/\\/g, "");
  2245. set = Expr.find[ type ]( match, context, isXML );
  2246. if ( set != null ) {
  2247. expr = expr.replace( Expr.match[ type ], "" );
  2248. break;
  2249. }
  2250. }
  2251. }
  2252. }
  2253. if ( !set ) {
  2254. set = context.getElementsByTagName("*");
  2255. }
  2256. return {set: set, expr: expr};
  2257. };
  2258. Sizzle.filter = function(expr, set, inplace, not){
  2259. var old = expr, result = [], curLoop = set, match, anyFound,
  2260. isXMLFilter = set && set[0] && isXML(set[0]);
  2261. while ( expr && set.length ) {
  2262. for ( var type in Expr.filter ) {
  2263. if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
  2264. var filter = Expr.filter[ type ], found, item, left = match[1];
  2265. anyFound = false;
  2266. match.splice(1,1);
  2267. if ( left.substr( left.length - 1 ) === "\\" ) {
  2268. continue;
  2269. }
  2270. if ( curLoop === result ) {
  2271. result = [];
  2272. }
  2273. if ( Expr.preFilter[ type ] ) {
  2274. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  2275. if ( !match ) {
  2276. anyFound = found = true;
  2277. } else if ( match === true ) {
  2278. continue;
  2279. }
  2280. }
  2281. if ( match ) {
  2282. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  2283. if ( item ) {
  2284. found = filter( item, match, i, curLoop );
  2285. var pass = not ^ !!found;
  2286. if ( inplace && found != null ) {
  2287. if ( pass ) {
  2288. anyFound = true;
  2289. } else {
  2290. curLoop[i] = false;
  2291. }
  2292. } else if ( pass ) {
  2293. result.push( item );
  2294. anyFound = true;
  2295. }
  2296. }
  2297. }
  2298. }
  2299. if ( found !== undefined ) {
  2300. if ( !inplace ) {
  2301. curLoop = result;
  2302. }
  2303. expr = expr.replace( Expr.match[ type ], "" );
  2304. if ( !anyFound ) {
  2305. return [];
  2306. }
  2307. break;
  2308. }
  2309. }
  2310. }
  2311. // Improper expression
  2312. if ( expr === old ) {
  2313. if ( anyFound == null ) {
  2314. Sizzle.error( expr );
  2315. } else {
  2316. break;
  2317. }
  2318. }
  2319. old = expr;
  2320. }
  2321. return curLoop;
  2322. };
  2323. Sizzle.error = function( msg ) {
  2324. throw "Syntax error, unrecognized expression: " + msg;
  2325. };
  2326. var Expr = Sizzle.selectors = {
  2327. order: [ "ID", "NAME", "TAG" ],
  2328. match: {
  2329. ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
  2330. CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
  2331. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
  2332. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  2333. TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
  2334. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
  2335. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
  2336. PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
  2337. },
  2338. leftMatch: {},
  2339. attrMap: {
  2340. "class": "className",
  2341. "for": "htmlFor"
  2342. },
  2343. attrHandle: {
  2344. href: function(elem){
  2345. return elem.getAttribute("href");
  2346. }
  2347. },
  2348. relative: {
  2349. "+": function(checkSet, part){
  2350. var isPartStr = typeof part === "string",
  2351. isTag = isPartStr && !/\W/.test(part),
  2352. isPartStrNotTag = isPartStr && !isTag;
  2353. if ( isTag ) {
  2354. part = part.toLowerCase();
  2355. }
  2356. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  2357. if ( (elem = checkSet[i]) ) {
  2358. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  2359. checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
  2360. elem || false :
  2361. elem === part;
  2362. }
  2363. }
  2364. if ( isPartStrNotTag ) {
  2365. Sizzle.filter( part, checkSet, true );
  2366. }
  2367. },
  2368. ">": function(checkSet, part){
  2369. var isPartStr = typeof part === "string";
  2370. if ( isPartStr && !/\W/.test(part) ) {
  2371. part = part.toLowerCase();
  2372. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  2373. var elem = checkSet[i];
  2374. if ( elem ) {
  2375. var parent = elem.parentNode;
  2376. checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
  2377. }
  2378. }
  2379. } else {
  2380. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  2381. var elem = checkSet[i];
  2382. if ( elem ) {
  2383. checkSet[i] = isPartStr ?
  2384. elem.parentNode :
  2385. elem.parentNode === part;
  2386. }
  2387. }
  2388. if ( isPartStr ) {
  2389. Sizzle.filter( part, checkSet, true );
  2390. }
  2391. }
  2392. },
  2393. "": function(checkSet, part, isXML){
  2394. var doneName = done++, checkFn = dirCheck;
  2395. if ( typeof part === "string" && !/\W/.test(part) ) {
  2396. var nodeCheck = part = part.toLowerCase();
  2397. checkFn = dirNodeCheck;
  2398. }
  2399. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  2400. },
  2401. "~": function(checkSet, part, isXML){
  2402. var doneName = done++, checkFn = dirCheck;
  2403. if ( typeof part === "string" && !/\W/.test(part) ) {
  2404. var nodeCheck = part = part.toLowerCase();
  2405. checkFn = dirNodeCheck;
  2406. }
  2407. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  2408. }
  2409. },
  2410. find: {
  2411. ID: function(match, context, isXML){
  2412. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  2413. var m = context.getElementById(match[1]);
  2414. return m ? [m] : [];
  2415. }
  2416. },
  2417. NAME: function(match, context){
  2418. if ( typeof context.getElementsByName !== "undefined" ) {
  2419. var ret = [], results = context.getElementsByName(match[1]);
  2420. for ( var i = 0, l = results.length; i < l; i++ ) {
  2421. if ( results[i].getAttribute("name") === match[1] ) {
  2422. ret.push( results[i] );
  2423. }
  2424. }
  2425. return ret.length === 0 ? null : ret;
  2426. }
  2427. },
  2428. TAG: function(match, context){
  2429. return context.getElementsByTagName(match[1]);
  2430. }
  2431. },
  2432. preFilter: {
  2433. CLASS: function(match, curLoop, inplace, result, not, isXML){
  2434. match = " " + match[1].replace(/\\/g, "") + " ";
  2435. if ( isXML ) {
  2436. return match;
  2437. }
  2438. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  2439. if ( elem ) {
  2440. if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
  2441. if ( !inplace ) {
  2442. result.push( elem );
  2443. }
  2444. } else if ( inplace ) {
  2445. curLoop[i] = false;
  2446. }
  2447. }
  2448. }
  2449. return false;
  2450. },
  2451. ID: function(match){
  2452. return match[1].replace(/\\/g, "");
  2453. },
  2454. TAG: function(match, curLoop){
  2455. return match[1].toLowerCase();
  2456. },
  2457. CHILD: function(match){
  2458. if ( match[1] === "nth" ) {
  2459. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  2460. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  2461. match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
  2462. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  2463. // calculate the numbers (first)n+(last) including if they are negative
  2464. match[2] = (test[1] + (test[2] || 1)) - 0;
  2465. match[3] = test[3] - 0;
  2466. }
  2467. // TODO: Move to normal caching system
  2468. match[0] = done++;
  2469. return match;
  2470. },
  2471. ATTR: function(match, curLoop, inplace, result, not, isXML){
  2472. var name = match[1].replace(/\\/g, "");
  2473. if ( !isXML && Expr.attrMap[name] ) {
  2474. match[1] = Expr.attrMap[name];
  2475. }
  2476. if ( match[2] === "~=" ) {
  2477. match[4] = " " + match[4] + " ";
  2478. }
  2479. return match;
  2480. },
  2481. PSEUDO: function(match, curLoop, inplace, result, not){
  2482. if ( match[1] === "not" ) {
  2483. // If we're dealing with a complex expression, or a simple one
  2484. if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
  2485. match[3] = Sizzle(match[3], null, null, curLoop);
  2486. } else {
  2487. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  2488. if ( !inplace ) {
  2489. result.push.apply( result, ret );
  2490. }
  2491. return false;
  2492. }
  2493. } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
  2494. return true;
  2495. }
  2496. return match;
  2497. },
  2498. POS: function(match){
  2499. match.unshift( true );
  2500. return match;
  2501. }
  2502. },
  2503. filters: {
  2504. enabled: function(elem){
  2505. return elem.disabled === false && elem.type !== "hidden";
  2506. },
  2507. disabled: function(elem){
  2508. return elem.disabled === true;
  2509. },
  2510. checked: function(elem){
  2511. return elem.checked === true;
  2512. },
  2513. selected: function(elem){
  2514. // Accessing this property makes selected-by-default
  2515. // options in Safari work properly
  2516. elem.parentNode.selectedIndex;
  2517. return elem.selected === true;
  2518. },
  2519. parent: function(elem){
  2520. return !!elem.firstChild;
  2521. },
  2522. empty: function(elem){
  2523. return !elem.firstChild;
  2524. },
  2525. has: function(elem, i, match){
  2526. return !!Sizzle( match[3], elem ).length;
  2527. },
  2528. header: function(elem){
  2529. return /h\d/i.test( elem.nodeName );
  2530. },
  2531. text: function(elem){
  2532. return "text" === elem.type;
  2533. },
  2534. radio: function(elem){
  2535. return "radio" === elem.type;
  2536. },
  2537. checkbox: function(elem){
  2538. return "checkbox" === elem.type;
  2539. },
  2540. file: function(elem){
  2541. return "file" === elem.type;
  2542. },
  2543. password: function(elem){
  2544. return "password" === elem.type;
  2545. },
  2546. submit: function(elem){
  2547. return "submit" === elem.type;
  2548. },
  2549. image: function(elem){
  2550. return "image" === elem.type;
  2551. },
  2552. reset: function(elem){
  2553. return "reset" === elem.type;
  2554. },
  2555. button: function(elem){
  2556. return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
  2557. },
  2558. input: function(elem){
  2559. return /input|select|textarea|button/i.test(elem.nodeName);
  2560. }
  2561. },
  2562. setFilters: {
  2563. first: function(elem, i){
  2564. return i === 0;
  2565. },
  2566. last: function(elem, i, match, array){
  2567. return i === array.length - 1;
  2568. },
  2569. even: function(elem, i){
  2570. return i % 2 === 0;
  2571. },
  2572. odd: function(elem, i){
  2573. return i % 2 === 1;
  2574. },
  2575. lt: function(elem, i, match){
  2576. return i < match[3] - 0;
  2577. },
  2578. gt: function(elem, i, match){
  2579. return i > match[3] - 0;
  2580. },
  2581. nth: function(elem, i, match){
  2582. return match[3] - 0 === i;
  2583. },
  2584. eq: function(elem, i, match){
  2585. return match[3] - 0 === i;
  2586. }
  2587. },
  2588. filter: {
  2589. PSEUDO: function(elem, match, i, array){
  2590. var name = match[1], filter = Expr.filters[ name ];
  2591. if ( filter ) {
  2592. return filter( elem, i, match, array );
  2593. } else if ( name === "contains" ) {
  2594. return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
  2595. } else if ( name === "not" ) {
  2596. var not = match[3];
  2597. for ( var i = 0, l = not.length; i < l; i++ ) {
  2598. if ( not[i] === elem ) {
  2599. return false;
  2600. }
  2601. }
  2602. return true;
  2603. } else {
  2604. Sizzle.error( "Syntax error, unrecognized expression: " + name );
  2605. }
  2606. },
  2607. CHILD: function(elem, match){
  2608. var type = match[1], node = elem;
  2609. switch (type) {
  2610. case 'only':
  2611. case 'first':
  2612. while ( (node = node.previousSibling) ) {
  2613. if ( node.nodeType === 1 ) {
  2614. return false;
  2615. }
  2616. }
  2617. if ( type === "first" ) {
  2618. return true;
  2619. }
  2620. node = elem;
  2621. case 'last':
  2622. while ( (node = node.nextSibling) ) {
  2623. if ( node.nodeType === 1 ) {
  2624. return false;
  2625. }
  2626. }
  2627. return true;
  2628. case 'nth':
  2629. var first = match[2], last = match[3];
  2630. if ( first === 1 && last === 0 ) {
  2631. return true;
  2632. }
  2633. var doneName = match[0],
  2634. parent = elem.parentNode;
  2635. if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
  2636. var count = 0;
  2637. for ( node = parent.firstChild; node; node = node.nextSibling ) {
  2638. if ( node.nodeType === 1 ) {
  2639. node.nodeIndex = ++count;
  2640. }
  2641. }
  2642. parent.sizcache = doneName;
  2643. }
  2644. var diff = elem.nodeIndex - last;
  2645. if ( first === 0 ) {
  2646. return diff === 0;
  2647. } else {
  2648. return ( diff % first === 0 && diff / first >= 0 );
  2649. }
  2650. }
  2651. },
  2652. ID: function(elem, match){
  2653. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  2654. },
  2655. TAG: function(elem, match){
  2656. return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
  2657. },
  2658. CLASS: function(elem, match){
  2659. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  2660. .indexOf( match ) > -1;
  2661. },
  2662. ATTR: function(elem, match){
  2663. var name = match[1],
  2664. result = Expr.attrHandle[ name ] ?
  2665. Expr.attrHandle[ name ]( elem ) :
  2666. elem[ name ] != null ?
  2667. elem[ name ] :
  2668. elem.getAttribute( name ),
  2669. value = result + "",
  2670. type = match[2],
  2671. check = match[4];
  2672. return result == null ?
  2673. type === "!=" :
  2674. type === "=" ?
  2675. value === check :
  2676. type === "*=" ?
  2677. value.indexOf(check) >= 0 :
  2678. type === "~=" ?
  2679. (" " + value + " ").indexOf(check) >= 0 :
  2680. !check ?
  2681. value && result !== false :
  2682. type === "!=" ?
  2683. value !== check :
  2684. type === "^=" ?
  2685. value.indexOf(check) === 0 :
  2686. type === "$=" ?
  2687. value.substr(value.length - check.length) === check :
  2688. type === "|=" ?
  2689. value === check || value.substr(0, check.length + 1) === check + "-" :
  2690. false;
  2691. },
  2692. POS: function(elem, match, i, array){
  2693. var name = match[2], filter = Expr.setFilters[ name ];
  2694. if ( filter ) {
  2695. return filter( elem, i, match, array );
  2696. }
  2697. }
  2698. }
  2699. };
  2700. var origPOS = Expr.match.POS;
  2701. for ( var type in Expr.match ) {
  2702. Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
  2703. Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){
  2704. return "\\" + (num - 0 + 1);
  2705. }));
  2706. }
  2707. var makeArray = function(array, results) {
  2708. array = Array.prototype.slice.call( array, 0 );
  2709. if ( results ) {
  2710. results.push.apply( results, array );
  2711. return results;
  2712. }
  2713. return array;
  2714. };
  2715. // Perform a simple check to determine if the browser is capable of
  2716. // converting a NodeList to an array using builtin methods.
  2717. // Also verifies that the returned array holds DOM nodes
  2718. // (which is not the case in the Blackberry browser)
  2719. try {
  2720. Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
  2721. // Provide a fallback method if it does not work
  2722. } catch(e){
  2723. makeArray = function(array, results) {
  2724. var ret = results || [];
  2725. if ( toString.call(array) === "[object Array]" ) {
  2726. Array.prototype.push.apply( ret, array );
  2727. } else {
  2728. if ( typeof array.length === "number" ) {
  2729. for ( var i = 0, l = array.length; i < l; i++ ) {
  2730. ret.push( array[i] );
  2731. }
  2732. } else {
  2733. for ( var i = 0; array[i]; i++ ) {
  2734. ret.push( array[i] );
  2735. }
  2736. }
  2737. }
  2738. return ret;
  2739. };
  2740. }
  2741. var sortOrder;
  2742. if ( document.documentElement.compareDocumentPosition ) {
  2743. sortOrder = function( a, b ) {
  2744. if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
  2745. if ( a == b ) {
  2746. hasDuplicate = true;
  2747. }
  2748. return a.compareDocumentPosition ? -1 : 1;
  2749. }
  2750. var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
  2751. if ( ret === 0 ) {
  2752. hasDuplicate = true;
  2753. }
  2754. return ret;
  2755. };
  2756. } else if ( "sourceIndex" in document.documentElement ) {
  2757. sortOrder = function( a, b ) {
  2758. if ( !a.sourceIndex || !b.sourceIndex ) {
  2759. if ( a == b ) {
  2760. hasDuplicate = true;
  2761. }
  2762. return a.sourceIndex ? -1 : 1;
  2763. }
  2764. var ret = a.sourceIndex - b.sourceIndex;
  2765. if ( ret === 0 ) {
  2766. hasDuplicate = true;
  2767. }
  2768. return ret;
  2769. };
  2770. } else if ( document.createRange ) {
  2771. sortOrder = function( a, b ) {
  2772. if ( !a.ownerDocument || !b.ownerDocument ) {
  2773. if ( a == b ) {
  2774. hasDuplicate = true;
  2775. }
  2776. return a.ownerDocument ? -1 : 1;
  2777. }
  2778. var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
  2779. aRange.setStart(a, 0);
  2780. aRange.setEnd(a, 0);
  2781. bRange.setStart(b, 0);
  2782. bRange.setEnd(b, 0);
  2783. var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
  2784. if ( ret === 0 ) {
  2785. hasDuplicate = true;
  2786. }
  2787. return ret;
  2788. };
  2789. }
  2790. // Utility function for retrieving the text value of an array of DOM nodes
  2791. function getText( elems ) {
  2792. var ret = "", elem;
  2793. for ( var i = 0; elems[i]; i++ ) {
  2794. elem = elems[i];
  2795. // Get the text from text nodes and CDATA nodes
  2796. if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
  2797. ret += elem.nodeValue;
  2798. // Traverse everything else, except comment nodes
  2799. } else if ( elem.nodeType !== 8 ) {
  2800. ret += getText( elem.childNodes );
  2801. }
  2802. }
  2803. return ret;
  2804. }
  2805. // Check to see if the browser returns elements by name when
  2806. // querying by getElementById (and provide a workaround)
  2807. (function(){
  2808. // We're going to inject a fake input element with a specified name
  2809. var form = document.createElement("div"),
  2810. id = "script" + (new Date).getTime();
  2811. form.innerHTML = "<a name='" + id + "'/>";
  2812. // Inject it into the root element, check its status, and remove it quickly
  2813. var root = document.documentElement;
  2814. root.insertBefore( form, root.firstChild );
  2815. // The workaround has to do additional checks after a getElementById
  2816. // Which slows things down for other browsers (hence the branching)
  2817. if ( document.getElementById( id ) ) {
  2818. Expr.find.ID = function(match, context, isXML){
  2819. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  2820. var m = context.getElementById(match[1]);
  2821. return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
  2822. }
  2823. };
  2824. Expr.filter.ID = function(elem, match){
  2825. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  2826. return elem.nodeType === 1 && node && node.nodeValue === match;
  2827. };
  2828. }
  2829. root.removeChild( form );
  2830. root = form = null; // release memory in IE
  2831. })();
  2832. (function(){
  2833. // Check to see if the browser returns only elements
  2834. // when doing getElementsByTagName("*")
  2835. // Create a fake element
  2836. var div = document.createElement("div");
  2837. div.appendChild( document.createComment("") );
  2838. // Make sure no comments are found
  2839. if ( div.getElementsByTagName("*").length > 0 ) {
  2840. Expr.find.TAG = function(match, context){
  2841. var results = context.getElementsByTagName(match[1]);
  2842. // Filter out possible comments
  2843. if ( match[1] === "*" ) {
  2844. var tmp = [];
  2845. for ( var i = 0; results[i]; i++ ) {
  2846. if ( results[i].nodeType === 1 ) {
  2847. tmp.push( results[i] );
  2848. }
  2849. }
  2850. results = tmp;
  2851. }
  2852. return results;
  2853. };
  2854. }
  2855. // Check to see if an attribute returns normalized href attributes
  2856. div.innerHTML = "<a href='#'></a>";
  2857. if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  2858. div.firstChild.getAttribute("href") !== "#" ) {
  2859. Expr.attrHandle.href = function(elem){
  2860. return elem.getAttribute("href", 2);
  2861. };
  2862. }
  2863. div = null; // release memory in IE
  2864. })();
  2865. if ( document.querySelectorAll ) {
  2866. (function(){
  2867. var oldSizzle = Sizzle, div = document.createElement("div");
  2868. div.innerHTML = "<p class='TEST'></p>";
  2869. // Safari can't handle uppercase or unicode characters when
  2870. // in quirks mode.
  2871. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
  2872. return;
  2873. }
  2874. Sizzle = function(query, context, extra, seed){
  2875. context = context || document;
  2876. // Only use querySelectorAll on non-XML documents
  2877. // (ID selectors don't work in non-HTML documents)
  2878. if ( !seed && context.nodeType === 9 && !isXML(context) ) {
  2879. try {
  2880. return makeArray( context.querySelectorAll(query), extra );
  2881. } catch(e){}
  2882. }
  2883. return oldSizzle(query, context, extra, seed);
  2884. };
  2885. for ( var prop in oldSizzle ) {
  2886. Sizzle[ prop ] = oldSizzle[ prop ];
  2887. }
  2888. div = null; // release memory in IE
  2889. })();
  2890. }
  2891. (function(){
  2892. var div = document.createElement("div");
  2893. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  2894. // Opera can't find a second classname (in 9.6)
  2895. // Also, make sure that getElementsByClassName actually exists
  2896. if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
  2897. return;
  2898. }
  2899. // Safari caches class attributes, doesn't catch changes (in 3.2)
  2900. div.lastChild.className = "e";
  2901. if ( div.getElementsByClassName("e").length === 1 ) {
  2902. return;
  2903. }
  2904. Expr.order.splice(1, 0, "CLASS");
  2905. Expr.find.CLASS = function(match, context, isXML) {
  2906. if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
  2907. return context.getElementsByClassName(match[1]);
  2908. }
  2909. };
  2910. div = null; // release memory in IE
  2911. })();
  2912. function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  2913. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  2914. var elem = checkSet[i];
  2915. if ( elem ) {
  2916. elem = elem[dir];
  2917. var match = false;
  2918. while ( elem ) {
  2919. if ( elem.sizcache === doneName ) {
  2920. match = checkSet[elem.sizset];
  2921. break;
  2922. }
  2923. if ( elem.nodeType === 1 && !isXML ){
  2924. elem.sizcache = doneName;
  2925. elem.sizset = i;
  2926. }
  2927. if ( elem.nodeName.toLowerCase() === cur ) {
  2928. match = elem;
  2929. break;
  2930. }
  2931. elem = elem[dir];
  2932. }
  2933. checkSet[i] = match;
  2934. }
  2935. }
  2936. }
  2937. function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  2938. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  2939. var elem = checkSet[i];
  2940. if ( elem ) {
  2941. elem = elem[dir];
  2942. var match = false;
  2943. while ( elem ) {
  2944. if ( elem.sizcache === doneName ) {
  2945. match = checkSet[elem.sizset];
  2946. break;
  2947. }
  2948. if ( elem.nodeType === 1 ) {
  2949. if ( !isXML ) {
  2950. elem.sizcache = doneName;
  2951. elem.sizset = i;
  2952. }
  2953. if ( typeof cur !== "string" ) {
  2954. if ( elem === cur ) {
  2955. match = true;
  2956. break;
  2957. }
  2958. } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
  2959. match = elem;
  2960. break;
  2961. }
  2962. }
  2963. elem = elem[dir];
  2964. }
  2965. checkSet[i] = match;
  2966. }
  2967. }
  2968. }
  2969. var contains = document.compareDocumentPosition ? function(a, b){
  2970. return !!(a.compareDocumentPosition(b) & 16);
  2971. } : function(a, b){
  2972. return a !== b && (a.contains ? a.contains(b) : true);
  2973. };
  2974. var isXML = function(elem){
  2975. // documentElement is verified for cases where it doesn't yet exist
  2976. // (such as loading iframes in IE - #4833)
  2977. var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
  2978. return documentElement ? documentElement.nodeName !== "HTML" : false;
  2979. };
  2980. var posProcess = function(selector, context){
  2981. var tmpSet = [], later = "", match,
  2982. root = context.nodeType ? [context] : context;
  2983. // Position selectors must be done after the filter
  2984. // And so must :not(positional) so we move all PSEUDOs to the end
  2985. while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
  2986. later += match[0];
  2987. selector = selector.replace( Expr.match.PSEUDO, "" );
  2988. }
  2989. selector = Expr.relative[selector] ? selector + "*" : selector;
  2990. for ( var i = 0, l = root.length; i < l; i++ ) {
  2991. Sizzle( selector, root[i], tmpSet );
  2992. }
  2993. return Sizzle.filter( later, tmpSet );
  2994. };
  2995. // EXPOSE
  2996. jQuery.find = Sizzle;
  2997. jQuery.expr = Sizzle.selectors;
  2998. jQuery.expr[":"] = jQuery.expr.filters;
  2999. jQuery.unique = Sizzle.uniqueSort;
  3000. jQuery.text = getText;
  3001. jQuery.isXMLDoc = isXML;
  3002. jQuery.contains = contains;
  3003. return;
  3004. window.Sizzle = Sizzle;
  3005. })();
  3006. var runtil = /Until$/,
  3007. rparentsprev = /^(?:parents|prevUntil|prevAll)/,
  3008. // Note: This RegExp should be improved, or likely pulled from Sizzle
  3009. rmultiselector = /,/,
  3010. slice = Array.prototype.slice;
  3011. // Implement the identical functionality for filter and not
  3012. var winnow = function( elements, qualifier, keep ) {
  3013. if ( jQuery.isFunction( qualifier ) ) {
  3014. return jQuery.grep(elements, function( elem, i ) {
  3015. return !!qualifier.call( elem, i, elem ) === keep;
  3016. });
  3017. } else if ( qualifier.nodeType ) {
  3018. return jQuery.grep(elements, function( elem, i ) {
  3019. return (elem === qualifier) === keep;
  3020. });
  3021. } else if ( typeof qualifier === "string" ) {
  3022. var filtered = jQuery.grep(elements, function( elem ) {
  3023. return elem.nodeType === 1;
  3024. });
  3025. if ( isSimple.test( qualifier ) ) {
  3026. return jQuery.filter(qualifier, filtered, !keep);
  3027. } else {
  3028. qualifier = jQuery.filter( qualifier, filtered );
  3029. }
  3030. }
  3031. return jQuery.grep(elements, function( elem, i ) {
  3032. return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  3033. });
  3034. };
  3035. jQuery.fn.extend({
  3036. find: function( selector ) {
  3037. var ret = this.pushStack( "", "find", selector ), length = 0;
  3038. for ( var i = 0, l = this.length; i < l; i++ ) {
  3039. length = ret.length;
  3040. jQuery.find( selector, this[i], ret );
  3041. if ( i > 0 ) {
  3042. // Make sure that the results are unique
  3043. for ( var n = length; n < ret.length; n++ ) {
  3044. for ( var r = 0; r < length; r++ ) {
  3045. if ( ret[r] === ret[n] ) {
  3046. ret.splice(n--, 1);
  3047. break;
  3048. }
  3049. }
  3050. }
  3051. }
  3052. }
  3053. return ret;
  3054. },
  3055. has: function( target ) {
  3056. var targets = jQuery( target );
  3057. return this.filter(function() {
  3058. for ( var i = 0, l = targets.length; i < l; i++ ) {
  3059. if ( jQuery.contains( this, targets[i] ) ) {
  3060. return true;
  3061. }
  3062. }
  3063. });
  3064. },
  3065. not: function( selector ) {
  3066. return this.pushStack( winnow(this, selector, false), "not", selector);
  3067. },
  3068. filter: function( selector ) {
  3069. return this.pushStack( winnow(this, selector, true), "filter", selector );
  3070. },
  3071. is: function( selector ) {
  3072. return !!selector && jQuery.filter( selector, this ).length > 0;
  3073. },
  3074. closest: function( selectors, context ) {
  3075. if ( jQuery.isArray( selectors ) ) {
  3076. var ret = [], cur = this[0], match, matches = {}, selector;
  3077. if ( cur && selectors.length ) {
  3078. for ( var i = 0, l = selectors.length; i < l; i++ ) {
  3079. selector = selectors[i];
  3080. if ( !matches[selector] ) {
  3081. matches[selector] = jQuery.expr.match.POS.test( selector ) ?
  3082. jQuery( selector, context || this.context ) :
  3083. selector;
  3084. }
  3085. }
  3086. while ( cur && cur.ownerDocument && cur !== context ) {
  3087. for ( selector in matches ) {
  3088. match = matches[selector];
  3089. if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
  3090. ret.push({ selector: selector, elem: cur });
  3091. delete matches[selector];
  3092. }
  3093. }
  3094. cur = cur.parentNode;
  3095. }
  3096. }
  3097. return ret;
  3098. }
  3099. var pos = jQuery.expr.match.POS.test( selectors ) ?
  3100. jQuery( selectors, context || this.context ) : null;
  3101. return this.map(function( i, cur ) {
  3102. while ( cur && cur.ownerDocument && cur !== context ) {
  3103. if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) {
  3104. return cur;
  3105. }
  3106. cur = cur.parentNode;
  3107. }
  3108. return null;
  3109. });
  3110. },
  3111. // Determine the position of an element within
  3112. // the matched set of elements
  3113. index: function( elem ) {
  3114. if ( !elem || typeof elem === "string" ) {
  3115. return jQuery.inArray( this[0],
  3116. // If it receives a string, the selector is used
  3117. // If it receives nothing, the siblings are used
  3118. elem ? jQuery( elem ) : this.parent().children() );
  3119. }
  3120. // Locate the position of the desired element
  3121. return jQuery.inArray(
  3122. // If it receives a jQuery object, the first element is used
  3123. elem.jquery ? elem[0] : elem, this );
  3124. },
  3125. add: function( selector, context ) {
  3126. var set = typeof selector === "string" ?
  3127. jQuery( selector, context || this.context ) :
  3128. jQuery.makeArray( selector ),
  3129. all = jQuery.merge( this.get(), set );
  3130. return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
  3131. all :
  3132. jQuery.unique( all ) );
  3133. },
  3134. andSelf: function() {
  3135. return this.add( this.prevObject );
  3136. }
  3137. });
  3138. // A painfully simple check to see if an element is disconnected
  3139. // from a document (should be improved, where feasible).
  3140. function isDisconnected( node ) {
  3141. return !node || !node.parentNode || node.parentNode.nodeType === 11;
  3142. }
  3143. jQuery.each({
  3144. parent: function( elem ) {
  3145. var parent = elem.parentNode;
  3146. return parent && parent.nodeType !== 11 ? parent : null;
  3147. },
  3148. parents: function( elem ) {
  3149. return jQuery.dir( elem, "parentNode" );
  3150. },
  3151. parentsUntil: function( elem, i, until ) {
  3152. return jQuery.dir( elem, "parentNode", until );
  3153. },
  3154. next: function( elem ) {
  3155. return jQuery.nth( elem, 2, "nextSibling" );
  3156. },
  3157. prev: function( elem ) {
  3158. return jQuery.nth( elem, 2, "previousSibling" );
  3159. },
  3160. nextAll: function( elem ) {
  3161. return jQuery.dir( elem, "nextSibling" );
  3162. },
  3163. prevAll: function( elem ) {
  3164. return jQuery.dir( elem, "previousSibling" );
  3165. },
  3166. nextUntil: function( elem, i, until ) {
  3167. return jQuery.dir( elem, "nextSibling", until );
  3168. },
  3169. prevUntil: function( elem, i, until ) {
  3170. return jQuery.dir( elem, "previousSibling", until );
  3171. },
  3172. siblings: function( elem ) {
  3173. return jQuery.sibling( elem.parentNode.firstChild, elem );
  3174. },
  3175. children: function( elem ) {
  3176. return jQuery.sibling( elem.firstChild );
  3177. },
  3178. contents: function( elem ) {
  3179. return jQuery.nodeName( elem, "iframe" ) ?
  3180. elem.contentDocument || elem.contentWindow.document :
  3181. jQuery.makeArray( elem.childNodes );
  3182. }
  3183. }, function( name, fn ) {
  3184. jQuery.fn[ name ] = function( until, selector ) {
  3185. var ret = jQuery.map( this, fn, until );
  3186. if ( !runtil.test( name ) ) {
  3187. selector = until;
  3188. }
  3189. if ( selector && typeof selector === "string" ) {
  3190. ret = jQuery.filter( selector, ret );
  3191. }
  3192. ret = this.length > 1 ? jQuery.unique( ret ) : ret;
  3193. if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
  3194. ret = ret.reverse();
  3195. }
  3196. return this.pushStack( ret, name, slice.call(arguments).join(",") );
  3197. };
  3198. });
  3199. jQuery.extend({
  3200. filter: function( expr, elems, not ) {
  3201. if ( not ) {
  3202. expr = ":not(" + expr + ")";
  3203. }
  3204. return jQuery.find.matches(expr, elems);
  3205. },
  3206. dir: function( elem, dir, until ) {
  3207. var matched = [], cur = elem[dir];
  3208. while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
  3209. if ( cur.nodeType === 1 ) {
  3210. matched.push( cur );
  3211. }
  3212. cur = cur[dir];
  3213. }
  3214. return matched;
  3215. },
  3216. nth: function( cur, result, dir, elem ) {
  3217. result = result || 1;
  3218. var num = 0;
  3219. for ( ; cur; cur = cur[dir] ) {
  3220. if ( cur.nodeType === 1 && ++num === result ) {
  3221. break;
  3222. }
  3223. }
  3224. return cur;
  3225. },
  3226. sibling: function( n, elem ) {
  3227. var r = [];
  3228. for ( ; n; n = n.nextSibling ) {
  3229. if ( n.nodeType === 1 && n !== elem ) {
  3230. r.push( n );
  3231. }
  3232. }
  3233. return r;
  3234. }
  3235. });
  3236. var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
  3237. rleadingWhitespace = /^\s+/,
  3238. rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g,
  3239. rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
  3240. rtagName = /<([\w:]+)/,
  3241. rtbody = /<tbody/i,
  3242. rhtml = /<|&#?\w+;/,
  3243. rnocache = /<script|<object|<embed|<option|<style/i,
  3244. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
  3245. fcloseTag = function( all, front, tag ) {
  3246. return rselfClosing.test( tag ) ?
  3247. all :
  3248. front + "></" + tag + ">";
  3249. },
  3250. wrapMap = {
  3251. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3252. legend: [ 1, "<fieldset>", "</fieldset>" ],
  3253. thead: [ 1, "<table>", "</table>" ],
  3254. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3255. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3256. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  3257. area: [ 1, "<map>", "</map>" ],
  3258. _default: [ 0, "", "" ]
  3259. };
  3260. wrapMap.optgroup = wrapMap.option;
  3261. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3262. wrapMap.th = wrapMap.td;
  3263. // IE can't serialize <link> and <script> tags normally
  3264. if ( !jQuery.support.htmlSerialize ) {
  3265. wrapMap._default = [ 1, "div<div>", "</div>" ];
  3266. }
  3267. jQuery.fn.extend({
  3268. text: function( text ) {
  3269. if ( jQuery.isFunction(text) ) {
  3270. return this.each(function(i) {
  3271. var self = jQuery(this);
  3272. self.text( text.call(this, i, self.text()) );
  3273. });
  3274. }
  3275. if ( typeof text !== "object" && text !== undefined ) {
  3276. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  3277. }
  3278. return jQuery.text( this );
  3279. },
  3280. wrapAll: function( html ) {
  3281. if ( jQuery.isFunction( html ) ) {
  3282. return this.each(function(i) {
  3283. jQuery(this).wrapAll( html.call(this, i) );
  3284. });
  3285. }
  3286. if ( this[0] ) {
  3287. // The elements to wrap the target around
  3288. var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
  3289. if ( this[0].parentNode ) {
  3290. wrap.insertBefore( this[0] );
  3291. }
  3292. wrap.map(function() {
  3293. var elem = this;
  3294. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  3295. elem = elem.firstChild;
  3296. }
  3297. return elem;
  3298. }).append(this);
  3299. }
  3300. return this;
  3301. },
  3302. wrapInner: function( html ) {
  3303. if ( jQuery.isFunction( html ) ) {
  3304. return this.each(function(i) {
  3305. jQuery(this).wrapInner( html.call(this, i) );
  3306. });
  3307. }
  3308. return this.each(function() {
  3309. var self = jQuery( this ), contents = self.contents();
  3310. if ( contents.length ) {
  3311. contents.wrapAll( html );
  3312. } else {
  3313. self.append( html );
  3314. }
  3315. });
  3316. },
  3317. wrap: function( html ) {
  3318. return this.each(function() {
  3319. jQuery( this ).wrapAll( html );
  3320. });
  3321. },
  3322. unwrap: function() {
  3323. return this.parent().each(function() {
  3324. if ( !jQuery.nodeName( this, "body" ) ) {
  3325. jQuery( this ).replaceWith( this.childNodes );
  3326. }
  3327. }).end();
  3328. },
  3329. append: function() {
  3330. return this.domManip(arguments, true, function( elem ) {
  3331. if ( this.nodeType === 1 ) {
  3332. this.appendChild( elem );
  3333. }
  3334. });
  3335. },
  3336. prepend: function() {
  3337. return this.domManip(arguments, true, function( elem ) {
  3338. if ( this.nodeType === 1 ) {
  3339. this.insertBefore( elem, this.firstChild );
  3340. }
  3341. });
  3342. },
  3343. before: function() {
  3344. if ( this[0] && this[0].parentNode ) {
  3345. return this.domManip(arguments, false, function( elem ) {
  3346. this.parentNode.insertBefore( elem, this );
  3347. });
  3348. } else if ( arguments.length ) {
  3349. var set = jQuery(arguments[0]);
  3350. set.push.apply( set, this.toArray() );
  3351. return this.pushStack( set, "before", arguments );
  3352. }
  3353. },
  3354. after: function() {
  3355. if ( this[0] && this[0].parentNode ) {
  3356. return this.domManip(arguments, false, function( elem ) {
  3357. this.parentNode.insertBefore( elem, this.nextSibling );
  3358. });
  3359. } else if ( arguments.length ) {
  3360. var set = this.pushStack( this, "after", arguments );
  3361. set.push.apply( set, jQuery(arguments[0]).toArray() );
  3362. return set;
  3363. }
  3364. },
  3365. // keepData is for internal use only--do not document
  3366. remove: function( selector, keepData ) {
  3367. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  3368. if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
  3369. if ( !keepData && elem.nodeType === 1 ) {
  3370. jQuery.cleanData( elem.getElementsByTagName("*") );
  3371. jQuery.cleanData( [ elem ] );
  3372. }
  3373. if ( elem.parentNode ) {
  3374. elem.parentNode.removeChild( elem );
  3375. }
  3376. }
  3377. }
  3378. return this;
  3379. },
  3380. empty: function() {
  3381. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  3382. // Remove element nodes and prevent memory leaks
  3383. if ( elem.nodeType === 1 ) {
  3384. jQuery.cleanData( elem.getElementsByTagName("*") );
  3385. }
  3386. // Remove any remaining nodes
  3387. while ( elem.firstChild ) {
  3388. elem.removeChild( elem.firstChild );
  3389. }
  3390. }
  3391. return this;
  3392. },
  3393. clone: function( events ) {
  3394. // Do the clone
  3395. var ret = this.map(function() {
  3396. if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
  3397. // IE copies events bound via attachEvent when
  3398. // using cloneNode. Calling detachEvent on the
  3399. // clone will also remove the events from the original.
  3400. // In order to get around this, we use innerHTML.
  3401. // Unfortunately, this means some modifications to
  3402. // attributes in IE that are actually only stored
  3403. // as properties will not be copied (such as the
  3404. // name attribute on an input).
  3405. var html = this.outerHTML, ownerDocument = this.ownerDocument;
  3406. if ( !html ) {
  3407. var div = ownerDocument.createElement("div");
  3408. div.appendChild( this.cloneNode(true) );
  3409. html = div.innerHTML;
  3410. }
  3411. return jQuery.clean([html.replace(rinlinejQuery, "")
  3412. // Handle the case in IE 8 where action=/test/> self-closes a tag
  3413. .replace(/=([^="'>\s]+\/)>/g, '="$1">')
  3414. .replace(rleadingWhitespace, "")], ownerDocument)[0];
  3415. } else {
  3416. return this.cloneNode(true);
  3417. }
  3418. });
  3419. // Copy the events from the original to the clone
  3420. if ( events === true ) {
  3421. cloneCopyEvent( this, ret );
  3422. cloneCopyEvent( this.find("*"), ret.find("*") );
  3423. }
  3424. // Return the cloned set
  3425. return ret;
  3426. },
  3427. html: function( value ) {
  3428. if ( value === undefined ) {
  3429. return this[0] && this[0].nodeType === 1 ?
  3430. this[0].innerHTML.replace(rinlinejQuery, "") :
  3431. null;
  3432. // See if we can take a shortcut and just use innerHTML
  3433. } else if ( typeof value === "string" && !rnocache.test( value ) &&
  3434. (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
  3435. !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
  3436. value = value.replace(rxhtmlTag, fcloseTag);
  3437. try {
  3438. for ( var i = 0, l = this.length; i < l; i++ ) {
  3439. // Remove element nodes and prevent memory leaks
  3440. if ( this[i].nodeType === 1 ) {
  3441. jQuery.cleanData( this[i].getElementsByTagName("*") );
  3442. this[i].innerHTML = value;
  3443. }
  3444. }
  3445. // If using innerHTML throws an exception, use the fallback method
  3446. } catch(e) {
  3447. this.empty().append( value );
  3448. }
  3449. } else if ( jQuery.isFunction( value ) ) {
  3450. this.each(function(i){
  3451. var self = jQuery(this), old = self.html();
  3452. self.empty().append(function(){
  3453. return value.call( this, i, old );
  3454. });
  3455. });
  3456. } else {
  3457. this.empty().append( value );
  3458. }
  3459. return this;
  3460. },
  3461. replaceWith: function( value ) {
  3462. if ( this[0] && this[0].parentNode ) {
  3463. // Make sure that the elements are removed from the DOM before they are inserted
  3464. // this can help fix replacing a parent with child elements
  3465. if ( jQuery.isFunction( value ) ) {
  3466. return this.each(function(i) {
  3467. var self = jQuery(this), old = self.html();
  3468. self.replaceWith( value.call( this, i, old ) );
  3469. });
  3470. }
  3471. if ( typeof value !== "string" ) {
  3472. value = jQuery(value).detach();
  3473. }
  3474. return this.each(function() {
  3475. var next = this.nextSibling, parent = this.parentNode;
  3476. jQuery(this).remove();
  3477. if ( next ) {
  3478. jQuery(next).before( value );
  3479. } else {
  3480. jQuery(parent).append( value );
  3481. }
  3482. });
  3483. } else {
  3484. return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
  3485. }
  3486. },
  3487. detach: function( selector ) {
  3488. return this.remove( selector, true );
  3489. },
  3490. domManip: function( args, table, callback ) {
  3491. var results, first, value = args[0], scripts = [], fragment, parent;
  3492. // We can't cloneNode fragments that contain checked, in WebKit
  3493. if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
  3494. return this.each(function() {
  3495. jQuery(this).domManip( args, table, callback, true );
  3496. });
  3497. }
  3498. if ( jQuery.isFunction(value) ) {
  3499. return this.each(function(i) {
  3500. var self = jQuery(this);
  3501. args[0] = value.call(this, i, table ? self.html() : undefined);
  3502. self.domManip( args, table, callback );
  3503. });
  3504. }
  3505. if ( this[0] ) {
  3506. parent = value && value.parentNode;
  3507. // If we're in a fragment, just use that instead of building a new one
  3508. if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
  3509. results = { fragment: parent };
  3510. } else {
  3511. results = buildFragment( args, this, scripts );
  3512. }
  3513. fragment = results.fragment;
  3514. if ( fragment.childNodes.length === 1 ) {
  3515. first = fragment = fragment.firstChild;
  3516. } else {
  3517. first = fragment.firstChild;
  3518. }
  3519. if ( first ) {
  3520. table = table && jQuery.nodeName( first, "tr" );
  3521. for ( var i = 0, l = this.length; i < l; i++ ) {
  3522. callback.call(
  3523. table ?
  3524. root(this[i], first) :
  3525. this[i],
  3526. i > 0 || results.cacheable || this.length > 1 ?
  3527. fragment.cloneNode(true) :
  3528. fragment
  3529. );
  3530. }
  3531. }
  3532. if ( scripts.length ) {
  3533. jQuery.each( scripts, evalScript );
  3534. }
  3535. }
  3536. return this;
  3537. function root( elem, cur ) {
  3538. return jQuery.nodeName(elem, "table") ?
  3539. (elem.getElementsByTagName("tbody")[0] ||
  3540. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  3541. elem;
  3542. }
  3543. }
  3544. });
  3545. function cloneCopyEvent(orig, ret) {
  3546. var i = 0;
  3547. ret.each(function() {
  3548. if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
  3549. return;
  3550. }
  3551. var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
  3552. if ( events ) {
  3553. delete curData.handle;
  3554. curData.events = {};
  3555. for ( var type in events ) {
  3556. for ( var handler in events[ type ] ) {
  3557. jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
  3558. }
  3559. }
  3560. }
  3561. });
  3562. }
  3563. function buildFragment( args, nodes, scripts ) {
  3564. var fragment, cacheable, cacheresults,
  3565. doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
  3566. // Only cache "small" (1/2 KB) strings that are associated with the main document
  3567. // Cloning options loses the selected state, so don't cache them
  3568. // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
  3569. // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
  3570. if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
  3571. !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
  3572. cacheable = true;
  3573. cacheresults = jQuery.fragments[ args[0] ];
  3574. if ( cacheresults ) {
  3575. if ( cacheresults !== 1 ) {
  3576. fragment = cacheresults;
  3577. }
  3578. }
  3579. }
  3580. if ( !fragment ) {
  3581. fragment = doc.createDocumentFragment();
  3582. jQuery.clean( args, doc, fragment, scripts );
  3583. }
  3584. if ( cacheable ) {
  3585. jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
  3586. }
  3587. return { fragment: fragment, cacheable: cacheable };
  3588. }
  3589. jQuery.fragments = {};
  3590. jQuery.each({
  3591. appendTo: "append",
  3592. prependTo: "prepend",
  3593. insertBefore: "before",
  3594. insertAfter: "after",
  3595. replaceAll: "replaceWith"
  3596. }, function( name, original ) {
  3597. jQuery.fn[ name ] = function( selector ) {
  3598. var ret = [], insert = jQuery( selector ),
  3599. parent = this.length === 1 && this[0].parentNode;
  3600. if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
  3601. insert[ original ]( this[0] );
  3602. return this;
  3603. } else {
  3604. for ( var i = 0, l = insert.length; i < l; i++ ) {
  3605. var elems = (i > 0 ? this.clone(true) : this).get();
  3606. jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
  3607. ret = ret.concat( elems );
  3608. }
  3609. return this.pushStack( ret, name, insert.selector );
  3610. }
  3611. };
  3612. });
  3613. jQuery.extend({
  3614. clean: function( elems, context, fragment, scripts ) {
  3615. context = context || document;
  3616. // !context.createElement fails in IE with an error but returns typeof 'object'
  3617. if ( typeof context.createElement === "undefined" ) {
  3618. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  3619. }
  3620. var ret = [];
  3621. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  3622. if ( typeof elem === "number" ) {
  3623. elem += "";
  3624. }
  3625. if ( !elem ) {
  3626. continue;
  3627. }
  3628. // Convert html string into DOM nodes
  3629. if ( typeof elem === "string" && !rhtml.test( elem ) ) {
  3630. elem = context.createTextNode( elem );
  3631. } else if ( typeof elem === "string" ) {
  3632. // Fix "XHTML"-style tags in all browsers
  3633. elem = elem.replace(rxhtmlTag, fcloseTag);
  3634. // Trim whitespace, otherwise indexOf won't work as expected
  3635. var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
  3636. wrap = wrapMap[ tag ] || wrapMap._default,
  3637. depth = wrap[0],
  3638. div = context.createElement("div");
  3639. // Go to html and back, then peel off extra wrappers
  3640. div.innerHTML = wrap[1] + elem + wrap[2];
  3641. // Move to the right depth
  3642. while ( depth-- ) {
  3643. div = div.lastChild;
  3644. }
  3645. // Remove IE's autoinserted <tbody> from table fragments
  3646. if ( !jQuery.support.tbody ) {
  3647. // String was a <table>, *may* have spurious <tbody>
  3648. var hasBody = rtbody.test(elem),
  3649. tbody = tag === "table" && !hasBody ?
  3650. div.firstChild && div.firstChild.childNodes :
  3651. // String was a bare <thead> or <tfoot>
  3652. wrap[1] === "<table>" && !hasBody ?
  3653. div.childNodes :
  3654. [];
  3655. for ( var j = tbody.length - 1; j >= 0 ; --j ) {
  3656. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
  3657. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  3658. }
  3659. }
  3660. }
  3661. // IE completely kills leading whitespace when innerHTML is used
  3662. if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  3663. div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
  3664. }
  3665. elem = div.childNodes;
  3666. }
  3667. if ( elem.nodeType ) {
  3668. ret.push( elem );
  3669. } else {
  3670. ret = jQuery.merge( ret, elem );
  3671. }
  3672. }
  3673. if ( fragment ) {
  3674. for ( var i = 0; ret[i]; i++ ) {
  3675. if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  3676. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  3677. } else {
  3678. if ( ret[i].nodeType === 1 ) {
  3679. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  3680. }
  3681. fragment.appendChild( ret[i] );
  3682. }
  3683. }
  3684. }
  3685. return ret;
  3686. },
  3687. cleanData: function( elems ) {
  3688. var data, id, cache = jQuery.cache,
  3689. special = jQuery.event.special,
  3690. deleteExpando = jQuery.support.deleteExpando;
  3691. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  3692. id = elem[ jQuery.expando ];
  3693. if ( id ) {
  3694. data = cache[ id ];
  3695. if ( data.events ) {
  3696. for ( var type in data.events ) {
  3697. if ( special[ type ] ) {
  3698. jQuery.event.remove( elem, type );
  3699. } else {
  3700. removeEvent( elem, type, data.handle );
  3701. }
  3702. }
  3703. }
  3704. if ( deleteExpando ) {
  3705. delete elem[ jQuery.expando ];
  3706. } else if ( elem.removeAttribute ) {
  3707. elem.removeAttribute( jQuery.expando );
  3708. }
  3709. delete cache[ id ];
  3710. }
  3711. }
  3712. }
  3713. });
  3714. // exclude the following css properties to add px
  3715. var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  3716. ralpha = /alpha\([^)]*\)/,
  3717. ropacity = /opacity=([^)]*)/,
  3718. rfloat = /float/i,
  3719. rdashAlpha = /-([a-z])/ig,
  3720. rupper = /([A-Z])/g,
  3721. rnumpx = /^-?\d+(?:px)?$/i,
  3722. rnum = /^-?\d/,
  3723. cssShow = { position: "absolute", visibility: "hidden", display:"block" },
  3724. cssWidth = [ "Left", "Right" ],
  3725. cssHeight = [ "Top", "Bottom" ],
  3726. // cache check for defaultView.getComputedStyle
  3727. getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
  3728. // normalize float css property
  3729. styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
  3730. fcamelCase = function( all, letter ) {
  3731. return letter.toUpperCase();
  3732. };
  3733. jQuery.fn.css = function( name, value ) {
  3734. return access( this, name, value, true, function( elem, name, value ) {
  3735. if ( value === undefined ) {
  3736. return jQuery.curCSS( elem, name );
  3737. }
  3738. if ( typeof value === "number" && !rexclude.test(name) ) {
  3739. value += "px";
  3740. }
  3741. jQuery.style( elem, name, value );
  3742. });
  3743. };
  3744. jQuery.extend({
  3745. style: function( elem, name, value ) {
  3746. // don't set styles on text and comment nodes
  3747. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  3748. return undefined;
  3749. }
  3750. // ignore negative width and height values #1599
  3751. if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) {
  3752. value = undefined;
  3753. }
  3754. var style = elem.style || elem, set = value !== undefined;
  3755. // IE uses filters for opacity
  3756. if ( !jQuery.support.opacity && name === "opacity" ) {
  3757. if ( set ) {
  3758. // IE has trouble with opacity if it does not have layout
  3759. // Force it by setting the zoom level
  3760. style.zoom = 1;
  3761. // Set the alpha filter to set the opacity
  3762. var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")";
  3763. var filter = style.filter || jQuery.curCSS( elem, "filter" ) || "";
  3764. style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity;
  3765. }
  3766. return style.filter && style.filter.indexOf("opacity=") >= 0 ?
  3767. (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "":
  3768. "";
  3769. }
  3770. // Make sure we're using the right name for getting the float value
  3771. if ( rfloat.test( name ) ) {
  3772. name = styleFloat;
  3773. }
  3774. name = name.replace(rdashAlpha, fcamelCase);
  3775. if ( set ) {
  3776. style[ name ] = value;
  3777. }
  3778. return style[ name ];
  3779. },
  3780. css: function( elem, name, force, extra ) {
  3781. if ( name === "width" || name === "height" ) {
  3782. var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
  3783. function getWH() {
  3784. val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
  3785. if ( extra === "border" ) {
  3786. return;
  3787. }
  3788. jQuery.each( which, function() {
  3789. if ( !extra ) {
  3790. val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  3791. }
  3792. if ( extra === "margin" ) {
  3793. val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
  3794. } else {
  3795. val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  3796. }
  3797. });
  3798. }
  3799. if ( elem.offsetWidth !== 0 ) {
  3800. getWH();
  3801. } else {
  3802. jQuery.swap( elem, props, getWH );
  3803. }
  3804. return Math.max(0, Math.round(val));
  3805. }
  3806. return jQuery.curCSS( elem, name, force );
  3807. },
  3808. curCSS: function( elem, name, force ) {
  3809. var ret, style = elem.style, filter;
  3810. // IE uses filters for opacity
  3811. if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
  3812. ret = ropacity.test(elem.currentStyle.filter || "") ?
  3813. (parseFloat(RegExp.$1) / 100) + "" :
  3814. "";
  3815. return ret === "" ?
  3816. "1" :
  3817. ret;
  3818. }
  3819. // Make sure we're using the right name for getting the float value
  3820. if ( rfloat.test( name ) ) {
  3821. name = styleFloat;
  3822. }
  3823. if ( !force && style && style[ name ] ) {
  3824. ret = style[ name ];
  3825. } else if ( getComputedStyle ) {
  3826. // Only "float" is needed here
  3827. if ( rfloat.test( name ) ) {
  3828. name = "float";
  3829. }
  3830. name = name.replace( rupper, "-$1" ).toLowerCase();
  3831. var defaultView = elem.ownerDocument.defaultView;
  3832. if ( !defaultView ) {
  3833. return null;
  3834. }
  3835. var computedStyle = defaultView.getComputedStyle( elem, null );
  3836. if ( computedStyle ) {
  3837. ret = computedStyle.getPropertyValue( name );
  3838. }
  3839. // We should always get a number back from opacity
  3840. if ( name === "opacity" && ret === "" ) {
  3841. ret = "1";
  3842. }
  3843. } else if ( elem.currentStyle ) {
  3844. var camelCase = name.replace(rdashAlpha, fcamelCase);
  3845. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  3846. // From the awesome hack by Dean Edwards
  3847. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  3848. // If we're not dealing with a regular pixel number
  3849. // but a number that has a weird ending, we need to convert it to pixels
  3850. if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
  3851. // Remember the original values
  3852. var left = style.left, rsLeft = elem.runtimeStyle.left;
  3853. // Put in the new values to get a computed value out
  3854. elem.runtimeStyle.left = elem.currentStyle.left;
  3855. style.left = camelCase === "fontSize" ? "1em" : (ret || 0);
  3856. ret = style.pixelLeft + "px";
  3857. // Revert the changed values
  3858. style.left = left;
  3859. elem.runtimeStyle.left = rsLeft;
  3860. }
  3861. }
  3862. return ret;
  3863. },
  3864. // A method for quickly swapping in/out CSS properties to get correct calculations
  3865. swap: function( elem, options, callback ) {
  3866. var old = {};
  3867. // Remember the old values, and insert the new ones
  3868. for ( var name in options ) {
  3869. old[ name ] = elem.style[ name ];
  3870. elem.style[ name ] = options[ name ];
  3871. }
  3872. callback.call( elem );
  3873. // Revert the old values
  3874. for ( var name in options ) {
  3875. elem.style[ name ] = old[ name ];
  3876. }
  3877. }
  3878. });
  3879. if ( jQuery.expr && jQuery.expr.filters ) {
  3880. jQuery.expr.filters.hidden = function( elem ) {
  3881. var width = elem.offsetWidth, height = elem.offsetHeight,
  3882. skip = elem.nodeName.toLowerCase() === "tr";
  3883. return width === 0 && height === 0 && !skip ?
  3884. true :
  3885. width > 0 && height > 0 && !skip ?
  3886. false :
  3887. jQuery.curCSS(elem, "display") === "none";
  3888. };
  3889. jQuery.expr.filters.visible = function( elem ) {
  3890. return !jQuery.expr.filters.hidden( elem );
  3891. };
  3892. }
  3893. var jsc = now(),
  3894. rscript = /<script(.|\s)*?\/script>/gi,
  3895. rselectTextarea = /select|textarea/i,
  3896. rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
  3897. jsre = /=\?(&|$)/,
  3898. rquery = /\?/,
  3899. rts = /(\?|&)_=.*?(&|$)/,
  3900. rurl = /^(\w+:)?\/\/([^\/?#]+)/,
  3901. r20 = /%20/g,
  3902. // Keep a copy of the old load method
  3903. _load = jQuery.fn.load;
  3904. jQuery.fn.extend({
  3905. load: function( url, params, callback ) {
  3906. if ( typeof url !== "string" ) {
  3907. return _load.call( this, url );
  3908. // Don't do a request if no elements are being requested
  3909. } else if ( !this.length ) {
  3910. return this;
  3911. }
  3912. var off = url.indexOf(" ");
  3913. if ( off >= 0 ) {
  3914. var selector = url.slice(off, url.length);
  3915. url = url.slice(0, off);
  3916. }
  3917. // Default to a GET request
  3918. var type = "GET";
  3919. // If the second parameter was provided
  3920. if ( params ) {
  3921. // If it's a function
  3922. if ( jQuery.isFunction( params ) ) {
  3923. // We assume that it's the callback
  3924. callback = params;
  3925. params = null;
  3926. // Otherwise, build a param string
  3927. } else if ( typeof params === "object" ) {
  3928. params = jQuery.param( params, jQuery.ajaxSettings.traditional );
  3929. type = "POST";
  3930. }
  3931. }
  3932. var self = this;
  3933. // Request the remote document
  3934. jQuery.ajax({
  3935. url: url,
  3936. type: type,
  3937. dataType: "html",
  3938. data: params,
  3939. complete: function( res, status ) {
  3940. // If successful, inject the HTML into all the matched elements
  3941. if ( status === "success" || status === "notmodified" ) {
  3942. // See if a selector was specified
  3943. self.html( selector ?
  3944. // Create a dummy div to hold the results
  3945. jQuery("<div />")
  3946. // inject the contents of the document in, removing the scripts
  3947. // to avoid any 'Permission Denied' errors in IE
  3948. .append(res.responseText.replace(rscript, ""))
  3949. // Locate the specified elements
  3950. .find(selector) :
  3951. // If not, just inject the full result
  3952. res.responseText );
  3953. }
  3954. if ( callback ) {
  3955. self.each( callback, [res.responseText, status, res] );
  3956. }
  3957. }
  3958. });
  3959. return this;
  3960. },
  3961. serialize: function() {
  3962. return jQuery.param(this.serializeArray());
  3963. },
  3964. serializeArray: function() {
  3965. return this.map(function() {
  3966. return this.elements ? jQuery.makeArray(this.elements) : this;
  3967. })
  3968. .filter(function() {
  3969. return this.name && !this.disabled &&
  3970. (this.checked || rselectTextarea.test(this.nodeName) ||
  3971. rinput.test(this.type));
  3972. })
  3973. .map(function( i, elem ) {
  3974. var val = jQuery(this).val();
  3975. return val == null ?
  3976. null :
  3977. jQuery.isArray(val) ?
  3978. jQuery.map( val, function( val, i ) {
  3979. return { name: elem.name, value: val };
  3980. }) :
  3981. { name: elem.name, value: val };
  3982. }).get();
  3983. }
  3984. });
  3985. // Attach a bunch of functions for handling common AJAX events
  3986. jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
  3987. jQuery.fn[o] = function( f ) {
  3988. return this.bind(o, f);
  3989. };
  3990. });
  3991. jQuery.extend({
  3992. get: function( url, data, callback, type ) {
  3993. // shift arguments if data argument was omitted
  3994. if ( jQuery.isFunction( data ) ) {
  3995. type = type || callback;
  3996. callback = data;
  3997. data = null;
  3998. }
  3999. return jQuery.ajax({
  4000. type: "GET",
  4001. url: url,
  4002. data: data,
  4003. success: callback,
  4004. dataType: type
  4005. });
  4006. },
  4007. getScript: function( url, callback ) {
  4008. return jQuery.get(url, null, callback, "script");
  4009. },
  4010. getJSON: function( url, data, callback ) {
  4011. return jQuery.get(url, data, callback, "json");
  4012. },
  4013. post: function( url, data, callback, type ) {
  4014. // shift arguments if data argument was omitted
  4015. if ( jQuery.isFunction( data ) ) {
  4016. type = type || callback;
  4017. callback = data;
  4018. data = {};
  4019. }
  4020. return jQuery.ajax({
  4021. type: "POST",
  4022. url: url,
  4023. data: data,
  4024. success: callback,
  4025. dataType: type
  4026. });
  4027. },
  4028. ajaxSetup: function( settings ) {
  4029. jQuery.extend( jQuery.ajaxSettings, settings );
  4030. },
  4031. ajaxSettings: {
  4032. url: location.href,
  4033. global: true,
  4034. type: "GET",
  4035. contentType: "application/x-www-form-urlencoded",
  4036. processData: true,
  4037. async: true,
  4038. /*
  4039. timeout: 0,
  4040. data: null,
  4041. username: null,
  4042. password: null,
  4043. traditional: false,
  4044. */
  4045. // Create the request object; Microsoft failed to properly
  4046. // implement the XMLHttpRequest in IE7 (can't request local files),
  4047. // so we use the ActiveXObject when it is available
  4048. // This function can be overridden by calling jQuery.ajaxSetup
  4049. xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?
  4050. function() {
  4051. return new window.XMLHttpRequest();
  4052. } :
  4053. function() {
  4054. try {
  4055. return new window.ActiveXObject("Microsoft.XMLHTTP");
  4056. } catch(e) {}
  4057. },
  4058. accepts: {
  4059. xml: "application/xml, text/xml",
  4060. html: "text/html",
  4061. script: "text/javascript, application/javascript",
  4062. json: "application/json, text/javascript",
  4063. text: "text/plain",
  4064. _default: "*/*"
  4065. }
  4066. },
  4067. // Last-Modified header cache for next request
  4068. lastModified: {},
  4069. etag: {},
  4070. ajax: function( origSettings ) {
  4071. var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
  4072. var jsonp, status, data,
  4073. callbackContext = origSettings && origSettings.context || s,
  4074. type = s.type.toUpperCase();
  4075. // convert data if not already a string
  4076. if ( s.data && s.processData && typeof s.data !== "string" ) {
  4077. s.data = jQuery.param( s.data, s.traditional );
  4078. }
  4079. // Handle JSONP Parameter Callbacks
  4080. if ( s.dataType === "jsonp" ) {
  4081. if ( type === "GET" ) {
  4082. if ( !jsre.test( s.url ) ) {
  4083. s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
  4084. }
  4085. } else if ( !s.data || !jsre.test(s.data) ) {
  4086. s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
  4087. }
  4088. s.dataType = "json";
  4089. }
  4090. // Build temporary JSONP function
  4091. if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
  4092. jsonp = s.jsonpCallback || ("jsonp" + jsc++);
  4093. // Replace the =? sequence both in the query string and the data
  4094. if ( s.data ) {
  4095. s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
  4096. }
  4097. s.url = s.url.replace(jsre, "=" + jsonp + "$1");
  4098. // We need to make sure
  4099. // that a JSONP style response is executed properly
  4100. s.dataType = "script";
  4101. // Handle JSONP-style loading
  4102. window[ jsonp ] = window[ jsonp ] || function( tmp ) {
  4103. data = tmp;
  4104. success();
  4105. complete();
  4106. // Garbage collect
  4107. window[ jsonp ] = undefined;
  4108. try {
  4109. delete window[ jsonp ];
  4110. } catch(e) {}
  4111. if ( head ) {
  4112. head.removeChild( script );
  4113. }
  4114. };
  4115. }
  4116. if ( s.dataType === "script" && s.cache === null ) {
  4117. s.cache = false;
  4118. }
  4119. if ( s.cache === false && type === "GET" ) {
  4120. var ts = now();
  4121. // try replacing _= if it is there
  4122. var ret = s.url.replace(rts, "$1_=" + ts + "$2");
  4123. // if nothing was replaced, add timestamp to the end
  4124. s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
  4125. }
  4126. // If data is available, append data to url for get requests
  4127. if ( s.data && type === "GET" ) {
  4128. s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
  4129. }
  4130. // Watch for a new set of requests
  4131. if ( s.global && ! jQuery.active++ ) {
  4132. jQuery.event.trigger( "ajaxStart" );
  4133. }
  4134. // Matches an absolute URL, and saves the domain
  4135. var parts = rurl.exec( s.url ),
  4136. remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
  4137. // If we're requesting a remote document
  4138. // and trying to load JSON or Script with a GET
  4139. if ( s.dataType === "script" && type === "GET" && remote ) {
  4140. var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
  4141. var script = document.createElement("script");
  4142. script.src = s.url;
  4143. if ( s.scriptCharset ) {
  4144. script.charset = s.scriptCharset;
  4145. }
  4146. // Handle Script loading
  4147. if ( !jsonp ) {
  4148. var done = false;
  4149. // Attach handlers for all browsers
  4150. script.onload = script.onreadystatechange = function() {
  4151. if ( !done && (!this.readyState ||
  4152. this.readyState === "loaded" || this.readyState === "complete") ) {
  4153. done = true;
  4154. success();
  4155. complete();
  4156. // Handle memory leak in IE
  4157. script.onload = script.onreadystatechange = null;
  4158. if ( head && script.parentNode ) {
  4159. head.removeChild( script );
  4160. }
  4161. }
  4162. };
  4163. }
  4164. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  4165. // This arises when a base node is used (#2709 and #4378).
  4166. head.insertBefore( script, head.firstChild );
  4167. // We handle everything using the script element injection
  4168. return undefined;
  4169. }
  4170. var requestDone = false;
  4171. // Create the request object
  4172. var xhr = s.xhr();
  4173. if ( !xhr ) {
  4174. return;
  4175. }
  4176. // Open the socket
  4177. // Passing null username, generates a login popup on Opera (#2865)
  4178. if ( s.username ) {
  4179. xhr.open(type, s.url, s.async, s.username, s.password);
  4180. } else {
  4181. xhr.open(type, s.url, s.async);
  4182. }
  4183. // Need an extra try/catch for cross domain requests in Firefox 3
  4184. try {
  4185. // Set the correct header, if data is being sent
  4186. if ( s.data || origSettings && origSettings.contentType ) {
  4187. xhr.setRequestHeader("Content-Type", s.contentType);
  4188. }
  4189. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  4190. if ( s.ifModified ) {
  4191. if ( jQuery.lastModified[s.url] ) {
  4192. xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
  4193. }
  4194. if ( jQuery.etag[s.url] ) {
  4195. xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
  4196. }
  4197. }
  4198. // Set header so the called script knows that it's an XMLHttpRequest
  4199. // Only send the header if it's not a remote XHR
  4200. if ( !remote ) {
  4201. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  4202. }
  4203. // Set the Accepts header for the server, depending on the dataType
  4204. xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
  4205. s.accepts[ s.dataType ] + ", */*" :
  4206. s.accepts._default );
  4207. } catch(e) {}
  4208. // Allow custom headers/mimetypes and early abort
  4209. if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) {
  4210. // Handle the global AJAX counter
  4211. if ( s.global && ! --jQuery.active ) {
  4212. jQuery.event.trigger( "ajaxStop" );
  4213. }
  4214. // close opened socket
  4215. xhr.abort();
  4216. return false;
  4217. }
  4218. if ( s.global ) {
  4219. trigger("ajaxSend", [xhr, s]);
  4220. }
  4221. // Wait for a response to come back
  4222. var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
  4223. // The request was aborted
  4224. if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
  4225. // Opera doesn't call onreadystatechange before this point
  4226. // so we simulate the call
  4227. if ( !requestDone ) {
  4228. complete();
  4229. }
  4230. requestDone = true;
  4231. if ( xhr ) {
  4232. xhr.onreadystatechange = jQuery.noop;
  4233. }
  4234. // The transfer is complete and the data is available, or the request timed out
  4235. } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
  4236. requestDone = true;
  4237. xhr.onreadystatechange = jQuery.noop;
  4238. status = isTimeout === "timeout" ?
  4239. "timeout" :
  4240. !jQuery.httpSuccess( xhr ) ?
  4241. "error" :
  4242. s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
  4243. "notmodified" :
  4244. "success";
  4245. var errMsg;
  4246. if ( status === "success" ) {
  4247. // Watch for, and catch, XML document parse errors
  4248. try {
  4249. // process the data (runs the xml through httpData regardless of callback)
  4250. data = jQuery.httpData( xhr, s.dataType, s );
  4251. } catch(err) {
  4252. status = "parsererror";
  4253. errMsg = err;
  4254. }
  4255. }
  4256. // Make sure that the request was successful or notmodified
  4257. if ( status === "success" || status === "notmodified" ) {
  4258. // JSONP handles its own success callback
  4259. if ( !jsonp ) {
  4260. success();
  4261. }
  4262. } else {
  4263. jQuery.handleError(s, xhr, status, errMsg);
  4264. }
  4265. // Fire the complete handlers
  4266. complete();
  4267. if ( isTimeout === "timeout" ) {
  4268. xhr.abort();
  4269. }
  4270. // Stop memory leaks
  4271. if ( s.async ) {
  4272. xhr = null;
  4273. }
  4274. }
  4275. };
  4276. // Override the abort handler, if we can (IE doesn't allow it, but that's OK)
  4277. // Opera doesn't fire onreadystatechange at all on abort
  4278. try {
  4279. var oldAbort = xhr.abort;
  4280. xhr.abort = function() {
  4281. if ( xhr ) {
  4282. oldAbort.call( xhr );
  4283. }
  4284. onreadystatechange( "abort" );
  4285. };
  4286. } catch(e) { }
  4287. // Timeout checker
  4288. if ( s.async && s.timeout > 0 ) {
  4289. setTimeout(function() {
  4290. // Check to see if the request is still happening
  4291. if ( xhr && !requestDone ) {
  4292. onreadystatechange( "timeout" );
  4293. }
  4294. }, s.timeout);
  4295. }
  4296. // Send the data
  4297. try {
  4298. xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );
  4299. } catch(e) {
  4300. jQuery.handleError(s, xhr, null, e);
  4301. // Fire the complete handlers
  4302. complete();
  4303. }
  4304. // Firefox 1.5 doesn't fire statechange for sync requests
  4305. if ( !s.async ) {
  4306. onreadystatechange();
  4307. }
  4308. function success() {
  4309. // If a local callback was specified, fire it and pass it the data
  4310. if ( s.success ) {
  4311. s.success.call( callbackContext, data, status, xhr );
  4312. }
  4313. // Fire the global callback
  4314. if ( s.global ) {
  4315. trigger( "ajaxSuccess", [xhr, s] );
  4316. }
  4317. }
  4318. function complete() {
  4319. // Process result
  4320. if ( s.complete ) {
  4321. s.complete.call( callbackContext, xhr, status);
  4322. }
  4323. // The request was completed
  4324. if ( s.global ) {
  4325. trigger( "ajaxComplete", [xhr, s] );
  4326. }
  4327. // Handle the global AJAX counter
  4328. if ( s.global && ! --jQuery.active ) {
  4329. jQuery.event.trigger( "ajaxStop" );
  4330. }
  4331. }
  4332. function trigger(type, args) {
  4333. (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
  4334. }
  4335. // return XMLHttpRequest to allow aborting the request etc.
  4336. return xhr;
  4337. },
  4338. handleError: function( s, xhr, status, e ) {
  4339. // If a local callback was specified, fire it
  4340. if ( s.error ) {
  4341. s.error.call( s.context || s, xhr, status, e );
  4342. }
  4343. // Fire the global callback
  4344. if ( s.global ) {
  4345. (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
  4346. }
  4347. },
  4348. // Counter for holding the number of active queries
  4349. active: 0,
  4350. // Determines if an XMLHttpRequest was successful or not
  4351. httpSuccess: function( xhr ) {
  4352. try {
  4353. // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
  4354. return !xhr.status && location.protocol === "file:" ||
  4355. // Opera returns 0 when status is 304
  4356. ( xhr.status >= 200 && xhr.status < 300 ) ||
  4357. xhr.status === 304 || xhr.status === 1223 || xhr.status === 0;
  4358. } catch(e) {}
  4359. return false;
  4360. },
  4361. // Determines if an XMLHttpRequest returns NotModified
  4362. httpNotModified: function( xhr, url ) {
  4363. var lastModified = xhr.getResponseHeader("Last-Modified"),
  4364. etag = xhr.getResponseHeader("Etag");
  4365. if ( lastModified ) {
  4366. jQuery.lastModified[url] = lastModified;
  4367. }
  4368. if ( etag ) {
  4369. jQuery.etag[url] = etag;
  4370. }
  4371. // Opera returns 0 when status is 304
  4372. return xhr.status === 304 || xhr.status === 0;
  4373. },
  4374. httpData: function( xhr, type, s ) {
  4375. var ct = xhr.getResponseHeader("content-type") || "",
  4376. xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
  4377. data = xml ? xhr.responseXML : xhr.responseText;
  4378. if ( xml && data.documentElement.nodeName === "parsererror" ) {
  4379. jQuery.error( "parsererror" );
  4380. }
  4381. // Allow a pre-filtering function to sanitize the response
  4382. // s is checked to keep backwards compatibility
  4383. if ( s && s.dataFilter ) {
  4384. data = s.dataFilter( data, type );
  4385. }
  4386. // The filter can actually parse the response
  4387. if ( typeof data === "string" ) {
  4388. // Get the JavaScript object, if JSON is used.
  4389. if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
  4390. data = jQuery.parseJSON( data );
  4391. // If the type is "script", eval it in global context
  4392. } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
  4393. jQuery.globalEval( data );
  4394. }
  4395. }
  4396. return data;
  4397. },
  4398. // Serialize an array of form elements or a set of
  4399. // key/values into a query string
  4400. param: function( a, traditional ) {
  4401. var s = [];
  4402. // Set traditional to true for jQuery <= 1.3.2 behavior.
  4403. if ( traditional === undefined ) {
  4404. traditional = jQuery.ajaxSettings.traditional;
  4405. }
  4406. // If an array was passed in, assume that it is an array of form elements.
  4407. if ( jQuery.isArray(a) || a.jquery ) {
  4408. // Serialize the form elements
  4409. jQuery.each( a, function() {
  4410. add( this.name, this.value );
  4411. });
  4412. } else {
  4413. // If traditional, encode the "old" way (the way 1.3.2 or older
  4414. // did it), otherwise encode params recursively.
  4415. for ( var prefix in a ) {
  4416. buildParams( prefix, a[prefix] );
  4417. }
  4418. }
  4419. // Return the resulting serialization
  4420. return s.join("&").replace(r20, "+");
  4421. function buildParams( prefix, obj ) {
  4422. if ( jQuery.isArray(obj) ) {
  4423. // Serialize array item.
  4424. jQuery.each( obj, function( i, v ) {
  4425. if ( traditional || /\[\]$/.test( prefix ) ) {
  4426. // Treat each array item as a scalar.
  4427. add( prefix, v );
  4428. } else {
  4429. // If array item is non-scalar (array or object), encode its
  4430. // numeric index to resolve deserialization ambiguity issues.
  4431. // Note that rack (as of 1.0.0) can't currently deserialize
  4432. // nested arrays properly, and attempting to do so may cause
  4433. // a server error. Possible fixes are to modify rack's
  4434. // deserialization algorithm or to provide an option or flag
  4435. // to force array serialization to be shallow.
  4436. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
  4437. }
  4438. });
  4439. } else if ( !traditional && obj != null && typeof obj === "object" ) {
  4440. // Serialize object item.
  4441. jQuery.each( obj, function( k, v ) {
  4442. buildParams( prefix + "[" + k + "]", v );
  4443. });
  4444. } else {
  4445. // Serialize scalar item.
  4446. add( prefix, obj );
  4447. }
  4448. }
  4449. function add( key, value ) {
  4450. // If value is a function, invoke it and return its value
  4451. value = jQuery.isFunction(value) ? value() : value;
  4452. s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
  4453. }
  4454. }
  4455. });
  4456. var elemdisplay = {},
  4457. rfxtypes = /toggle|show|hide/,
  4458. rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/,
  4459. timerId,
  4460. fxAttrs = [
  4461. // height animations
  4462. [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  4463. // width animations
  4464. [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  4465. // opacity animations
  4466. [ "opacity" ]
  4467. ];
  4468. jQuery.fn.extend({
  4469. show: function( speed, callback ) {
  4470. if ( speed || speed === 0) {
  4471. return this.animate( genFx("show", 3), speed, callback);
  4472. } else {
  4473. for ( var i = 0, l = this.length; i < l; i++ ) {
  4474. var old = jQuery.data(this[i], "olddisplay");
  4475. this[i].style.display = old || "";
  4476. if ( jQuery.css(this[i], "display") === "none" ) {
  4477. var nodeName = this[i].nodeName, display;
  4478. if ( elemdisplay[ nodeName ] ) {
  4479. display = elemdisplay[ nodeName ];
  4480. } else {
  4481. var elem = jQuery("<" + nodeName + " />").appendTo("body");
  4482. display = elem.css("display");
  4483. if ( display === "none" ) {
  4484. display = "block";
  4485. }
  4486. elem.remove();
  4487. elemdisplay[ nodeName ] = display;
  4488. }
  4489. jQuery.data(this[i], "olddisplay", display);
  4490. }
  4491. }
  4492. // Set the display of the elements in a second loop
  4493. // to avoid the constant reflow
  4494. for ( var j = 0, k = this.length; j < k; j++ ) {
  4495. this[j].style.display = jQuery.data(this[j], "olddisplay") || "";
  4496. }
  4497. return this;
  4498. }
  4499. },
  4500. hide: function( speed, callback ) {
  4501. if ( speed || speed === 0 ) {
  4502. return this.animate( genFx("hide", 3), speed, callback);
  4503. } else {
  4504. for ( var i = 0, l = this.length; i < l; i++ ) {
  4505. var old = jQuery.data(this[i], "olddisplay");
  4506. if ( !old && old !== "none" ) {
  4507. jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
  4508. }
  4509. }
  4510. // Set the display of the elements in a second loop
  4511. // to avoid the constant reflow
  4512. for ( var j = 0, k = this.length; j < k; j++ ) {
  4513. this[j].style.display = "none";
  4514. }
  4515. return this;
  4516. }
  4517. },
  4518. // Save the old toggle function
  4519. _toggle: jQuery.fn.toggle,
  4520. toggle: function( fn, fn2 ) {
  4521. var bool = typeof fn === "boolean";
  4522. if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
  4523. this._toggle.apply( this, arguments );
  4524. } else if ( fn == null || bool ) {
  4525. this.each(function() {
  4526. var state = bool ? fn : jQuery(this).is(":hidden");
  4527. jQuery(this)[ state ? "show" : "hide" ]();
  4528. });
  4529. } else {
  4530. this.animate(genFx("toggle", 3), fn, fn2);
  4531. }
  4532. return this;
  4533. },
  4534. fadeTo: function( speed, to, callback ) {
  4535. return this.filter(":hidden").css("opacity", 0).show().end()
  4536. .animate({opacity: to}, speed, callback);
  4537. },
  4538. animate: function( prop, speed, easing, callback ) {
  4539. var optall = jQuery.speed(speed, easing, callback);
  4540. if ( jQuery.isEmptyObject( prop ) ) {
  4541. return this.each( optall.complete );
  4542. }
  4543. return this[ optall.queue === false ? "each" : "queue" ](function() {
  4544. var opt = jQuery.extend({}, optall), p,
  4545. hidden = this.nodeType === 1 && jQuery(this).is(":hidden"),
  4546. self = this;
  4547. for ( p in prop ) {
  4548. var name = p.replace(rdashAlpha, fcamelCase);
  4549. if ( p !== name ) {
  4550. prop[ name ] = prop[ p ];
  4551. delete prop[ p ];
  4552. p = name;
  4553. }
  4554. if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
  4555. return opt.complete.call(this);
  4556. }
  4557. if ( ( p === "height" || p === "width" ) && this.style ) {
  4558. // Store display property
  4559. opt.display = jQuery.css(this, "display");
  4560. // Make sure that nothing sneaks out
  4561. opt.overflow = this.style.overflow;
  4562. }
  4563. if ( jQuery.isArray( prop[p] ) ) {
  4564. // Create (if needed) and add to specialEasing
  4565. (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
  4566. prop[p] = prop[p][0];
  4567. }
  4568. }
  4569. if ( opt.overflow != null ) {
  4570. this.style.overflow = "hidden";
  4571. }
  4572. opt.curAnim = jQuery.extend({}, prop);
  4573. jQuery.each( prop, function( name, val ) {
  4574. var e = new jQuery.fx( self, opt, name );
  4575. if ( rfxtypes.test(val) ) {
  4576. e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  4577. } else {
  4578. var parts = rfxnum.exec(val),
  4579. start = e.cur(true) || 0;
  4580. if ( parts ) {
  4581. var end = parseFloat( parts[2] ),
  4582. unit = parts[3] || "px";
  4583. // We need to compute starting value
  4584. if ( unit !== "px" ) {
  4585. self.style[ name ] = (end || 1) + unit;
  4586. start = ((end || 1) / e.cur(true)) * start;
  4587. self.style[ name ] = start + unit;
  4588. }
  4589. // If a +=/-= token was provided, we're doing a relative animation
  4590. if ( parts[1] ) {
  4591. end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
  4592. }
  4593. e.custom( start, end, unit );
  4594. } else {
  4595. e.custom( start, val, "" );
  4596. }
  4597. }
  4598. });
  4599. // For JS strict compliance
  4600. return true;
  4601. });
  4602. },
  4603. stop: function( clearQueue, gotoEnd ) {
  4604. var timers = jQuery.timers;
  4605. if ( clearQueue ) {
  4606. this.queue([]);
  4607. }
  4608. this.each(function() {
  4609. // go in reverse order so anything added to the queue during the loop is ignored
  4610. for ( var i = timers.length - 1; i >= 0; i-- ) {
  4611. if ( timers[i].elem === this ) {
  4612. if (gotoEnd) {
  4613. // force the next step to be the last
  4614. timers[i](true);
  4615. }
  4616. timers.splice(i, 1);
  4617. }
  4618. }
  4619. });
  4620. // start the next in the queue if the last step wasn't forced
  4621. if ( !gotoEnd ) {
  4622. this.dequeue();
  4623. }
  4624. return this;
  4625. }
  4626. });
  4627. // Generate shortcuts for custom animations
  4628. jQuery.each({
  4629. slideDown: genFx("show", 1),
  4630. slideUp: genFx("hide", 1),
  4631. slideToggle: genFx("toggle", 1),
  4632. fadeIn: { opacity: "show" },
  4633. fadeOut: { opacity: "hide" }
  4634. }, function( name, props ) {
  4635. jQuery.fn[ name ] = function( speed, callback ) {
  4636. return this.animate( props, speed, callback );
  4637. };
  4638. });
  4639. jQuery.extend({
  4640. speed: function( speed, easing, fn ) {
  4641. var opt = speed && typeof speed === "object" ? speed : {
  4642. complete: fn || !fn && easing ||
  4643. jQuery.isFunction( speed ) && speed,
  4644. duration: speed,
  4645. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  4646. };
  4647. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  4648. jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
  4649. // Queueing
  4650. opt.old = opt.complete;
  4651. opt.complete = function() {
  4652. if ( opt.queue !== false ) {
  4653. jQuery(this).dequeue();
  4654. }
  4655. if ( jQuery.isFunction( opt.old ) ) {
  4656. opt.old.call( this );
  4657. }
  4658. };
  4659. return opt;
  4660. },
  4661. easing: {
  4662. linear: function( p, n, firstNum, diff ) {
  4663. return firstNum + diff * p;
  4664. },
  4665. swing: function( p, n, firstNum, diff ) {
  4666. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  4667. }
  4668. },
  4669. timers: [],
  4670. fx: function( elem, options, prop ) {
  4671. this.options = options;
  4672. this.elem = elem;
  4673. this.prop = prop;
  4674. if ( !options.orig ) {
  4675. options.orig = {};
  4676. }
  4677. }
  4678. });
  4679. jQuery.fx.prototype = {
  4680. // Simple function for setting a style value
  4681. update: function() {
  4682. if ( this.options.step ) {
  4683. this.options.step.call( this.elem, this.now, this );
  4684. }
  4685. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  4686. // Set display property to block for height/width animations
  4687. if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) {
  4688. this.elem.style.display = "block";
  4689. }
  4690. },
  4691. // Get the current size
  4692. cur: function( force ) {
  4693. if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
  4694. return this.elem[ this.prop ];
  4695. }
  4696. var r = parseFloat(jQuery.css(this.elem, this.prop, force));
  4697. return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
  4698. },
  4699. // Start an animation from one number to another
  4700. custom: function( from, to, unit ) {
  4701. this.startTime = now();
  4702. this.start = from;
  4703. this.end = to;
  4704. this.unit = unit || this.unit || "px";
  4705. this.now = this.start;
  4706. this.pos = this.state = 0;
  4707. var self = this;
  4708. function t( gotoEnd ) {
  4709. return self.step(gotoEnd);
  4710. }
  4711. t.elem = this.elem;
  4712. if ( t() && jQuery.timers.push(t) && !timerId ) {
  4713. timerId = setInterval(jQuery.fx.tick, 13);
  4714. }
  4715. },
  4716. // Simple 'show' function
  4717. show: function() {
  4718. // Remember where we started, so that we can go back to it later
  4719. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  4720. this.options.show = true;
  4721. // Begin the animation
  4722. // Make sure that we start at a small width/height to avoid any
  4723. // flash of content
  4724. this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
  4725. // Start by showing the element
  4726. jQuery( this.elem ).show();
  4727. },
  4728. // Simple 'hide' function
  4729. hide: function() {
  4730. // Remember where we started, so that we can go back to it later
  4731. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  4732. this.options.hide = true;
  4733. // Begin the animation
  4734. this.custom(this.cur(), 0);
  4735. },
  4736. // Each step of an animation
  4737. step: function( gotoEnd ) {
  4738. var t = now(), done = true;
  4739. if ( gotoEnd || t >= this.options.duration + this.startTime ) {
  4740. this.now = this.end;
  4741. this.pos = this.state = 1;
  4742. this.update();
  4743. this.options.curAnim[ this.prop ] = true;
  4744. for ( var i in this.options.curAnim ) {
  4745. if ( this.options.curAnim[i] !== true ) {
  4746. done = false;
  4747. }
  4748. }
  4749. if ( done ) {
  4750. if ( this.options.display != null ) {
  4751. // Reset the overflow
  4752. this.elem.style.overflow = this.options.overflow;
  4753. // Reset the display
  4754. var old = jQuery.data(this.elem, "olddisplay");
  4755. this.elem.style.display = old ? old : this.options.display;
  4756. if ( jQuery.css(this.elem, "display") === "none" ) {
  4757. this.elem.style.display = "block";
  4758. }
  4759. }
  4760. // Hide the element if the "hide" operation was done
  4761. if ( this.options.hide ) {
  4762. jQuery(this.elem).hide();
  4763. }
  4764. // Reset the properties, if the item has been hidden or shown
  4765. if ( this.options.hide || this.options.show ) {
  4766. for ( var p in this.options.curAnim ) {
  4767. jQuery.style(this.elem, p, this.options.orig[p]);
  4768. }
  4769. }
  4770. // Execute the complete function
  4771. this.options.complete.call( this.elem );
  4772. }
  4773. return false;
  4774. } else {
  4775. var n = t - this.startTime;
  4776. this.state = n / this.options.duration;
  4777. // Perform the easing function, defaults to swing
  4778. var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
  4779. var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
  4780. this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
  4781. this.now = this.start + ((this.end - this.start) * this.pos);
  4782. // Perform the next step of the animation
  4783. this.update();
  4784. }
  4785. return true;
  4786. }
  4787. };
  4788. jQuery.extend( jQuery.fx, {
  4789. tick: function() {
  4790. var timers = jQuery.timers;
  4791. for ( var i = 0; i < timers.length; i++ ) {
  4792. if ( !timers[i]() ) {
  4793. timers.splice(i--, 1);
  4794. }
  4795. }
  4796. if ( !timers.length ) {
  4797. jQuery.fx.stop();
  4798. }
  4799. },
  4800. stop: function() {
  4801. clearInterval( timerId );
  4802. timerId = null;
  4803. },
  4804. speeds: {
  4805. slow: 600,
  4806. fast: 200,
  4807. // Default speed
  4808. _default: 400
  4809. },
  4810. step: {
  4811. opacity: function( fx ) {
  4812. jQuery.style(fx.elem, "opacity", fx.now);
  4813. },
  4814. _default: function( fx ) {
  4815. if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
  4816. fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
  4817. } else {
  4818. fx.elem[ fx.prop ] = fx.now;
  4819. }
  4820. }
  4821. }
  4822. });
  4823. if ( jQuery.expr && jQuery.expr.filters ) {
  4824. jQuery.expr.filters.animated = function( elem ) {
  4825. return jQuery.grep(jQuery.timers, function( fn ) {
  4826. return elem === fn.elem;
  4827. }).length;
  4828. };
  4829. }
  4830. function genFx( type, num ) {
  4831. var obj = {};
  4832. jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
  4833. obj[ this ] = type;
  4834. });
  4835. return obj;
  4836. }
  4837. if ( "getBoundingClientRect" in document.documentElement ) {
  4838. jQuery.fn.offset = function( options ) {
  4839. var elem = this[0];
  4840. if ( options ) {
  4841. return this.each(function( i ) {
  4842. jQuery.offset.setOffset( this, options, i );
  4843. });
  4844. }
  4845. if ( !elem || !elem.ownerDocument ) {
  4846. return null;
  4847. }
  4848. if ( elem === elem.ownerDocument.body ) {
  4849. return jQuery.offset.bodyOffset( elem );
  4850. }
  4851. var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement,
  4852. clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
  4853. top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
  4854. left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
  4855. return { top: top, left: left };
  4856. };
  4857. } else {
  4858. jQuery.fn.offset = function( options ) {
  4859. var elem = this[0];
  4860. if ( options ) {
  4861. return this.each(function( i ) {
  4862. jQuery.offset.setOffset( this, options, i );
  4863. });
  4864. }
  4865. if ( !elem || !elem.ownerDocument ) {
  4866. return null;
  4867. }
  4868. if ( elem === elem.ownerDocument.body ) {
  4869. return jQuery.offset.bodyOffset( elem );
  4870. }
  4871. jQuery.offset.initialize();
  4872. var offsetParent = elem.offsetParent, prevOffsetParent = elem,
  4873. doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
  4874. body = doc.body, defaultView = doc.defaultView,
  4875. prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
  4876. top = elem.offsetTop, left = elem.offsetLeft;
  4877. while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
  4878. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  4879. break;
  4880. }
  4881. computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
  4882. top -= elem.scrollTop;
  4883. left -= elem.scrollLeft;
  4884. if ( elem === offsetParent ) {
  4885. top += elem.offsetTop;
  4886. left += elem.offsetLeft;
  4887. if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
  4888. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  4889. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  4890. }
  4891. prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
  4892. }
  4893. if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
  4894. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  4895. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  4896. }
  4897. prevComputedStyle = computedStyle;
  4898. }
  4899. if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
  4900. top += body.offsetTop;
  4901. left += body.offsetLeft;
  4902. }
  4903. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  4904. top += Math.max( docElem.scrollTop, body.scrollTop );
  4905. left += Math.max( docElem.scrollLeft, body.scrollLeft );
  4906. }
  4907. return { top: top, left: left };
  4908. };
  4909. }
  4910. jQuery.offset = {
  4911. initialize: function() {
  4912. var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0,
  4913. 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>";
  4914. jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
  4915. container.innerHTML = html;
  4916. body.insertBefore( container, body.firstChild );
  4917. innerDiv = container.firstChild;
  4918. checkDiv = innerDiv.firstChild;
  4919. td = innerDiv.nextSibling.firstChild.firstChild;
  4920. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  4921. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  4922. checkDiv.style.position = "fixed", checkDiv.style.top = "20px";
  4923. // safari subtracts parent border width here which is 5px
  4924. this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
  4925. checkDiv.style.position = checkDiv.style.top = "";
  4926. innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative";
  4927. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  4928. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
  4929. body.removeChild( container );
  4930. body = container = innerDiv = checkDiv = table = td = null;
  4931. jQuery.offset.initialize = jQuery.noop;
  4932. },
  4933. bodyOffset: function( body ) {
  4934. var top = body.offsetTop, left = body.offsetLeft;
  4935. jQuery.offset.initialize();
  4936. if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
  4937. top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0;
  4938. left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0;
  4939. }
  4940. return { top: top, left: left };
  4941. },
  4942. setOffset: function( elem, options, i ) {
  4943. // set position first, in-case top/left are set even on static elem
  4944. if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) {
  4945. elem.style.position = "relative";
  4946. }
  4947. var curElem = jQuery( elem ),
  4948. curOffset = curElem.offset(),
  4949. curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0,
  4950. curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0;
  4951. if ( jQuery.isFunction( options ) ) {
  4952. options = options.call( elem, i, curOffset );
  4953. }
  4954. var props = {
  4955. top: (options.top - curOffset.top) + curTop,
  4956. left: (options.left - curOffset.left) + curLeft
  4957. };
  4958. if ( "using" in options ) {
  4959. options.using.call( elem, props );
  4960. } else {
  4961. curElem.css( props );
  4962. }
  4963. }
  4964. };
  4965. jQuery.fn.extend({
  4966. position: function() {
  4967. if ( !this[0] ) {
  4968. return null;
  4969. }
  4970. var elem = this[0],
  4971. // Get *real* offsetParent
  4972. offsetParent = this.offsetParent(),
  4973. // Get correct offsets
  4974. offset = this.offset(),
  4975. parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
  4976. // Subtract element margins
  4977. // note: when an element has margin: auto the offsetLeft and marginLeft
  4978. // are the same in Safari causing offset.left to incorrectly be 0
  4979. offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0;
  4980. offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0;
  4981. // Add offsetParent borders
  4982. parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0;
  4983. parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0;
  4984. // Subtract the two offsets
  4985. return {
  4986. top: offset.top - parentOffset.top,
  4987. left: offset.left - parentOffset.left
  4988. };
  4989. },
  4990. offsetParent: function() {
  4991. return this.map(function() {
  4992. var offsetParent = this.offsetParent || document.body;
  4993. while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
  4994. offsetParent = offsetParent.offsetParent;
  4995. }
  4996. return offsetParent;
  4997. });
  4998. }
  4999. });
  5000. // Create scrollLeft and scrollTop methods
  5001. jQuery.each( ["Left", "Top"], function( i, name ) {
  5002. var method = "scroll" + name;
  5003. jQuery.fn[ method ] = function(val) {
  5004. var elem = this[0], win;
  5005. if ( !elem ) {
  5006. return null;
  5007. }
  5008. if ( val !== undefined ) {
  5009. // Set the scroll offset
  5010. return this.each(function() {
  5011. win = getWindow( this );
  5012. if ( win ) {
  5013. win.scrollTo(
  5014. !i ? val : jQuery(win).scrollLeft(),
  5015. i ? val : jQuery(win).scrollTop()
  5016. );
  5017. } else {
  5018. this[ method ] = val;
  5019. }
  5020. });
  5021. } else {
  5022. win = getWindow( elem );
  5023. // Return the scroll offset
  5024. return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
  5025. jQuery.support.boxModel && win.document.documentElement[ method ] ||
  5026. win.document.body[ method ] :
  5027. elem[ method ];
  5028. }
  5029. };
  5030. });
  5031. function getWindow( elem ) {
  5032. return ("scrollTo" in elem && elem.document) ?
  5033. elem :
  5034. elem.nodeType === 9 ?
  5035. elem.defaultView || elem.parentWindow :
  5036. false;
  5037. }
  5038. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  5039. jQuery.each([ "Height", "Width" ], function( i, name ) {
  5040. var type = name.toLowerCase();
  5041. // innerHeight and innerWidth
  5042. jQuery.fn["inner" + name] = function() {
  5043. return this[0] ?
  5044. jQuery.css( this[0], type, false, "padding" ) :
  5045. null;
  5046. };
  5047. // outerHeight and outerWidth
  5048. jQuery.fn["outer" + name] = function( margin ) {
  5049. return this[0] ?
  5050. jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
  5051. null;
  5052. };
  5053. jQuery.fn[ type ] = function( size ) {
  5054. // Get window width or height
  5055. var elem = this[0];
  5056. if ( !elem ) {
  5057. return size == null ? null : this;
  5058. }
  5059. if ( jQuery.isFunction( size ) ) {
  5060. return this.each(function( i ) {
  5061. var self = jQuery( this );
  5062. self[ type ]( size.call( this, i, self[ type ]() ) );
  5063. });
  5064. }
  5065. return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
  5066. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  5067. elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
  5068. elem.document.body[ "client" + name ] :
  5069. // Get document width or height
  5070. (elem.nodeType === 9) ? // is it a document
  5071. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  5072. Math.max(
  5073. elem.documentElement["client" + name],
  5074. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  5075. elem.body["offset" + name], elem.documentElement["offset" + name]
  5076. ) :
  5077. // Get or set width or height on the element
  5078. size === undefined ?
  5079. // Get width or height on the element
  5080. jQuery.css( elem, type ) :
  5081. // Set the width or height on the element (default to pixels if value is unitless)
  5082. this.css( type, typeof size === "string" ? size : size + "px" );
  5083. };
  5084. });
  5085. // Expose jQuery to the global object
  5086. window.jQuery = window.$ = jQuery;
  5087. })(window);