jquery-2.0.3.js 324 KB

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