jquery.js 258 KB

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