Nenhuma Descrição

jquery-1.8.js 252KB

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