jquery-1.7b2.js 243 KB

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