jquery.js 242 KB

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