jquery-1.8.2.dev.js 261KB

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