bootlint.js 322 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583
  1. /*!
  2. * Bootlint v0.12.0 (https://github.com/twbs/bootlint)
  3. * HTML linter for Bootstrap projects
  4. * Copyright (c) 2014-2015 Christopher Rebert
  5. * Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE).
  6. */
  7. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  8. },{}],2:[function(require,module,exports){
  9. /*!
  10. * jQuery JavaScript Library v2.1.3
  11. * http://jquery.com/
  12. *
  13. * Includes Sizzle.js
  14. * http://sizzlejs.com/
  15. *
  16. * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
  17. * Released under the MIT license
  18. * http://jquery.org/license
  19. *
  20. * Date: 2014-12-18T15:11Z
  21. */
  22. (function( global, factory ) {
  23. if ( typeof module === "object" && typeof module.exports === "object" ) {
  24. // For CommonJS and CommonJS-like environments where a proper `window`
  25. // is present, execute the factory and get jQuery.
  26. // For environments that do not have a `window` with a `document`
  27. // (such as Node.js), expose a factory as module.exports.
  28. // This accentuates the need for the creation of a real `window`.
  29. // e.g. var jQuery = require("jquery")(window);
  30. // See ticket #14549 for more info.
  31. module.exports = global.document ?
  32. factory( global, true ) :
  33. function( w ) {
  34. if ( !w.document ) {
  35. throw new Error( "jQuery requires a window with a document" );
  36. }
  37. return factory( w );
  38. };
  39. } else {
  40. factory( global );
  41. }
  42. // Pass this if window is not defined yet
  43. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  44. // Support: Firefox 18+
  45. // Can't be in strict mode, several libs including ASP.NET trace
  46. // the stack via arguments.caller.callee and Firefox dies if
  47. // you try to trace through "use strict" call chains. (#13335)
  48. //
  49. var arr = [];
  50. var slice = arr.slice;
  51. var concat = arr.concat;
  52. var push = arr.push;
  53. var indexOf = arr.indexOf;
  54. var class2type = {};
  55. var toString = class2type.toString;
  56. var hasOwn = class2type.hasOwnProperty;
  57. var support = {};
  58. var
  59. // Use the correct document accordingly with window argument (sandbox)
  60. document = window.document,
  61. version = "2.1.3",
  62. // Define a local copy of jQuery
  63. jQuery = function( selector, context ) {
  64. // The jQuery object is actually just the init constructor 'enhanced'
  65. // Need init if jQuery is called (just allow error to be thrown if not included)
  66. return new jQuery.fn.init( selector, context );
  67. },
  68. // Support: Android<4.1
  69. // Make sure we trim BOM and NBSP
  70. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  71. // Matches dashed string for camelizing
  72. rmsPrefix = /^-ms-/,
  73. rdashAlpha = /-([\da-z])/gi,
  74. // Used by jQuery.camelCase as callback to replace()
  75. fcamelCase = function( all, letter ) {
  76. return letter.toUpperCase();
  77. };
  78. jQuery.fn = jQuery.prototype = {
  79. // The current version of jQuery being used
  80. jquery: version,
  81. constructor: jQuery,
  82. // Start with an empty selector
  83. selector: "",
  84. // The default length of a jQuery object is 0
  85. length: 0,
  86. toArray: function() {
  87. return slice.call( this );
  88. },
  89. // Get the Nth element in the matched element set OR
  90. // Get the whole matched element set as a clean array
  91. get: function( num ) {
  92. return num != null ?
  93. // Return just the one element from the set
  94. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  95. // Return all the elements in a clean array
  96. slice.call( this );
  97. },
  98. // Take an array of elements and push it onto the stack
  99. // (returning the new matched element set)
  100. pushStack: function( elems ) {
  101. // Build a new jQuery matched element set
  102. var ret = jQuery.merge( this.constructor(), elems );
  103. // Add the old object onto the stack (as a reference)
  104. ret.prevObject = this;
  105. ret.context = this.context;
  106. // Return the newly-formed element set
  107. return ret;
  108. },
  109. // Execute a callback for every element in the matched set.
  110. // (You can seed the arguments with an array of args, but this is
  111. // only used internally.)
  112. each: function( callback, args ) {
  113. return jQuery.each( this, callback, args );
  114. },
  115. map: function( callback ) {
  116. return this.pushStack( jQuery.map(this, function( elem, i ) {
  117. return callback.call( elem, i, elem );
  118. }));
  119. },
  120. slice: function() {
  121. return this.pushStack( slice.apply( this, arguments ) );
  122. },
  123. first: function() {
  124. return this.eq( 0 );
  125. },
  126. last: function() {
  127. return this.eq( -1 );
  128. },
  129. eq: function( i ) {
  130. var len = this.length,
  131. j = +i + ( i < 0 ? len : 0 );
  132. return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
  133. },
  134. end: function() {
  135. return this.prevObject || this.constructor(null);
  136. },
  137. // For internal use only.
  138. // Behaves like an Array's method, not like a jQuery method.
  139. push: push,
  140. sort: arr.sort,
  141. splice: arr.splice
  142. };
  143. jQuery.extend = jQuery.fn.extend = function() {
  144. var options, name, src, copy, copyIsArray, clone,
  145. target = arguments[0] || {},
  146. i = 1,
  147. length = arguments.length,
  148. deep = false;
  149. // Handle a deep copy situation
  150. if ( typeof target === "boolean" ) {
  151. deep = target;
  152. // Skip the boolean and the target
  153. target = arguments[ i ] || {};
  154. i++;
  155. }
  156. // Handle case when target is a string or something (possible in deep copy)
  157. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  158. target = {};
  159. }
  160. // Extend jQuery itself if only one argument is passed
  161. if ( i === length ) {
  162. target = this;
  163. i--;
  164. }
  165. for ( ; i < length; i++ ) {
  166. // Only deal with non-null/undefined values
  167. if ( (options = arguments[ i ]) != null ) {
  168. // Extend the base object
  169. for ( name in options ) {
  170. src = target[ name ];
  171. copy = options[ name ];
  172. // Prevent never-ending loop
  173. if ( target === copy ) {
  174. continue;
  175. }
  176. // Recurse if we're merging plain objects or arrays
  177. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  178. if ( copyIsArray ) {
  179. copyIsArray = false;
  180. clone = src && jQuery.isArray(src) ? src : [];
  181. } else {
  182. clone = src && jQuery.isPlainObject(src) ? src : {};
  183. }
  184. // Never move original objects, clone them
  185. target[ name ] = jQuery.extend( deep, clone, copy );
  186. // Don't bring in undefined values
  187. } else if ( copy !== undefined ) {
  188. target[ name ] = copy;
  189. }
  190. }
  191. }
  192. }
  193. // Return the modified object
  194. return target;
  195. };
  196. jQuery.extend({
  197. // Unique for each copy of jQuery on the page
  198. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  199. // Assume jQuery is ready without the ready module
  200. isReady: true,
  201. error: function( msg ) {
  202. throw new Error( msg );
  203. },
  204. noop: function() {},
  205. isFunction: function( obj ) {
  206. return jQuery.type(obj) === "function";
  207. },
  208. isArray: Array.isArray,
  209. isWindow: function( obj ) {
  210. return obj != null && obj === obj.window;
  211. },
  212. isNumeric: function( obj ) {
  213. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  214. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  215. // subtraction forces infinities to NaN
  216. // adding 1 corrects loss of precision from parseFloat (#15100)
  217. return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
  218. },
  219. isPlainObject: function( obj ) {
  220. // Not plain objects:
  221. // - Any object or value whose internal [[Class]] property is not "[object Object]"
  222. // - DOM nodes
  223. // - window
  224. if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  225. return false;
  226. }
  227. if ( obj.constructor &&
  228. !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
  229. return false;
  230. }
  231. // If the function hasn't returned already, we're confident that
  232. // |obj| is a plain object, created by {} or constructed with new Object
  233. return true;
  234. },
  235. isEmptyObject: function( obj ) {
  236. var name;
  237. for ( name in obj ) {
  238. return false;
  239. }
  240. return true;
  241. },
  242. type: function( obj ) {
  243. if ( obj == null ) {
  244. return obj + "";
  245. }
  246. // Support: Android<4.0, iOS<6 (functionish RegExp)
  247. return typeof obj === "object" || typeof obj === "function" ?
  248. class2type[ toString.call(obj) ] || "object" :
  249. typeof obj;
  250. },
  251. // Evaluates a script in a global context
  252. globalEval: function( code ) {
  253. var script,
  254. indirect = eval;
  255. code = jQuery.trim( code );
  256. if ( code ) {
  257. // If the code includes a valid, prologue position
  258. // strict mode pragma, execute code by injecting a
  259. // script tag into the document.
  260. if ( code.indexOf("use strict") === 1 ) {
  261. script = document.createElement("script");
  262. script.text = code;
  263. document.head.appendChild( script ).parentNode.removeChild( script );
  264. } else {
  265. // Otherwise, avoid the DOM node creation, insertion
  266. // and removal by using an indirect global eval
  267. indirect( code );
  268. }
  269. }
  270. },
  271. // Convert dashed to camelCase; used by the css and data modules
  272. // Support: IE9-11+
  273. // Microsoft forgot to hump their vendor prefix (#9572)
  274. camelCase: function( string ) {
  275. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  276. },
  277. nodeName: function( elem, name ) {
  278. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  279. },
  280. // args is for internal usage only
  281. each: function( obj, callback, args ) {
  282. var value,
  283. i = 0,
  284. length = obj.length,
  285. isArray = isArraylike( obj );
  286. if ( args ) {
  287. if ( isArray ) {
  288. for ( ; i < length; i++ ) {
  289. value = callback.apply( obj[ i ], args );
  290. if ( value === false ) {
  291. break;
  292. }
  293. }
  294. } else {
  295. for ( i in obj ) {
  296. value = callback.apply( obj[ i ], args );
  297. if ( value === false ) {
  298. break;
  299. }
  300. }
  301. }
  302. // A special, fast, case for the most common use of each
  303. } else {
  304. if ( isArray ) {
  305. for ( ; i < length; i++ ) {
  306. value = callback.call( obj[ i ], i, obj[ i ] );
  307. if ( value === false ) {
  308. break;
  309. }
  310. }
  311. } else {
  312. for ( i in obj ) {
  313. value = callback.call( obj[ i ], i, obj[ i ] );
  314. if ( value === false ) {
  315. break;
  316. }
  317. }
  318. }
  319. }
  320. return obj;
  321. },
  322. // Support: Android<4.1
  323. trim: function( text ) {
  324. return text == null ?
  325. "" :
  326. ( text + "" ).replace( rtrim, "" );
  327. },
  328. // results is for internal usage only
  329. makeArray: function( arr, results ) {
  330. var ret = results || [];
  331. if ( arr != null ) {
  332. if ( isArraylike( Object(arr) ) ) {
  333. jQuery.merge( ret,
  334. typeof arr === "string" ?
  335. [ arr ] : arr
  336. );
  337. } else {
  338. push.call( ret, arr );
  339. }
  340. }
  341. return ret;
  342. },
  343. inArray: function( elem, arr, i ) {
  344. return arr == null ? -1 : indexOf.call( arr, elem, i );
  345. },
  346. merge: function( first, second ) {
  347. var len = +second.length,
  348. j = 0,
  349. i = first.length;
  350. for ( ; j < len; j++ ) {
  351. first[ i++ ] = second[ j ];
  352. }
  353. first.length = i;
  354. return first;
  355. },
  356. grep: function( elems, callback, invert ) {
  357. var callbackInverse,
  358. matches = [],
  359. i = 0,
  360. length = elems.length,
  361. callbackExpect = !invert;
  362. // Go through the array, only saving the items
  363. // that pass the validator function
  364. for ( ; i < length; i++ ) {
  365. callbackInverse = !callback( elems[ i ], i );
  366. if ( callbackInverse !== callbackExpect ) {
  367. matches.push( elems[ i ] );
  368. }
  369. }
  370. return matches;
  371. },
  372. // arg is for internal usage only
  373. map: function( elems, callback, arg ) {
  374. var value,
  375. i = 0,
  376. length = elems.length,
  377. isArray = isArraylike( elems ),
  378. ret = [];
  379. // Go through the array, translating each of the items to their new values
  380. if ( isArray ) {
  381. for ( ; i < length; i++ ) {
  382. value = callback( elems[ i ], i, arg );
  383. if ( value != null ) {
  384. ret.push( value );
  385. }
  386. }
  387. // Go through every key on the object,
  388. } else {
  389. for ( i in elems ) {
  390. value = callback( elems[ i ], i, arg );
  391. if ( value != null ) {
  392. ret.push( value );
  393. }
  394. }
  395. }
  396. // Flatten any nested arrays
  397. return concat.apply( [], ret );
  398. },
  399. // A global GUID counter for objects
  400. guid: 1,
  401. // Bind a function to a context, optionally partially applying any
  402. // arguments.
  403. proxy: function( fn, context ) {
  404. var tmp, args, proxy;
  405. if ( typeof context === "string" ) {
  406. tmp = fn[ context ];
  407. context = fn;
  408. fn = tmp;
  409. }
  410. // Quick check to determine if target is callable, in the spec
  411. // this throws a TypeError, but we will just return undefined.
  412. if ( !jQuery.isFunction( fn ) ) {
  413. return undefined;
  414. }
  415. // Simulated bind
  416. args = slice.call( arguments, 2 );
  417. proxy = function() {
  418. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  419. };
  420. // Set the guid of unique handler to the same of original handler, so it can be removed
  421. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  422. return proxy;
  423. },
  424. now: Date.now,
  425. // jQuery.support is not used in Core but other projects attach their
  426. // properties to it so it needs to exist.
  427. support: support
  428. });
  429. // Populate the class2type map
  430. jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  431. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  432. });
  433. function isArraylike( obj ) {
  434. var length = obj.length,
  435. type = jQuery.type( obj );
  436. if ( type === "function" || jQuery.isWindow( obj ) ) {
  437. return false;
  438. }
  439. if ( obj.nodeType === 1 && length ) {
  440. return true;
  441. }
  442. return type === "array" || length === 0 ||
  443. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  444. }
  445. var Sizzle =
  446. /*!
  447. * Sizzle CSS Selector Engine v2.2.0-pre
  448. * http://sizzlejs.com/
  449. *
  450. * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
  451. * Released under the MIT license
  452. * http://jquery.org/license
  453. *
  454. * Date: 2014-12-16
  455. */
  456. (function( window ) {
  457. var i,
  458. support,
  459. Expr,
  460. getText,
  461. isXML,
  462. tokenize,
  463. compile,
  464. select,
  465. outermostContext,
  466. sortInput,
  467. hasDuplicate,
  468. // Local document vars
  469. setDocument,
  470. document,
  471. docElem,
  472. documentIsHTML,
  473. rbuggyQSA,
  474. rbuggyMatches,
  475. matches,
  476. contains,
  477. // Instance-specific data
  478. expando = "sizzle" + 1 * new Date(),
  479. preferredDoc = window.document,
  480. dirruns = 0,
  481. done = 0,
  482. classCache = createCache(),
  483. tokenCache = createCache(),
  484. compilerCache = createCache(),
  485. sortOrder = function( a, b ) {
  486. if ( a === b ) {
  487. hasDuplicate = true;
  488. }
  489. return 0;
  490. },
  491. // General-purpose constants
  492. MAX_NEGATIVE = 1 << 31,
  493. // Instance methods
  494. hasOwn = ({}).hasOwnProperty,
  495. arr = [],
  496. pop = arr.pop,
  497. push_native = arr.push,
  498. push = arr.push,
  499. slice = arr.slice,
  500. // Use a stripped-down indexOf as it's faster than native
  501. // http://jsperf.com/thor-indexof-vs-for/5
  502. indexOf = function( list, elem ) {
  503. var i = 0,
  504. len = list.length;
  505. for ( ; i < len; i++ ) {
  506. if ( list[i] === elem ) {
  507. return i;
  508. }
  509. }
  510. return -1;
  511. },
  512. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  513. // Regular expressions
  514. // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
  515. whitespace = "[\\x20\\t\\r\\n\\f]",
  516. // http://www.w3.org/TR/css3-syntax/#characters
  517. characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  518. // Loosely modeled on CSS identifier characters
  519. // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
  520. // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  521. identifier = characterEncoding.replace( "w", "w#" ),
  522. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  523. attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
  524. // Operator (capture 2)
  525. "*([*^$|!~]?=)" + whitespace +
  526. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  527. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  528. "*\\]",
  529. pseudos = ":(" + characterEncoding + ")(?:\\((" +
  530. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  531. // 1. quoted (capture 3; capture 4 or capture 5)
  532. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  533. // 2. simple (capture 6)
  534. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  535. // 3. anything else (capture 2)
  536. ".*" +
  537. ")\\)|)",
  538. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  539. rwhitespace = new RegExp( whitespace + "+", "g" ),
  540. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  541. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  542. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  543. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  544. rpseudo = new RegExp( pseudos ),
  545. ridentifier = new RegExp( "^" + identifier + "$" ),
  546. matchExpr = {
  547. "ID": new RegExp( "^#(" + characterEncoding + ")" ),
  548. "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
  549. "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
  550. "ATTR": new RegExp( "^" + attributes ),
  551. "PSEUDO": new RegExp( "^" + pseudos ),
  552. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  553. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  554. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  555. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  556. // For use in libraries implementing .is()
  557. // We use this for POS matching in `select`
  558. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  559. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  560. },
  561. rinputs = /^(?:input|select|textarea|button)$/i,
  562. rheader = /^h\d$/i,
  563. rnative = /^[^{]+\{\s*\[native \w/,
  564. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  565. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  566. rsibling = /[+~]/,
  567. rescape = /'|\\/g,
  568. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  569. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  570. funescape = function( _, escaped, escapedWhitespace ) {
  571. var high = "0x" + escaped - 0x10000;
  572. // NaN means non-codepoint
  573. // Support: Firefox<24
  574. // Workaround erroneous numeric interpretation of +"0x"
  575. return high !== high || escapedWhitespace ?
  576. escaped :
  577. high < 0 ?
  578. // BMP codepoint
  579. String.fromCharCode( high + 0x10000 ) :
  580. // Supplemental Plane codepoint (surrogate pair)
  581. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  582. },
  583. // Used for iframes
  584. // See setDocument()
  585. // Removing the function wrapper causes a "Permission Denied"
  586. // error in IE
  587. unloadHandler = function() {
  588. setDocument();
  589. };
  590. // Optimize for push.apply( _, NodeList )
  591. try {
  592. push.apply(
  593. (arr = slice.call( preferredDoc.childNodes )),
  594. preferredDoc.childNodes
  595. );
  596. // Support: Android<4.0
  597. // Detect silently failing push.apply
  598. arr[ preferredDoc.childNodes.length ].nodeType;
  599. } catch ( e ) {
  600. push = { apply: arr.length ?
  601. // Leverage slice if possible
  602. function( target, els ) {
  603. push_native.apply( target, slice.call(els) );
  604. } :
  605. // Support: IE<9
  606. // Otherwise append directly
  607. function( target, els ) {
  608. var j = target.length,
  609. i = 0;
  610. // Can't trust NodeList.length
  611. while ( (target[j++] = els[i++]) ) {}
  612. target.length = j - 1;
  613. }
  614. };
  615. }
  616. function Sizzle( selector, context, results, seed ) {
  617. var match, elem, m, nodeType,
  618. // QSA vars
  619. i, groups, old, nid, newContext, newSelector;
  620. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  621. setDocument( context );
  622. }
  623. context = context || document;
  624. results = results || [];
  625. nodeType = context.nodeType;
  626. if ( typeof selector !== "string" || !selector ||
  627. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  628. return results;
  629. }
  630. if ( !seed && documentIsHTML ) {
  631. // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
  632. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  633. // Speed-up: Sizzle("#ID")
  634. if ( (m = match[1]) ) {
  635. if ( nodeType === 9 ) {
  636. elem = context.getElementById( m );
  637. // Check parentNode to catch when Blackberry 4.6 returns
  638. // nodes that are no longer in the document (jQuery #6963)
  639. if ( elem && elem.parentNode ) {
  640. // Handle the case where IE, Opera, and Webkit return items
  641. // by name instead of ID
  642. if ( elem.id === m ) {
  643. results.push( elem );
  644. return results;
  645. }
  646. } else {
  647. return results;
  648. }
  649. } else {
  650. // Context is not a document
  651. if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
  652. contains( context, elem ) && elem.id === m ) {
  653. results.push( elem );
  654. return results;
  655. }
  656. }
  657. // Speed-up: Sizzle("TAG")
  658. } else if ( match[2] ) {
  659. push.apply( results, context.getElementsByTagName( selector ) );
  660. return results;
  661. // Speed-up: Sizzle(".CLASS")
  662. } else if ( (m = match[3]) && support.getElementsByClassName ) {
  663. push.apply( results, context.getElementsByClassName( m ) );
  664. return results;
  665. }
  666. }
  667. // QSA path
  668. if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  669. nid = old = expando;
  670. newContext = context;
  671. newSelector = nodeType !== 1 && selector;
  672. // qSA works strangely on Element-rooted queries
  673. // We can work around this by specifying an extra ID on the root
  674. // and working up from there (Thanks to Andrew Dupont for the technique)
  675. // IE 8 doesn't work on object elements
  676. if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  677. groups = tokenize( selector );
  678. if ( (old = context.getAttribute("id")) ) {
  679. nid = old.replace( rescape, "\\$&" );
  680. } else {
  681. context.setAttribute( "id", nid );
  682. }
  683. nid = "[id='" + nid + "'] ";
  684. i = groups.length;
  685. while ( i-- ) {
  686. groups[i] = nid + toSelector( groups[i] );
  687. }
  688. newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
  689. newSelector = groups.join(",");
  690. }
  691. if ( newSelector ) {
  692. try {
  693. push.apply( results,
  694. newContext.querySelectorAll( newSelector )
  695. );
  696. return results;
  697. } catch(qsaError) {
  698. } finally {
  699. if ( !old ) {
  700. context.removeAttribute("id");
  701. }
  702. }
  703. }
  704. }
  705. }
  706. // All others
  707. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  708. }
  709. /**
  710. * Create key-value caches of limited size
  711. * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
  712. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  713. * deleting the oldest entry
  714. */
  715. function createCache() {
  716. var keys = [];
  717. function cache( key, value ) {
  718. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  719. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  720. // Only keep the most recent entries
  721. delete cache[ keys.shift() ];
  722. }
  723. return (cache[ key + " " ] = value);
  724. }
  725. return cache;
  726. }
  727. /**
  728. * Mark a function for special use by Sizzle
  729. * @param {Function} fn The function to mark
  730. */
  731. function markFunction( fn ) {
  732. fn[ expando ] = true;
  733. return fn;
  734. }
  735. /**
  736. * Support testing using an element
  737. * @param {Function} fn Passed the created div and expects a boolean result
  738. */
  739. function assert( fn ) {
  740. var div = document.createElement("div");
  741. try {
  742. return !!fn( div );
  743. } catch (e) {
  744. return false;
  745. } finally {
  746. // Remove from its parent by default
  747. if ( div.parentNode ) {
  748. div.parentNode.removeChild( div );
  749. }
  750. // release memory in IE
  751. div = null;
  752. }
  753. }
  754. /**
  755. * Adds the same handler for all of the specified attrs
  756. * @param {String} attrs Pipe-separated list of attributes
  757. * @param {Function} handler The method that will be applied
  758. */
  759. function addHandle( attrs, handler ) {
  760. var arr = attrs.split("|"),
  761. i = attrs.length;
  762. while ( i-- ) {
  763. Expr.attrHandle[ arr[i] ] = handler;
  764. }
  765. }
  766. /**
  767. * Checks document order of two siblings
  768. * @param {Element} a
  769. * @param {Element} b
  770. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  771. */
  772. function siblingCheck( a, b ) {
  773. var cur = b && a,
  774. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  775. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  776. ( ~a.sourceIndex || MAX_NEGATIVE );
  777. // Use IE sourceIndex if available on both nodes
  778. if ( diff ) {
  779. return diff;
  780. }
  781. // Check if b follows a
  782. if ( cur ) {
  783. while ( (cur = cur.nextSibling) ) {
  784. if ( cur === b ) {
  785. return -1;
  786. }
  787. }
  788. }
  789. return a ? 1 : -1;
  790. }
  791. /**
  792. * Returns a function to use in pseudos for input types
  793. * @param {String} type
  794. */
  795. function createInputPseudo( type ) {
  796. return function( elem ) {
  797. var name = elem.nodeName.toLowerCase();
  798. return name === "input" && elem.type === type;
  799. };
  800. }
  801. /**
  802. * Returns a function to use in pseudos for buttons
  803. * @param {String} type
  804. */
  805. function createButtonPseudo( type ) {
  806. return function( elem ) {
  807. var name = elem.nodeName.toLowerCase();
  808. return (name === "input" || name === "button") && elem.type === type;
  809. };
  810. }
  811. /**
  812. * Returns a function to use in pseudos for positionals
  813. * @param {Function} fn
  814. */
  815. function createPositionalPseudo( fn ) {
  816. return markFunction(function( argument ) {
  817. argument = +argument;
  818. return markFunction(function( seed, matches ) {
  819. var j,
  820. matchIndexes = fn( [], seed.length, argument ),
  821. i = matchIndexes.length;
  822. // Match elements found at the specified indexes
  823. while ( i-- ) {
  824. if ( seed[ (j = matchIndexes[i]) ] ) {
  825. seed[j] = !(matches[j] = seed[j]);
  826. }
  827. }
  828. });
  829. });
  830. }
  831. /**
  832. * Checks a node for validity as a Sizzle context
  833. * @param {Element|Object=} context
  834. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  835. */
  836. function testContext( context ) {
  837. return context && typeof context.getElementsByTagName !== "undefined" && context;
  838. }
  839. // Expose support vars for convenience
  840. support = Sizzle.support = {};
  841. /**
  842. * Detects XML nodes
  843. * @param {Element|Object} elem An element or a document
  844. * @returns {Boolean} True iff elem is a non-HTML XML node
  845. */
  846. isXML = Sizzle.isXML = function( elem ) {
  847. // documentElement is verified for cases where it doesn't yet exist
  848. // (such as loading iframes in IE - #4833)
  849. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  850. return documentElement ? documentElement.nodeName !== "HTML" : false;
  851. };
  852. /**
  853. * Sets document-related variables once based on the current document
  854. * @param {Element|Object} [doc] An element or document object to use to set the document
  855. * @returns {Object} Returns the current document
  856. */
  857. setDocument = Sizzle.setDocument = function( node ) {
  858. var hasCompare, parent,
  859. doc = node ? node.ownerDocument || node : preferredDoc;
  860. // If no document and documentElement is available, return
  861. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  862. return document;
  863. }
  864. // Set our document
  865. document = doc;
  866. docElem = doc.documentElement;
  867. parent = doc.defaultView;
  868. // Support: IE>8
  869. // If iframe document is assigned to "document" variable and if iframe has been reloaded,
  870. // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
  871. // IE6-8 do not support the defaultView property so parent will be undefined
  872. if ( parent && parent !== parent.top ) {
  873. // IE11 does not have attachEvent, so all must suffer
  874. if ( parent.addEventListener ) {
  875. parent.addEventListener( "unload", unloadHandler, false );
  876. } else if ( parent.attachEvent ) {
  877. parent.attachEvent( "onunload", unloadHandler );
  878. }
  879. }
  880. /* Support tests
  881. ---------------------------------------------------------------------- */
  882. documentIsHTML = !isXML( doc );
  883. /* Attributes
  884. ---------------------------------------------------------------------- */
  885. // Support: IE<8
  886. // Verify that getAttribute really returns attributes and not properties
  887. // (excepting IE8 booleans)
  888. support.attributes = assert(function( div ) {
  889. div.className = "i";
  890. return !div.getAttribute("className");
  891. });
  892. /* getElement(s)By*
  893. ---------------------------------------------------------------------- */
  894. // Check if getElementsByTagName("*") returns only elements
  895. support.getElementsByTagName = assert(function( div ) {
  896. div.appendChild( doc.createComment("") );
  897. return !div.getElementsByTagName("*").length;
  898. });
  899. // Support: IE<9
  900. support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
  901. // Support: IE<10
  902. // Check if getElementById returns elements by name
  903. // The broken getElementById methods don't pick up programatically-set names,
  904. // so use a roundabout getElementsByName test
  905. support.getById = assert(function( div ) {
  906. docElem.appendChild( div ).id = expando;
  907. return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
  908. });
  909. // ID find and filter
  910. if ( support.getById ) {
  911. Expr.find["ID"] = function( id, context ) {
  912. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  913. var m = context.getElementById( id );
  914. // Check parentNode to catch when Blackberry 4.6 returns
  915. // nodes that are no longer in the document #6963
  916. return m && m.parentNode ? [ m ] : [];
  917. }
  918. };
  919. Expr.filter["ID"] = function( id ) {
  920. var attrId = id.replace( runescape, funescape );
  921. return function( elem ) {
  922. return elem.getAttribute("id") === attrId;
  923. };
  924. };
  925. } else {
  926. // Support: IE6/7
  927. // getElementById is not reliable as a find shortcut
  928. delete Expr.find["ID"];
  929. Expr.filter["ID"] = function( id ) {
  930. var attrId = id.replace( runescape, funescape );
  931. return function( elem ) {
  932. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  933. return node && node.value === attrId;
  934. };
  935. };
  936. }
  937. // Tag
  938. Expr.find["TAG"] = support.getElementsByTagName ?
  939. function( tag, context ) {
  940. if ( typeof context.getElementsByTagName !== "undefined" ) {
  941. return context.getElementsByTagName( tag );
  942. // DocumentFragment nodes don't have gEBTN
  943. } else if ( support.qsa ) {
  944. return context.querySelectorAll( tag );
  945. }
  946. } :
  947. function( tag, context ) {
  948. var elem,
  949. tmp = [],
  950. i = 0,
  951. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  952. results = context.getElementsByTagName( tag );
  953. // Filter out possible comments
  954. if ( tag === "*" ) {
  955. while ( (elem = results[i++]) ) {
  956. if ( elem.nodeType === 1 ) {
  957. tmp.push( elem );
  958. }
  959. }
  960. return tmp;
  961. }
  962. return results;
  963. };
  964. // Class
  965. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  966. if ( documentIsHTML ) {
  967. return context.getElementsByClassName( className );
  968. }
  969. };
  970. /* QSA/matchesSelector
  971. ---------------------------------------------------------------------- */
  972. // QSA and matchesSelector support
  973. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  974. rbuggyMatches = [];
  975. // qSa(:focus) reports false when true (Chrome 21)
  976. // We allow this because of a bug in IE8/9 that throws an error
  977. // whenever `document.activeElement` is accessed on an iframe
  978. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  979. // See http://bugs.jquery.com/ticket/13378
  980. rbuggyQSA = [];
  981. if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
  982. // Build QSA regex
  983. // Regex strategy adopted from Diego Perini
  984. assert(function( div ) {
  985. // Select is set to empty string on purpose
  986. // This is to test IE's treatment of not explicitly
  987. // setting a boolean content attribute,
  988. // since its presence should be enough
  989. // http://bugs.jquery.com/ticket/12359
  990. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  991. "<select id='" + expando + "-\f]' msallowcapture=''>" +
  992. "<option selected=''></option></select>";
  993. // Support: IE8, Opera 11-12.16
  994. // Nothing should be selected when empty strings follow ^= or $= or *=
  995. // The test attribute must be unknown in Opera but "safe" for WinRT
  996. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  997. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  998. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  999. }
  1000. // Support: IE8
  1001. // Boolean attributes and "value" are not treated correctly
  1002. if ( !div.querySelectorAll("[selected]").length ) {
  1003. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1004. }
  1005. // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
  1006. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1007. rbuggyQSA.push("~=");
  1008. }
  1009. // Webkit/Opera - :checked should return selected option elements
  1010. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1011. // IE8 throws error here and will not see later tests
  1012. if ( !div.querySelectorAll(":checked").length ) {
  1013. rbuggyQSA.push(":checked");
  1014. }
  1015. // Support: Safari 8+, iOS 8+
  1016. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1017. // In-page `selector#id sibing-combinator selector` fails
  1018. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1019. rbuggyQSA.push(".#.+[+~]");
  1020. }
  1021. });
  1022. assert(function( div ) {
  1023. // Support: Windows 8 Native Apps
  1024. // The type and name attributes are restricted during .innerHTML assignment
  1025. var input = doc.createElement("input");
  1026. input.setAttribute( "type", "hidden" );
  1027. div.appendChild( input ).setAttribute( "name", "D" );
  1028. // Support: IE8
  1029. // Enforce case-sensitivity of name attribute
  1030. if ( div.querySelectorAll("[name=d]").length ) {
  1031. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1032. }
  1033. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1034. // IE8 throws error here and will not see later tests
  1035. if ( !div.querySelectorAll(":enabled").length ) {
  1036. rbuggyQSA.push( ":enabled", ":disabled" );
  1037. }
  1038. // Opera 10-11 does not throw on post-comma invalid pseudos
  1039. div.querySelectorAll("*,:x");
  1040. rbuggyQSA.push(",.*:");
  1041. });
  1042. }
  1043. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1044. docElem.webkitMatchesSelector ||
  1045. docElem.mozMatchesSelector ||
  1046. docElem.oMatchesSelector ||
  1047. docElem.msMatchesSelector) )) ) {
  1048. assert(function( div ) {
  1049. // Check to see if it's possible to do matchesSelector
  1050. // on a disconnected node (IE 9)
  1051. support.disconnectedMatch = matches.call( div, "div" );
  1052. // This should fail with an exception
  1053. // Gecko does not error, returns false instead
  1054. matches.call( div, "[s!='']:x" );
  1055. rbuggyMatches.push( "!=", pseudos );
  1056. });
  1057. }
  1058. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1059. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1060. /* Contains
  1061. ---------------------------------------------------------------------- */
  1062. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1063. // Element contains another
  1064. // Purposefully does not implement inclusive descendent
  1065. // As in, an element does not contain itself
  1066. contains = hasCompare || rnative.test( docElem.contains ) ?
  1067. function( a, b ) {
  1068. var adown = a.nodeType === 9 ? a.documentElement : a,
  1069. bup = b && b.parentNode;
  1070. return a === bup || !!( bup && bup.nodeType === 1 && (
  1071. adown.contains ?
  1072. adown.contains( bup ) :
  1073. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1074. ));
  1075. } :
  1076. function( a, b ) {
  1077. if ( b ) {
  1078. while ( (b = b.parentNode) ) {
  1079. if ( b === a ) {
  1080. return true;
  1081. }
  1082. }
  1083. }
  1084. return false;
  1085. };
  1086. /* Sorting
  1087. ---------------------------------------------------------------------- */
  1088. // Document order sorting
  1089. sortOrder = hasCompare ?
  1090. function( a, b ) {
  1091. // Flag for duplicate removal
  1092. if ( a === b ) {
  1093. hasDuplicate = true;
  1094. return 0;
  1095. }
  1096. // Sort on method existence if only one input has compareDocumentPosition
  1097. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1098. if ( compare ) {
  1099. return compare;
  1100. }
  1101. // Calculate position if both inputs belong to the same document
  1102. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1103. a.compareDocumentPosition( b ) :
  1104. // Otherwise we know they are disconnected
  1105. 1;
  1106. // Disconnected nodes
  1107. if ( compare & 1 ||
  1108. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1109. // Choose the first element that is related to our preferred document
  1110. if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1111. return -1;
  1112. }
  1113. if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1114. return 1;
  1115. }
  1116. // Maintain original order
  1117. return sortInput ?
  1118. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1119. 0;
  1120. }
  1121. return compare & 4 ? -1 : 1;
  1122. } :
  1123. function( a, b ) {
  1124. // Exit early if the nodes are identical
  1125. if ( a === b ) {
  1126. hasDuplicate = true;
  1127. return 0;
  1128. }
  1129. var cur,
  1130. i = 0,
  1131. aup = a.parentNode,
  1132. bup = b.parentNode,
  1133. ap = [ a ],
  1134. bp = [ b ];
  1135. // Parentless nodes are either documents or disconnected
  1136. if ( !aup || !bup ) {
  1137. return a === doc ? -1 :
  1138. b === doc ? 1 :
  1139. aup ? -1 :
  1140. bup ? 1 :
  1141. sortInput ?
  1142. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1143. 0;
  1144. // If the nodes are siblings, we can do a quick check
  1145. } else if ( aup === bup ) {
  1146. return siblingCheck( a, b );
  1147. }
  1148. // Otherwise we need full lists of their ancestors for comparison
  1149. cur = a;
  1150. while ( (cur = cur.parentNode) ) {
  1151. ap.unshift( cur );
  1152. }
  1153. cur = b;
  1154. while ( (cur = cur.parentNode) ) {
  1155. bp.unshift( cur );
  1156. }
  1157. // Walk down the tree looking for a discrepancy
  1158. while ( ap[i] === bp[i] ) {
  1159. i++;
  1160. }
  1161. return i ?
  1162. // Do a sibling check if the nodes have a common ancestor
  1163. siblingCheck( ap[i], bp[i] ) :
  1164. // Otherwise nodes in our document sort first
  1165. ap[i] === preferredDoc ? -1 :
  1166. bp[i] === preferredDoc ? 1 :
  1167. 0;
  1168. };
  1169. return doc;
  1170. };
  1171. Sizzle.matches = function( expr, elements ) {
  1172. return Sizzle( expr, null, null, elements );
  1173. };
  1174. Sizzle.matchesSelector = function( elem, expr ) {
  1175. // Set document vars if needed
  1176. if ( ( elem.ownerDocument || elem ) !== document ) {
  1177. setDocument( elem );
  1178. }
  1179. // Make sure that attribute selectors are quoted
  1180. expr = expr.replace( rattributeQuotes, "='$1']" );
  1181. if ( support.matchesSelector && documentIsHTML &&
  1182. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1183. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1184. try {
  1185. var ret = matches.call( elem, expr );
  1186. // IE 9's matchesSelector returns false on disconnected nodes
  1187. if ( ret || support.disconnectedMatch ||
  1188. // As well, disconnected nodes are said to be in a document
  1189. // fragment in IE 9
  1190. elem.document && elem.document.nodeType !== 11 ) {
  1191. return ret;
  1192. }
  1193. } catch (e) {}
  1194. }
  1195. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1196. };
  1197. Sizzle.contains = function( context, elem ) {
  1198. // Set document vars if needed
  1199. if ( ( context.ownerDocument || context ) !== document ) {
  1200. setDocument( context );
  1201. }
  1202. return contains( context, elem );
  1203. };
  1204. Sizzle.attr = function( elem, name ) {
  1205. // Set document vars if needed
  1206. if ( ( elem.ownerDocument || elem ) !== document ) {
  1207. setDocument( elem );
  1208. }
  1209. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1210. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1211. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1212. fn( elem, name, !documentIsHTML ) :
  1213. undefined;
  1214. return val !== undefined ?
  1215. val :
  1216. support.attributes || !documentIsHTML ?
  1217. elem.getAttribute( name ) :
  1218. (val = elem.getAttributeNode(name)) && val.specified ?
  1219. val.value :
  1220. null;
  1221. };
  1222. Sizzle.error = function( msg ) {
  1223. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1224. };
  1225. /**
  1226. * Document sorting and removing duplicates
  1227. * @param {ArrayLike} results
  1228. */
  1229. Sizzle.uniqueSort = function( results ) {
  1230. var elem,
  1231. duplicates = [],
  1232. j = 0,
  1233. i = 0;
  1234. // Unless we *know* we can detect duplicates, assume their presence
  1235. hasDuplicate = !support.detectDuplicates;
  1236. sortInput = !support.sortStable && results.slice( 0 );
  1237. results.sort( sortOrder );
  1238. if ( hasDuplicate ) {
  1239. while ( (elem = results[i++]) ) {
  1240. if ( elem === results[ i ] ) {
  1241. j = duplicates.push( i );
  1242. }
  1243. }
  1244. while ( j-- ) {
  1245. results.splice( duplicates[ j ], 1 );
  1246. }
  1247. }
  1248. // Clear input after sorting to release objects
  1249. // See https://github.com/jquery/sizzle/pull/225
  1250. sortInput = null;
  1251. return results;
  1252. };
  1253. /**
  1254. * Utility function for retrieving the text value of an array of DOM nodes
  1255. * @param {Array|Element} elem
  1256. */
  1257. getText = Sizzle.getText = function( elem ) {
  1258. var node,
  1259. ret = "",
  1260. i = 0,
  1261. nodeType = elem.nodeType;
  1262. if ( !nodeType ) {
  1263. // If no nodeType, this is expected to be an array
  1264. while ( (node = elem[i++]) ) {
  1265. // Do not traverse comment nodes
  1266. ret += getText( node );
  1267. }
  1268. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1269. // Use textContent for elements
  1270. // innerText usage removed for consistency of new lines (jQuery #11153)
  1271. if ( typeof elem.textContent === "string" ) {
  1272. return elem.textContent;
  1273. } else {
  1274. // Traverse its children
  1275. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1276. ret += getText( elem );
  1277. }
  1278. }
  1279. } else if ( nodeType === 3 || nodeType === 4 ) {
  1280. return elem.nodeValue;
  1281. }
  1282. // Do not include comment or processing instruction nodes
  1283. return ret;
  1284. };
  1285. Expr = Sizzle.selectors = {
  1286. // Can be adjusted by the user
  1287. cacheLength: 50,
  1288. createPseudo: markFunction,
  1289. match: matchExpr,
  1290. attrHandle: {},
  1291. find: {},
  1292. relative: {
  1293. ">": { dir: "parentNode", first: true },
  1294. " ": { dir: "parentNode" },
  1295. "+": { dir: "previousSibling", first: true },
  1296. "~": { dir: "previousSibling" }
  1297. },
  1298. preFilter: {
  1299. "ATTR": function( match ) {
  1300. match[1] = match[1].replace( runescape, funescape );
  1301. // Move the given value to match[3] whether quoted or unquoted
  1302. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1303. if ( match[2] === "~=" ) {
  1304. match[3] = " " + match[3] + " ";
  1305. }
  1306. return match.slice( 0, 4 );
  1307. },
  1308. "CHILD": function( match ) {
  1309. /* matches from matchExpr["CHILD"]
  1310. 1 type (only|nth|...)
  1311. 2 what (child|of-type)
  1312. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1313. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1314. 5 sign of xn-component
  1315. 6 x of xn-component
  1316. 7 sign of y-component
  1317. 8 y of y-component
  1318. */
  1319. match[1] = match[1].toLowerCase();
  1320. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1321. // nth-* requires argument
  1322. if ( !match[3] ) {
  1323. Sizzle.error( match[0] );
  1324. }
  1325. // numeric x and y parameters for Expr.filter.CHILD
  1326. // remember that false/true cast respectively to 0/1
  1327. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1328. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1329. // other types prohibit arguments
  1330. } else if ( match[3] ) {
  1331. Sizzle.error( match[0] );
  1332. }
  1333. return match;
  1334. },
  1335. "PSEUDO": function( match ) {
  1336. var excess,
  1337. unquoted = !match[6] && match[2];
  1338. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1339. return null;
  1340. }
  1341. // Accept quoted arguments as-is
  1342. if ( match[3] ) {
  1343. match[2] = match[4] || match[5] || "";
  1344. // Strip excess characters from unquoted arguments
  1345. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1346. // Get excess from tokenize (recursively)
  1347. (excess = tokenize( unquoted, true )) &&
  1348. // advance to the next closing parenthesis
  1349. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1350. // excess is a negative index
  1351. match[0] = match[0].slice( 0, excess );
  1352. match[2] = unquoted.slice( 0, excess );
  1353. }
  1354. // Return only captures needed by the pseudo filter method (type and argument)
  1355. return match.slice( 0, 3 );
  1356. }
  1357. },
  1358. filter: {
  1359. "TAG": function( nodeNameSelector ) {
  1360. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1361. return nodeNameSelector === "*" ?
  1362. function() { return true; } :
  1363. function( elem ) {
  1364. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1365. };
  1366. },
  1367. "CLASS": function( className ) {
  1368. var pattern = classCache[ className + " " ];
  1369. return pattern ||
  1370. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1371. classCache( className, function( elem ) {
  1372. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1373. });
  1374. },
  1375. "ATTR": function( name, operator, check ) {
  1376. return function( elem ) {
  1377. var result = Sizzle.attr( elem, name );
  1378. if ( result == null ) {
  1379. return operator === "!=";
  1380. }
  1381. if ( !operator ) {
  1382. return true;
  1383. }
  1384. result += "";
  1385. return operator === "=" ? result === check :
  1386. operator === "!=" ? result !== check :
  1387. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1388. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1389. operator === "$=" ? check && result.slice( -check.length ) === check :
  1390. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1391. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1392. false;
  1393. };
  1394. },
  1395. "CHILD": function( type, what, argument, first, last ) {
  1396. var simple = type.slice( 0, 3 ) !== "nth",
  1397. forward = type.slice( -4 ) !== "last",
  1398. ofType = what === "of-type";
  1399. return first === 1 && last === 0 ?
  1400. // Shortcut for :nth-*(n)
  1401. function( elem ) {
  1402. return !!elem.parentNode;
  1403. } :
  1404. function( elem, context, xml ) {
  1405. var cache, outerCache, node, diff, nodeIndex, start,
  1406. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1407. parent = elem.parentNode,
  1408. name = ofType && elem.nodeName.toLowerCase(),
  1409. useCache = !xml && !ofType;
  1410. if ( parent ) {
  1411. // :(first|last|only)-(child|of-type)
  1412. if ( simple ) {
  1413. while ( dir ) {
  1414. node = elem;
  1415. while ( (node = node[ dir ]) ) {
  1416. if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
  1417. return false;
  1418. }
  1419. }
  1420. // Reverse direction for :only-* (if we haven't yet done so)
  1421. start = dir = type === "only" && !start && "nextSibling";
  1422. }
  1423. return true;
  1424. }
  1425. start = [ forward ? parent.firstChild : parent.lastChild ];
  1426. // non-xml :nth-child(...) stores cache data on `parent`
  1427. if ( forward && useCache ) {
  1428. // Seek `elem` from a previously-cached index
  1429. outerCache = parent[ expando ] || (parent[ expando ] = {});
  1430. cache = outerCache[ type ] || [];
  1431. nodeIndex = cache[0] === dirruns && cache[1];
  1432. diff = cache[0] === dirruns && cache[2];
  1433. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1434. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1435. // Fallback to seeking `elem` from the start
  1436. (diff = nodeIndex = 0) || start.pop()) ) {
  1437. // When found, cache indexes on `parent` and break
  1438. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1439. outerCache[ type ] = [ dirruns, nodeIndex, diff ];
  1440. break;
  1441. }
  1442. }
  1443. // Use previously-cached element index if available
  1444. } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
  1445. diff = cache[1];
  1446. // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1447. } else {
  1448. // Use the same loop as above to seek `elem` from the start
  1449. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1450. (diff = nodeIndex = 0) || start.pop()) ) {
  1451. if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
  1452. // Cache the index of each encountered element
  1453. if ( useCache ) {
  1454. (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
  1455. }
  1456. if ( node === elem ) {
  1457. break;
  1458. }
  1459. }
  1460. }
  1461. }
  1462. // Incorporate the offset, then check against cycle size
  1463. diff -= last;
  1464. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1465. }
  1466. };
  1467. },
  1468. "PSEUDO": function( pseudo, argument ) {
  1469. // pseudo-class names are case-insensitive
  1470. // http://www.w3.org/TR/selectors/#pseudo-classes
  1471. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1472. // Remember that setFilters inherits from pseudos
  1473. var args,
  1474. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1475. Sizzle.error( "unsupported pseudo: " + pseudo );
  1476. // The user may use createPseudo to indicate that
  1477. // arguments are needed to create the filter function
  1478. // just as Sizzle does
  1479. if ( fn[ expando ] ) {
  1480. return fn( argument );
  1481. }
  1482. // But maintain support for old signatures
  1483. if ( fn.length > 1 ) {
  1484. args = [ pseudo, pseudo, "", argument ];
  1485. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1486. markFunction(function( seed, matches ) {
  1487. var idx,
  1488. matched = fn( seed, argument ),
  1489. i = matched.length;
  1490. while ( i-- ) {
  1491. idx = indexOf( seed, matched[i] );
  1492. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1493. }
  1494. }) :
  1495. function( elem ) {
  1496. return fn( elem, 0, args );
  1497. };
  1498. }
  1499. return fn;
  1500. }
  1501. },
  1502. pseudos: {
  1503. // Potentially complex pseudos
  1504. "not": markFunction(function( selector ) {
  1505. // Trim the selector passed to compile
  1506. // to avoid treating leading and trailing
  1507. // spaces as combinators
  1508. var input = [],
  1509. results = [],
  1510. matcher = compile( selector.replace( rtrim, "$1" ) );
  1511. return matcher[ expando ] ?
  1512. markFunction(function( seed, matches, context, xml ) {
  1513. var elem,
  1514. unmatched = matcher( seed, null, xml, [] ),
  1515. i = seed.length;
  1516. // Match elements unmatched by `matcher`
  1517. while ( i-- ) {
  1518. if ( (elem = unmatched[i]) ) {
  1519. seed[i] = !(matches[i] = elem);
  1520. }
  1521. }
  1522. }) :
  1523. function( elem, context, xml ) {
  1524. input[0] = elem;
  1525. matcher( input, null, xml, results );
  1526. // Don't keep the element (issue #299)
  1527. input[0] = null;
  1528. return !results.pop();
  1529. };
  1530. }),
  1531. "has": markFunction(function( selector ) {
  1532. return function( elem ) {
  1533. return Sizzle( selector, elem ).length > 0;
  1534. };
  1535. }),
  1536. "contains": markFunction(function( text ) {
  1537. text = text.replace( runescape, funescape );
  1538. return function( elem ) {
  1539. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1540. };
  1541. }),
  1542. // "Whether an element is represented by a :lang() selector
  1543. // is based solely on the element's language value
  1544. // being equal to the identifier C,
  1545. // or beginning with the identifier C immediately followed by "-".
  1546. // The matching of C against the element's language value is performed case-insensitively.
  1547. // The identifier C does not have to be a valid language name."
  1548. // http://www.w3.org/TR/selectors/#lang-pseudo
  1549. "lang": markFunction( function( lang ) {
  1550. // lang value must be a valid identifier
  1551. if ( !ridentifier.test(lang || "") ) {
  1552. Sizzle.error( "unsupported lang: " + lang );
  1553. }
  1554. lang = lang.replace( runescape, funescape ).toLowerCase();
  1555. return function( elem ) {
  1556. var elemLang;
  1557. do {
  1558. if ( (elemLang = documentIsHTML ?
  1559. elem.lang :
  1560. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1561. elemLang = elemLang.toLowerCase();
  1562. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1563. }
  1564. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1565. return false;
  1566. };
  1567. }),
  1568. // Miscellaneous
  1569. "target": function( elem ) {
  1570. var hash = window.location && window.location.hash;
  1571. return hash && hash.slice( 1 ) === elem.id;
  1572. },
  1573. "root": function( elem ) {
  1574. return elem === docElem;
  1575. },
  1576. "focus": function( elem ) {
  1577. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1578. },
  1579. // Boolean properties
  1580. "enabled": function( elem ) {
  1581. return elem.disabled === false;
  1582. },
  1583. "disabled": function( elem ) {
  1584. return elem.disabled === true;
  1585. },
  1586. "checked": function( elem ) {
  1587. // In CSS3, :checked should return both checked and selected elements
  1588. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1589. var nodeName = elem.nodeName.toLowerCase();
  1590. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1591. },
  1592. "selected": function( elem ) {
  1593. // Accessing this property makes selected-by-default
  1594. // options in Safari work properly
  1595. if ( elem.parentNode ) {
  1596. elem.parentNode.selectedIndex;
  1597. }
  1598. return elem.selected === true;
  1599. },
  1600. // Contents
  1601. "empty": function( elem ) {
  1602. // http://www.w3.org/TR/selectors/#empty-pseudo
  1603. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1604. // but not by others (comment: 8; processing instruction: 7; etc.)
  1605. // nodeType < 6 works because attributes (2) do not appear as children
  1606. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1607. if ( elem.nodeType < 6 ) {
  1608. return false;
  1609. }
  1610. }
  1611. return true;
  1612. },
  1613. "parent": function( elem ) {
  1614. return !Expr.pseudos["empty"]( elem );
  1615. },
  1616. // Element/input types
  1617. "header": function( elem ) {
  1618. return rheader.test( elem.nodeName );
  1619. },
  1620. "input": function( elem ) {
  1621. return rinputs.test( elem.nodeName );
  1622. },
  1623. "button": function( elem ) {
  1624. var name = elem.nodeName.toLowerCase();
  1625. return name === "input" && elem.type === "button" || name === "button";
  1626. },
  1627. "text": function( elem ) {
  1628. var attr;
  1629. return elem.nodeName.toLowerCase() === "input" &&
  1630. elem.type === "text" &&
  1631. // Support: IE<8
  1632. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1633. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1634. },
  1635. // Position-in-collection
  1636. "first": createPositionalPseudo(function() {
  1637. return [ 0 ];
  1638. }),
  1639. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1640. return [ length - 1 ];
  1641. }),
  1642. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1643. return [ argument < 0 ? argument + length : argument ];
  1644. }),
  1645. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1646. var i = 0;
  1647. for ( ; i < length; i += 2 ) {
  1648. matchIndexes.push( i );
  1649. }
  1650. return matchIndexes;
  1651. }),
  1652. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1653. var i = 1;
  1654. for ( ; i < length; i += 2 ) {
  1655. matchIndexes.push( i );
  1656. }
  1657. return matchIndexes;
  1658. }),
  1659. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1660. var i = argument < 0 ? argument + length : argument;
  1661. for ( ; --i >= 0; ) {
  1662. matchIndexes.push( i );
  1663. }
  1664. return matchIndexes;
  1665. }),
  1666. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1667. var i = argument < 0 ? argument + length : argument;
  1668. for ( ; ++i < length; ) {
  1669. matchIndexes.push( i );
  1670. }
  1671. return matchIndexes;
  1672. })
  1673. }
  1674. };
  1675. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1676. // Add button/input type pseudos
  1677. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1678. Expr.pseudos[ i ] = createInputPseudo( i );
  1679. }
  1680. for ( i in { submit: true, reset: true } ) {
  1681. Expr.pseudos[ i ] = createButtonPseudo( i );
  1682. }
  1683. // Easy API for creating new setFilters
  1684. function setFilters() {}
  1685. setFilters.prototype = Expr.filters = Expr.pseudos;
  1686. Expr.setFilters = new setFilters();
  1687. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1688. var matched, match, tokens, type,
  1689. soFar, groups, preFilters,
  1690. cached = tokenCache[ selector + " " ];
  1691. if ( cached ) {
  1692. return parseOnly ? 0 : cached.slice( 0 );
  1693. }
  1694. soFar = selector;
  1695. groups = [];
  1696. preFilters = Expr.preFilter;
  1697. while ( soFar ) {
  1698. // Comma and first run
  1699. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1700. if ( match ) {
  1701. // Don't consume trailing commas as valid
  1702. soFar = soFar.slice( match[0].length ) || soFar;
  1703. }
  1704. groups.push( (tokens = []) );
  1705. }
  1706. matched = false;
  1707. // Combinators
  1708. if ( (match = rcombinators.exec( soFar )) ) {
  1709. matched = match.shift();
  1710. tokens.push({
  1711. value: matched,
  1712. // Cast descendant combinators to space
  1713. type: match[0].replace( rtrim, " " )
  1714. });
  1715. soFar = soFar.slice( matched.length );
  1716. }
  1717. // Filters
  1718. for ( type in Expr.filter ) {
  1719. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1720. (match = preFilters[ type ]( match ))) ) {
  1721. matched = match.shift();
  1722. tokens.push({
  1723. value: matched,
  1724. type: type,
  1725. matches: match
  1726. });
  1727. soFar = soFar.slice( matched.length );
  1728. }
  1729. }
  1730. if ( !matched ) {
  1731. break;
  1732. }
  1733. }
  1734. // Return the length of the invalid excess
  1735. // if we're just parsing
  1736. // Otherwise, throw an error or return tokens
  1737. return parseOnly ?
  1738. soFar.length :
  1739. soFar ?
  1740. Sizzle.error( selector ) :
  1741. // Cache the tokens
  1742. tokenCache( selector, groups ).slice( 0 );
  1743. };
  1744. function toSelector( tokens ) {
  1745. var i = 0,
  1746. len = tokens.length,
  1747. selector = "";
  1748. for ( ; i < len; i++ ) {
  1749. selector += tokens[i].value;
  1750. }
  1751. return selector;
  1752. }
  1753. function addCombinator( matcher, combinator, base ) {
  1754. var dir = combinator.dir,
  1755. checkNonElements = base && dir === "parentNode",
  1756. doneName = done++;
  1757. return combinator.first ?
  1758. // Check against closest ancestor/preceding element
  1759. function( elem, context, xml ) {
  1760. while ( (elem = elem[ dir ]) ) {
  1761. if ( elem.nodeType === 1 || checkNonElements ) {
  1762. return matcher( elem, context, xml );
  1763. }
  1764. }
  1765. } :
  1766. // Check against all ancestor/preceding elements
  1767. function( elem, context, xml ) {
  1768. var oldCache, outerCache,
  1769. newCache = [ dirruns, doneName ];
  1770. // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
  1771. if ( xml ) {
  1772. while ( (elem = elem[ dir ]) ) {
  1773. if ( elem.nodeType === 1 || checkNonElements ) {
  1774. if ( matcher( elem, context, xml ) ) {
  1775. return true;
  1776. }
  1777. }
  1778. }
  1779. } else {
  1780. while ( (elem = elem[ dir ]) ) {
  1781. if ( elem.nodeType === 1 || checkNonElements ) {
  1782. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1783. if ( (oldCache = outerCache[ dir ]) &&
  1784. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1785. // Assign to newCache so results back-propagate to previous elements
  1786. return (newCache[ 2 ] = oldCache[ 2 ]);
  1787. } else {
  1788. // Reuse newcache so results back-propagate to previous elements
  1789. outerCache[ dir ] = newCache;
  1790. // A match means we're done; a fail means we have to keep checking
  1791. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1792. return true;
  1793. }
  1794. }
  1795. }
  1796. }
  1797. }
  1798. };
  1799. }
  1800. function elementMatcher( matchers ) {
  1801. return matchers.length > 1 ?
  1802. function( elem, context, xml ) {
  1803. var i = matchers.length;
  1804. while ( i-- ) {
  1805. if ( !matchers[i]( elem, context, xml ) ) {
  1806. return false;
  1807. }
  1808. }
  1809. return true;
  1810. } :
  1811. matchers[0];
  1812. }
  1813. function multipleContexts( selector, contexts, results ) {
  1814. var i = 0,
  1815. len = contexts.length;
  1816. for ( ; i < len; i++ ) {
  1817. Sizzle( selector, contexts[i], results );
  1818. }
  1819. return results;
  1820. }
  1821. function condense( unmatched, map, filter, context, xml ) {
  1822. var elem,
  1823. newUnmatched = [],
  1824. i = 0,
  1825. len = unmatched.length,
  1826. mapped = map != null;
  1827. for ( ; i < len; i++ ) {
  1828. if ( (elem = unmatched[i]) ) {
  1829. if ( !filter || filter( elem, context, xml ) ) {
  1830. newUnmatched.push( elem );
  1831. if ( mapped ) {
  1832. map.push( i );
  1833. }
  1834. }
  1835. }
  1836. }
  1837. return newUnmatched;
  1838. }
  1839. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1840. if ( postFilter && !postFilter[ expando ] ) {
  1841. postFilter = setMatcher( postFilter );
  1842. }
  1843. if ( postFinder && !postFinder[ expando ] ) {
  1844. postFinder = setMatcher( postFinder, postSelector );
  1845. }
  1846. return markFunction(function( seed, results, context, xml ) {
  1847. var temp, i, elem,
  1848. preMap = [],
  1849. postMap = [],
  1850. preexisting = results.length,
  1851. // Get initial elements from seed or context
  1852. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1853. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1854. matcherIn = preFilter && ( seed || !selector ) ?
  1855. condense( elems, preMap, preFilter, context, xml ) :
  1856. elems,
  1857. matcherOut = matcher ?
  1858. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1859. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1860. // ...intermediate processing is necessary
  1861. [] :
  1862. // ...otherwise use results directly
  1863. results :
  1864. matcherIn;
  1865. // Find primary matches
  1866. if ( matcher ) {
  1867. matcher( matcherIn, matcherOut, context, xml );
  1868. }
  1869. // Apply postFilter
  1870. if ( postFilter ) {
  1871. temp = condense( matcherOut, postMap );
  1872. postFilter( temp, [], context, xml );
  1873. // Un-match failing elements by moving them back to matcherIn
  1874. i = temp.length;
  1875. while ( i-- ) {
  1876. if ( (elem = temp[i]) ) {
  1877. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1878. }
  1879. }
  1880. }
  1881. if ( seed ) {
  1882. if ( postFinder || preFilter ) {
  1883. if ( postFinder ) {
  1884. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1885. temp = [];
  1886. i = matcherOut.length;
  1887. while ( i-- ) {
  1888. if ( (elem = matcherOut[i]) ) {
  1889. // Restore matcherIn since elem is not yet a final match
  1890. temp.push( (matcherIn[i] = elem) );
  1891. }
  1892. }
  1893. postFinder( null, (matcherOut = []), temp, xml );
  1894. }
  1895. // Move matched elements from seed to results to keep them synchronized
  1896. i = matcherOut.length;
  1897. while ( i-- ) {
  1898. if ( (elem = matcherOut[i]) &&
  1899. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1900. seed[temp] = !(results[temp] = elem);
  1901. }
  1902. }
  1903. }
  1904. // Add elements to results, through postFinder if defined
  1905. } else {
  1906. matcherOut = condense(
  1907. matcherOut === results ?
  1908. matcherOut.splice( preexisting, matcherOut.length ) :
  1909. matcherOut
  1910. );
  1911. if ( postFinder ) {
  1912. postFinder( null, results, matcherOut, xml );
  1913. } else {
  1914. push.apply( results, matcherOut );
  1915. }
  1916. }
  1917. });
  1918. }
  1919. function matcherFromTokens( tokens ) {
  1920. var checkContext, matcher, j,
  1921. len = tokens.length,
  1922. leadingRelative = Expr.relative[ tokens[0].type ],
  1923. implicitRelative = leadingRelative || Expr.relative[" "],
  1924. i = leadingRelative ? 1 : 0,
  1925. // The foundational matcher ensures that elements are reachable from top-level context(s)
  1926. matchContext = addCombinator( function( elem ) {
  1927. return elem === checkContext;
  1928. }, implicitRelative, true ),
  1929. matchAnyContext = addCombinator( function( elem ) {
  1930. return indexOf( checkContext, elem ) > -1;
  1931. }, implicitRelative, true ),
  1932. matchers = [ function( elem, context, xml ) {
  1933. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  1934. (checkContext = context).nodeType ?
  1935. matchContext( elem, context, xml ) :
  1936. matchAnyContext( elem, context, xml ) );
  1937. // Avoid hanging onto element (issue #299)
  1938. checkContext = null;
  1939. return ret;
  1940. } ];
  1941. for ( ; i < len; i++ ) {
  1942. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  1943. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  1944. } else {
  1945. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  1946. // Return special upon seeing a positional matcher
  1947. if ( matcher[ expando ] ) {
  1948. // Find the next relative operator (if any) for proper handling
  1949. j = ++i;
  1950. for ( ; j < len; j++ ) {
  1951. if ( Expr.relative[ tokens[j].type ] ) {
  1952. break;
  1953. }
  1954. }
  1955. return setMatcher(
  1956. i > 1 && elementMatcher( matchers ),
  1957. i > 1 && toSelector(
  1958. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  1959. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  1960. ).replace( rtrim, "$1" ),
  1961. matcher,
  1962. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  1963. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  1964. j < len && toSelector( tokens )
  1965. );
  1966. }
  1967. matchers.push( matcher );
  1968. }
  1969. }
  1970. return elementMatcher( matchers );
  1971. }
  1972. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  1973. var bySet = setMatchers.length > 0,
  1974. byElement = elementMatchers.length > 0,
  1975. superMatcher = function( seed, context, xml, results, outermost ) {
  1976. var elem, j, matcher,
  1977. matchedCount = 0,
  1978. i = "0",
  1979. unmatched = seed && [],
  1980. setMatched = [],
  1981. contextBackup = outermostContext,
  1982. // We must always have either seed elements or outermost context
  1983. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  1984. // Use integer dirruns iff this is the outermost matcher
  1985. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  1986. len = elems.length;
  1987. if ( outermost ) {
  1988. outermostContext = context !== document && context;
  1989. }
  1990. // Add elements passing elementMatchers directly to results
  1991. // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
  1992. // Support: IE<9, Safari
  1993. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  1994. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  1995. if ( byElement && elem ) {
  1996. j = 0;
  1997. while ( (matcher = elementMatchers[j++]) ) {
  1998. if ( matcher( elem, context, xml ) ) {
  1999. results.push( elem );
  2000. break;
  2001. }
  2002. }
  2003. if ( outermost ) {
  2004. dirruns = dirrunsUnique;
  2005. }
  2006. }
  2007. // Track unmatched elements for set filters
  2008. if ( bySet ) {
  2009. // They will have gone through all possible matchers
  2010. if ( (elem = !matcher && elem) ) {
  2011. matchedCount--;
  2012. }
  2013. // Lengthen the array for every element, matched or not
  2014. if ( seed ) {
  2015. unmatched.push( elem );
  2016. }
  2017. }
  2018. }
  2019. // Apply set filters to unmatched elements
  2020. matchedCount += i;
  2021. if ( bySet && i !== matchedCount ) {
  2022. j = 0;
  2023. while ( (matcher = setMatchers[j++]) ) {
  2024. matcher( unmatched, setMatched, context, xml );
  2025. }
  2026. if ( seed ) {
  2027. // Reintegrate element matches to eliminate the need for sorting
  2028. if ( matchedCount > 0 ) {
  2029. while ( i-- ) {
  2030. if ( !(unmatched[i] || setMatched[i]) ) {
  2031. setMatched[i] = pop.call( results );
  2032. }
  2033. }
  2034. }
  2035. // Discard index placeholder values to get only actual matches
  2036. setMatched = condense( setMatched );
  2037. }
  2038. // Add matches to results
  2039. push.apply( results, setMatched );
  2040. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2041. if ( outermost && !seed && setMatched.length > 0 &&
  2042. ( matchedCount + setMatchers.length ) > 1 ) {
  2043. Sizzle.uniqueSort( results );
  2044. }
  2045. }
  2046. // Override manipulation of globals by nested matchers
  2047. if ( outermost ) {
  2048. dirruns = dirrunsUnique;
  2049. outermostContext = contextBackup;
  2050. }
  2051. return unmatched;
  2052. };
  2053. return bySet ?
  2054. markFunction( superMatcher ) :
  2055. superMatcher;
  2056. }
  2057. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2058. var i,
  2059. setMatchers = [],
  2060. elementMatchers = [],
  2061. cached = compilerCache[ selector + " " ];
  2062. if ( !cached ) {
  2063. // Generate a function of recursive functions that can be used to check each element
  2064. if ( !match ) {
  2065. match = tokenize( selector );
  2066. }
  2067. i = match.length;
  2068. while ( i-- ) {
  2069. cached = matcherFromTokens( match[i] );
  2070. if ( cached[ expando ] ) {
  2071. setMatchers.push( cached );
  2072. } else {
  2073. elementMatchers.push( cached );
  2074. }
  2075. }
  2076. // Cache the compiled function
  2077. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2078. // Save selector and tokenization
  2079. cached.selector = selector;
  2080. }
  2081. return cached;
  2082. };
  2083. /**
  2084. * A low-level selection function that works with Sizzle's compiled
  2085. * selector functions
  2086. * @param {String|Function} selector A selector or a pre-compiled
  2087. * selector function built with Sizzle.compile
  2088. * @param {Element} context
  2089. * @param {Array} [results]
  2090. * @param {Array} [seed] A set of elements to match against
  2091. */
  2092. select = Sizzle.select = function( selector, context, results, seed ) {
  2093. var i, tokens, token, type, find,
  2094. compiled = typeof selector === "function" && selector,
  2095. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2096. results = results || [];
  2097. // Try to minimize operations if there is no seed and only one group
  2098. if ( match.length === 1 ) {
  2099. // Take a shortcut and set the context if the root selector is an ID
  2100. tokens = match[0] = match[0].slice( 0 );
  2101. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2102. support.getById && context.nodeType === 9 && documentIsHTML &&
  2103. Expr.relative[ tokens[1].type ] ) {
  2104. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2105. if ( !context ) {
  2106. return results;
  2107. // Precompiled matchers will still verify ancestry, so step up a level
  2108. } else if ( compiled ) {
  2109. context = context.parentNode;
  2110. }
  2111. selector = selector.slice( tokens.shift().value.length );
  2112. }
  2113. // Fetch a seed set for right-to-left matching
  2114. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2115. while ( i-- ) {
  2116. token = tokens[i];
  2117. // Abort if we hit a combinator
  2118. if ( Expr.relative[ (type = token.type) ] ) {
  2119. break;
  2120. }
  2121. if ( (find = Expr.find[ type ]) ) {
  2122. // Search, expanding context for leading sibling combinators
  2123. if ( (seed = find(
  2124. token.matches[0].replace( runescape, funescape ),
  2125. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2126. )) ) {
  2127. // If seed is empty or no tokens remain, we can return early
  2128. tokens.splice( i, 1 );
  2129. selector = seed.length && toSelector( tokens );
  2130. if ( !selector ) {
  2131. push.apply( results, seed );
  2132. return results;
  2133. }
  2134. break;
  2135. }
  2136. }
  2137. }
  2138. }
  2139. // Compile and execute a filtering function if one is not provided
  2140. // Provide `match` to avoid retokenization if we modified the selector above
  2141. ( compiled || compile( selector, match ) )(
  2142. seed,
  2143. context,
  2144. !documentIsHTML,
  2145. results,
  2146. rsibling.test( selector ) && testContext( context.parentNode ) || context
  2147. );
  2148. return results;
  2149. };
  2150. // One-time assignments
  2151. // Sort stability
  2152. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2153. // Support: Chrome 14-35+
  2154. // Always assume duplicates if they aren't passed to the comparison function
  2155. support.detectDuplicates = !!hasDuplicate;
  2156. // Initialize against the default document
  2157. setDocument();
  2158. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2159. // Detached nodes confoundingly follow *each other*
  2160. support.sortDetached = assert(function( div1 ) {
  2161. // Should return 1, but returns 4 (following)
  2162. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  2163. });
  2164. // Support: IE<8
  2165. // Prevent attribute/property "interpolation"
  2166. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2167. if ( !assert(function( div ) {
  2168. div.innerHTML = "<a href='#'></a>";
  2169. return div.firstChild.getAttribute("href") === "#" ;
  2170. }) ) {
  2171. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2172. if ( !isXML ) {
  2173. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2174. }
  2175. });
  2176. }
  2177. // Support: IE<9
  2178. // Use defaultValue in place of getAttribute("value")
  2179. if ( !support.attributes || !assert(function( div ) {
  2180. div.innerHTML = "<input/>";
  2181. div.firstChild.setAttribute( "value", "" );
  2182. return div.firstChild.getAttribute( "value" ) === "";
  2183. }) ) {
  2184. addHandle( "value", function( elem, name, isXML ) {
  2185. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2186. return elem.defaultValue;
  2187. }
  2188. });
  2189. }
  2190. // Support: IE<9
  2191. // Use getAttributeNode to fetch booleans when getAttribute lies
  2192. if ( !assert(function( div ) {
  2193. return div.getAttribute("disabled") == null;
  2194. }) ) {
  2195. addHandle( booleans, function( elem, name, isXML ) {
  2196. var val;
  2197. if ( !isXML ) {
  2198. return elem[ name ] === true ? name.toLowerCase() :
  2199. (val = elem.getAttributeNode( name )) && val.specified ?
  2200. val.value :
  2201. null;
  2202. }
  2203. });
  2204. }
  2205. return Sizzle;
  2206. })( window );
  2207. jQuery.find = Sizzle;
  2208. jQuery.expr = Sizzle.selectors;
  2209. jQuery.expr[":"] = jQuery.expr.pseudos;
  2210. jQuery.unique = Sizzle.uniqueSort;
  2211. jQuery.text = Sizzle.getText;
  2212. jQuery.isXMLDoc = Sizzle.isXML;
  2213. jQuery.contains = Sizzle.contains;
  2214. var rneedsContext = jQuery.expr.match.needsContext;
  2215. var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
  2216. var risSimple = /^.[^:#\[\.,]*$/;
  2217. // Implement the identical functionality for filter and not
  2218. function winnow( elements, qualifier, not ) {
  2219. if ( jQuery.isFunction( qualifier ) ) {
  2220. return jQuery.grep( elements, function( elem, i ) {
  2221. /* jshint -W018 */
  2222. return !!qualifier.call( elem, i, elem ) !== not;
  2223. });
  2224. }
  2225. if ( qualifier.nodeType ) {
  2226. return jQuery.grep( elements, function( elem ) {
  2227. return ( elem === qualifier ) !== not;
  2228. });
  2229. }
  2230. if ( typeof qualifier === "string" ) {
  2231. if ( risSimple.test( qualifier ) ) {
  2232. return jQuery.filter( qualifier, elements, not );
  2233. }
  2234. qualifier = jQuery.filter( qualifier, elements );
  2235. }
  2236. return jQuery.grep( elements, function( elem ) {
  2237. return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
  2238. });
  2239. }
  2240. jQuery.filter = function( expr, elems, not ) {
  2241. var elem = elems[ 0 ];
  2242. if ( not ) {
  2243. expr = ":not(" + expr + ")";
  2244. }
  2245. return elems.length === 1 && elem.nodeType === 1 ?
  2246. jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
  2247. jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2248. return elem.nodeType === 1;
  2249. }));
  2250. };
  2251. jQuery.fn.extend({
  2252. find: function( selector ) {
  2253. var i,
  2254. len = this.length,
  2255. ret = [],
  2256. self = this;
  2257. if ( typeof selector !== "string" ) {
  2258. return this.pushStack( jQuery( selector ).filter(function() {
  2259. for ( i = 0; i < len; i++ ) {
  2260. if ( jQuery.contains( self[ i ], this ) ) {
  2261. return true;
  2262. }
  2263. }
  2264. }) );
  2265. }
  2266. for ( i = 0; i < len; i++ ) {
  2267. jQuery.find( selector, self[ i ], ret );
  2268. }
  2269. // Needed because $( selector, context ) becomes $( context ).find( selector )
  2270. ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
  2271. ret.selector = this.selector ? this.selector + " " + selector : selector;
  2272. return ret;
  2273. },
  2274. filter: function( selector ) {
  2275. return this.pushStack( winnow(this, selector || [], false) );
  2276. },
  2277. not: function( selector ) {
  2278. return this.pushStack( winnow(this, selector || [], true) );
  2279. },
  2280. is: function( selector ) {
  2281. return !!winnow(
  2282. this,
  2283. // If this is a positional/relative selector, check membership in the returned set
  2284. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2285. typeof selector === "string" && rneedsContext.test( selector ) ?
  2286. jQuery( selector ) :
  2287. selector || [],
  2288. false
  2289. ).length;
  2290. }
  2291. });
  2292. // Initialize a jQuery object
  2293. // A central reference to the root jQuery(document)
  2294. var rootjQuery,
  2295. // A simple way to check for HTML strings
  2296. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2297. // Strict HTML recognition (#11290: must start with <)
  2298. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  2299. init = jQuery.fn.init = function( selector, context ) {
  2300. var match, elem;
  2301. // HANDLE: $(""), $(null), $(undefined), $(false)
  2302. if ( !selector ) {
  2303. return this;
  2304. }
  2305. // Handle HTML strings
  2306. if ( typeof selector === "string" ) {
  2307. if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
  2308. // Assume that strings that start and end with <> are HTML and skip the regex check
  2309. match = [ null, selector, null ];
  2310. } else {
  2311. match = rquickExpr.exec( selector );
  2312. }
  2313. // Match html or make sure no context is specified for #id
  2314. if ( match && (match[1] || !context) ) {
  2315. // HANDLE: $(html) -> $(array)
  2316. if ( match[1] ) {
  2317. context = context instanceof jQuery ? context[0] : context;
  2318. // Option to run scripts is true for back-compat
  2319. // Intentionally let the error be thrown if parseHTML is not present
  2320. jQuery.merge( this, jQuery.parseHTML(
  2321. match[1],
  2322. context && context.nodeType ? context.ownerDocument || context : document,
  2323. true
  2324. ) );
  2325. // HANDLE: $(html, props)
  2326. if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
  2327. for ( match in context ) {
  2328. // Properties of context are called as methods if possible
  2329. if ( jQuery.isFunction( this[ match ] ) ) {
  2330. this[ match ]( context[ match ] );
  2331. // ...and otherwise set as attributes
  2332. } else {
  2333. this.attr( match, context[ match ] );
  2334. }
  2335. }
  2336. }
  2337. return this;
  2338. // HANDLE: $(#id)
  2339. } else {
  2340. elem = document.getElementById( match[2] );
  2341. // Support: Blackberry 4.6
  2342. // gEBID returns nodes no longer in the document (#6963)
  2343. if ( elem && elem.parentNode ) {
  2344. // Inject the element directly into the jQuery object
  2345. this.length = 1;
  2346. this[0] = elem;
  2347. }
  2348. this.context = document;
  2349. this.selector = selector;
  2350. return this;
  2351. }
  2352. // HANDLE: $(expr, $(...))
  2353. } else if ( !context || context.jquery ) {
  2354. return ( context || rootjQuery ).find( selector );
  2355. // HANDLE: $(expr, context)
  2356. // (which is just equivalent to: $(context).find(expr)
  2357. } else {
  2358. return this.constructor( context ).find( selector );
  2359. }
  2360. // HANDLE: $(DOMElement)
  2361. } else if ( selector.nodeType ) {
  2362. this.context = this[0] = selector;
  2363. this.length = 1;
  2364. return this;
  2365. // HANDLE: $(function)
  2366. // Shortcut for document ready
  2367. } else if ( jQuery.isFunction( selector ) ) {
  2368. return typeof rootjQuery.ready !== "undefined" ?
  2369. rootjQuery.ready( selector ) :
  2370. // Execute immediately if ready is not present
  2371. selector( jQuery );
  2372. }
  2373. if ( selector.selector !== undefined ) {
  2374. this.selector = selector.selector;
  2375. this.context = selector.context;
  2376. }
  2377. return jQuery.makeArray( selector, this );
  2378. };
  2379. // Give the init function the jQuery prototype for later instantiation
  2380. init.prototype = jQuery.fn;
  2381. // Initialize central reference
  2382. rootjQuery = jQuery( document );
  2383. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2384. // Methods guaranteed to produce a unique set when starting from a unique set
  2385. guaranteedUnique = {
  2386. children: true,
  2387. contents: true,
  2388. next: true,
  2389. prev: true
  2390. };
  2391. jQuery.extend({
  2392. dir: function( elem, dir, until ) {
  2393. var matched = [],
  2394. truncate = until !== undefined;
  2395. while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
  2396. if ( elem.nodeType === 1 ) {
  2397. if ( truncate && jQuery( elem ).is( until ) ) {
  2398. break;
  2399. }
  2400. matched.push( elem );
  2401. }
  2402. }
  2403. return matched;
  2404. },
  2405. sibling: function( n, elem ) {
  2406. var matched = [];
  2407. for ( ; n; n = n.nextSibling ) {
  2408. if ( n.nodeType === 1 && n !== elem ) {
  2409. matched.push( n );
  2410. }
  2411. }
  2412. return matched;
  2413. }
  2414. });
  2415. jQuery.fn.extend({
  2416. has: function( target ) {
  2417. var targets = jQuery( target, this ),
  2418. l = targets.length;
  2419. return this.filter(function() {
  2420. var i = 0;
  2421. for ( ; i < l; i++ ) {
  2422. if ( jQuery.contains( this, targets[i] ) ) {
  2423. return true;
  2424. }
  2425. }
  2426. });
  2427. },
  2428. closest: function( selectors, context ) {
  2429. var cur,
  2430. i = 0,
  2431. l = this.length,
  2432. matched = [],
  2433. pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
  2434. jQuery( selectors, context || this.context ) :
  2435. 0;
  2436. for ( ; i < l; i++ ) {
  2437. for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
  2438. // Always skip document fragments
  2439. if ( cur.nodeType < 11 && (pos ?
  2440. pos.index(cur) > -1 :
  2441. // Don't pass non-elements to Sizzle
  2442. cur.nodeType === 1 &&
  2443. jQuery.find.matchesSelector(cur, selectors)) ) {
  2444. matched.push( cur );
  2445. break;
  2446. }
  2447. }
  2448. }
  2449. return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
  2450. },
  2451. // Determine the position of an element within the set
  2452. index: function( elem ) {
  2453. // No argument, return index in parent
  2454. if ( !elem ) {
  2455. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2456. }
  2457. // Index in selector
  2458. if ( typeof elem === "string" ) {
  2459. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2460. }
  2461. // Locate the position of the desired element
  2462. return indexOf.call( this,
  2463. // If it receives a jQuery object, the first element is used
  2464. elem.jquery ? elem[ 0 ] : elem
  2465. );
  2466. },
  2467. add: function( selector, context ) {
  2468. return this.pushStack(
  2469. jQuery.unique(
  2470. jQuery.merge( this.get(), jQuery( selector, context ) )
  2471. )
  2472. );
  2473. },
  2474. addBack: function( selector ) {
  2475. return this.add( selector == null ?
  2476. this.prevObject : this.prevObject.filter(selector)
  2477. );
  2478. }
  2479. });
  2480. function sibling( cur, dir ) {
  2481. while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
  2482. return cur;
  2483. }
  2484. jQuery.each({
  2485. parent: function( elem ) {
  2486. var parent = elem.parentNode;
  2487. return parent && parent.nodeType !== 11 ? parent : null;
  2488. },
  2489. parents: function( elem ) {
  2490. return jQuery.dir( elem, "parentNode" );
  2491. },
  2492. parentsUntil: function( elem, i, until ) {
  2493. return jQuery.dir( elem, "parentNode", until );
  2494. },
  2495. next: function( elem ) {
  2496. return sibling( elem, "nextSibling" );
  2497. },
  2498. prev: function( elem ) {
  2499. return sibling( elem, "previousSibling" );
  2500. },
  2501. nextAll: function( elem ) {
  2502. return jQuery.dir( elem, "nextSibling" );
  2503. },
  2504. prevAll: function( elem ) {
  2505. return jQuery.dir( elem, "previousSibling" );
  2506. },
  2507. nextUntil: function( elem, i, until ) {
  2508. return jQuery.dir( elem, "nextSibling", until );
  2509. },
  2510. prevUntil: function( elem, i, until ) {
  2511. return jQuery.dir( elem, "previousSibling", until );
  2512. },
  2513. siblings: function( elem ) {
  2514. return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
  2515. },
  2516. children: function( elem ) {
  2517. return jQuery.sibling( elem.firstChild );
  2518. },
  2519. contents: function( elem ) {
  2520. return elem.contentDocument || jQuery.merge( [], elem.childNodes );
  2521. }
  2522. }, function( name, fn ) {
  2523. jQuery.fn[ name ] = function( until, selector ) {
  2524. var matched = jQuery.map( this, fn, until );
  2525. if ( name.slice( -5 ) !== "Until" ) {
  2526. selector = until;
  2527. }
  2528. if ( selector && typeof selector === "string" ) {
  2529. matched = jQuery.filter( selector, matched );
  2530. }
  2531. if ( this.length > 1 ) {
  2532. // Remove duplicates
  2533. if ( !guaranteedUnique[ name ] ) {
  2534. jQuery.unique( matched );
  2535. }
  2536. // Reverse order for parents* and prev-derivatives
  2537. if ( rparentsprev.test( name ) ) {
  2538. matched.reverse();
  2539. }
  2540. }
  2541. return this.pushStack( matched );
  2542. };
  2543. });
  2544. var rnotwhite = (/\S+/g);
  2545. // String to Object options format cache
  2546. var optionsCache = {};
  2547. // Convert String-formatted options into Object-formatted ones and store in cache
  2548. function createOptions( options ) {
  2549. var object = optionsCache[ options ] = {};
  2550. jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
  2551. object[ flag ] = true;
  2552. });
  2553. return object;
  2554. }
  2555. /*
  2556. * Create a callback list using the following parameters:
  2557. *
  2558. * options: an optional list of space-separated options that will change how
  2559. * the callback list behaves or a more traditional option object
  2560. *
  2561. * By default a callback list will act like an event callback list and can be
  2562. * "fired" multiple times.
  2563. *
  2564. * Possible options:
  2565. *
  2566. * once: will ensure the callback list can only be fired once (like a Deferred)
  2567. *
  2568. * memory: will keep track of previous values and will call any callback added
  2569. * after the list has been fired right away with the latest "memorized"
  2570. * values (like a Deferred)
  2571. *
  2572. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2573. *
  2574. * stopOnFalse: interrupt callings when a callback returns false
  2575. *
  2576. */
  2577. jQuery.Callbacks = function( options ) {
  2578. // Convert options from String-formatted to Object-formatted if needed
  2579. // (we check in cache first)
  2580. options = typeof options === "string" ?
  2581. ( optionsCache[ options ] || createOptions( options ) ) :
  2582. jQuery.extend( {}, options );
  2583. var // Last fire value (for non-forgettable lists)
  2584. memory,
  2585. // Flag to know if list was already fired
  2586. fired,
  2587. // Flag to know if list is currently firing
  2588. firing,
  2589. // First callback to fire (used internally by add and fireWith)
  2590. firingStart,
  2591. // End of the loop when firing
  2592. firingLength,
  2593. // Index of currently firing callback (modified by remove if needed)
  2594. firingIndex,
  2595. // Actual callback list
  2596. list = [],
  2597. // Stack of fire calls for repeatable lists
  2598. stack = !options.once && [],
  2599. // Fire callbacks
  2600. fire = function( data ) {
  2601. memory = options.memory && data;
  2602. fired = true;
  2603. firingIndex = firingStart || 0;
  2604. firingStart = 0;
  2605. firingLength = list.length;
  2606. firing = true;
  2607. for ( ; list && firingIndex < firingLength; firingIndex++ ) {
  2608. if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
  2609. memory = false; // To prevent further calls using add
  2610. break;
  2611. }
  2612. }
  2613. firing = false;
  2614. if ( list ) {
  2615. if ( stack ) {
  2616. if ( stack.length ) {
  2617. fire( stack.shift() );
  2618. }
  2619. } else if ( memory ) {
  2620. list = [];
  2621. } else {
  2622. self.disable();
  2623. }
  2624. }
  2625. },
  2626. // Actual Callbacks object
  2627. self = {
  2628. // Add a callback or a collection of callbacks to the list
  2629. add: function() {
  2630. if ( list ) {
  2631. // First, we save the current length
  2632. var start = list.length;
  2633. (function add( args ) {
  2634. jQuery.each( args, function( _, arg ) {
  2635. var type = jQuery.type( arg );
  2636. if ( type === "function" ) {
  2637. if ( !options.unique || !self.has( arg ) ) {
  2638. list.push( arg );
  2639. }
  2640. } else if ( arg && arg.length && type !== "string" ) {
  2641. // Inspect recursively
  2642. add( arg );
  2643. }
  2644. });
  2645. })( arguments );
  2646. // Do we need to add the callbacks to the
  2647. // current firing batch?
  2648. if ( firing ) {
  2649. firingLength = list.length;
  2650. // With memory, if we're not firing then
  2651. // we should call right away
  2652. } else if ( memory ) {
  2653. firingStart = start;
  2654. fire( memory );
  2655. }
  2656. }
  2657. return this;
  2658. },
  2659. // Remove a callback from the list
  2660. remove: function() {
  2661. if ( list ) {
  2662. jQuery.each( arguments, function( _, arg ) {
  2663. var index;
  2664. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2665. list.splice( index, 1 );
  2666. // Handle firing indexes
  2667. if ( firing ) {
  2668. if ( index <= firingLength ) {
  2669. firingLength--;
  2670. }
  2671. if ( index <= firingIndex ) {
  2672. firingIndex--;
  2673. }
  2674. }
  2675. }
  2676. });
  2677. }
  2678. return this;
  2679. },
  2680. // Check if a given callback is in the list.
  2681. // If no argument is given, return whether or not list has callbacks attached.
  2682. has: function( fn ) {
  2683. return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
  2684. },
  2685. // Remove all callbacks from the list
  2686. empty: function() {
  2687. list = [];
  2688. firingLength = 0;
  2689. return this;
  2690. },
  2691. // Have the list do nothing anymore
  2692. disable: function() {
  2693. list = stack = memory = undefined;
  2694. return this;
  2695. },
  2696. // Is it disabled?
  2697. disabled: function() {
  2698. return !list;
  2699. },
  2700. // Lock the list in its current state
  2701. lock: function() {
  2702. stack = undefined;
  2703. if ( !memory ) {
  2704. self.disable();
  2705. }
  2706. return this;
  2707. },
  2708. // Is it locked?
  2709. locked: function() {
  2710. return !stack;
  2711. },
  2712. // Call all callbacks with the given context and arguments
  2713. fireWith: function( context, args ) {
  2714. if ( list && ( !fired || stack ) ) {
  2715. args = args || [];
  2716. args = [ context, args.slice ? args.slice() : args ];
  2717. if ( firing ) {
  2718. stack.push( args );
  2719. } else {
  2720. fire( args );
  2721. }
  2722. }
  2723. return this;
  2724. },
  2725. // Call all the callbacks with the given arguments
  2726. fire: function() {
  2727. self.fireWith( this, arguments );
  2728. return this;
  2729. },
  2730. // To know if the callbacks have already been called at least once
  2731. fired: function() {
  2732. return !!fired;
  2733. }
  2734. };
  2735. return self;
  2736. };
  2737. jQuery.extend({
  2738. Deferred: function( func ) {
  2739. var tuples = [
  2740. // action, add listener, listener list, final state
  2741. [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
  2742. [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
  2743. [ "notify", "progress", jQuery.Callbacks("memory") ]
  2744. ],
  2745. state = "pending",
  2746. promise = {
  2747. state: function() {
  2748. return state;
  2749. },
  2750. always: function() {
  2751. deferred.done( arguments ).fail( arguments );
  2752. return this;
  2753. },
  2754. then: function( /* fnDone, fnFail, fnProgress */ ) {
  2755. var fns = arguments;
  2756. return jQuery.Deferred(function( newDefer ) {
  2757. jQuery.each( tuples, function( i, tuple ) {
  2758. var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  2759. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  2760. deferred[ tuple[1] ](function() {
  2761. var returned = fn && fn.apply( this, arguments );
  2762. if ( returned && jQuery.isFunction( returned.promise ) ) {
  2763. returned.promise()
  2764. .done( newDefer.resolve )
  2765. .fail( newDefer.reject )
  2766. .progress( newDefer.notify );
  2767. } else {
  2768. newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
  2769. }
  2770. });
  2771. });
  2772. fns = null;
  2773. }).promise();
  2774. },
  2775. // Get a promise for this deferred
  2776. // If obj is provided, the promise aspect is added to the object
  2777. promise: function( obj ) {
  2778. return obj != null ? jQuery.extend( obj, promise ) : promise;
  2779. }
  2780. },
  2781. deferred = {};
  2782. // Keep pipe for back-compat
  2783. promise.pipe = promise.then;
  2784. // Add list-specific methods
  2785. jQuery.each( tuples, function( i, tuple ) {
  2786. var list = tuple[ 2 ],
  2787. stateString = tuple[ 3 ];
  2788. // promise[ done | fail | progress ] = list.add
  2789. promise[ tuple[1] ] = list.add;
  2790. // Handle state
  2791. if ( stateString ) {
  2792. list.add(function() {
  2793. // state = [ resolved | rejected ]
  2794. state = stateString;
  2795. // [ reject_list | resolve_list ].disable; progress_list.lock
  2796. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  2797. }
  2798. // deferred[ resolve | reject | notify ]
  2799. deferred[ tuple[0] ] = function() {
  2800. deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
  2801. return this;
  2802. };
  2803. deferred[ tuple[0] + "With" ] = list.fireWith;
  2804. });
  2805. // Make the deferred a promise
  2806. promise.promise( deferred );
  2807. // Call given func if any
  2808. if ( func ) {
  2809. func.call( deferred, deferred );
  2810. }
  2811. // All done!
  2812. return deferred;
  2813. },
  2814. // Deferred helper
  2815. when: function( subordinate /* , ..., subordinateN */ ) {
  2816. var i = 0,
  2817. resolveValues = slice.call( arguments ),
  2818. length = resolveValues.length,
  2819. // the count of uncompleted subordinates
  2820. remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  2821. // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
  2822. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  2823. // Update function for both resolve and progress values
  2824. updateFunc = function( i, contexts, values ) {
  2825. return function( value ) {
  2826. contexts[ i ] = this;
  2827. values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  2828. if ( values === progressValues ) {
  2829. deferred.notifyWith( contexts, values );
  2830. } else if ( !( --remaining ) ) {
  2831. deferred.resolveWith( contexts, values );
  2832. }
  2833. };
  2834. },
  2835. progressValues, progressContexts, resolveContexts;
  2836. // Add listeners to Deferred subordinates; treat others as resolved
  2837. if ( length > 1 ) {
  2838. progressValues = new Array( length );
  2839. progressContexts = new Array( length );
  2840. resolveContexts = new Array( length );
  2841. for ( ; i < length; i++ ) {
  2842. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  2843. resolveValues[ i ].promise()
  2844. .done( updateFunc( i, resolveContexts, resolveValues ) )
  2845. .fail( deferred.reject )
  2846. .progress( updateFunc( i, progressContexts, progressValues ) );
  2847. } else {
  2848. --remaining;
  2849. }
  2850. }
  2851. }
  2852. // If we're not waiting on anything, resolve the master
  2853. if ( !remaining ) {
  2854. deferred.resolveWith( resolveContexts, resolveValues );
  2855. }
  2856. return deferred.promise();
  2857. }
  2858. });
  2859. // The deferred used on DOM ready
  2860. var readyList;
  2861. jQuery.fn.ready = function( fn ) {
  2862. // Add the callback
  2863. jQuery.ready.promise().done( fn );
  2864. return this;
  2865. };
  2866. jQuery.extend({
  2867. // Is the DOM ready to be used? Set to true once it occurs.
  2868. isReady: false,
  2869. // A counter to track how many items to wait for before
  2870. // the ready event fires. See #6781
  2871. readyWait: 1,
  2872. // Hold (or release) the ready event
  2873. holdReady: function( hold ) {
  2874. if ( hold ) {
  2875. jQuery.readyWait++;
  2876. } else {
  2877. jQuery.ready( true );
  2878. }
  2879. },
  2880. // Handle when the DOM is ready
  2881. ready: function( wait ) {
  2882. // Abort if there are pending holds or we're already ready
  2883. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  2884. return;
  2885. }
  2886. // Remember that the DOM is ready
  2887. jQuery.isReady = true;
  2888. // If a normal DOM Ready event fired, decrement, and wait if need be
  2889. if ( wait !== true && --jQuery.readyWait > 0 ) {
  2890. return;
  2891. }
  2892. // If there are functions bound, to execute
  2893. readyList.resolveWith( document, [ jQuery ] );
  2894. // Trigger any bound ready events
  2895. if ( jQuery.fn.triggerHandler ) {
  2896. jQuery( document ).triggerHandler( "ready" );
  2897. jQuery( document ).off( "ready" );
  2898. }
  2899. }
  2900. });
  2901. /**
  2902. * The ready event handler and self cleanup method
  2903. */
  2904. function completed() {
  2905. document.removeEventListener( "DOMContentLoaded", completed, false );
  2906. window.removeEventListener( "load", completed, false );
  2907. jQuery.ready();
  2908. }
  2909. jQuery.ready.promise = function( obj ) {
  2910. if ( !readyList ) {
  2911. readyList = jQuery.Deferred();
  2912. // Catch cases where $(document).ready() is called after the browser event has already occurred.
  2913. // We once tried to use readyState "interactive" here, but it caused issues like the one
  2914. // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
  2915. if ( document.readyState === "complete" ) {
  2916. // Handle it asynchronously to allow scripts the opportunity to delay ready
  2917. setTimeout( jQuery.ready );
  2918. } else {
  2919. // Use the handy event callback
  2920. document.addEventListener( "DOMContentLoaded", completed, false );
  2921. // A fallback to window.onload, that will always work
  2922. window.addEventListener( "load", completed, false );
  2923. }
  2924. }
  2925. return readyList.promise( obj );
  2926. };
  2927. // Kick off the DOM ready check even if the user does not
  2928. jQuery.ready.promise();
  2929. // Multifunctional method to get and set values of a collection
  2930. // The value/s can optionally be executed if it's a function
  2931. var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  2932. var i = 0,
  2933. len = elems.length,
  2934. bulk = key == null;
  2935. // Sets many values
  2936. if ( jQuery.type( key ) === "object" ) {
  2937. chainable = true;
  2938. for ( i in key ) {
  2939. jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
  2940. }
  2941. // Sets one value
  2942. } else if ( value !== undefined ) {
  2943. chainable = true;
  2944. if ( !jQuery.isFunction( value ) ) {
  2945. raw = true;
  2946. }
  2947. if ( bulk ) {
  2948. // Bulk operations run against the entire set
  2949. if ( raw ) {
  2950. fn.call( elems, value );
  2951. fn = null;
  2952. // ...except when executing function values
  2953. } else {
  2954. bulk = fn;
  2955. fn = function( elem, key, value ) {
  2956. return bulk.call( jQuery( elem ), value );
  2957. };
  2958. }
  2959. }
  2960. if ( fn ) {
  2961. for ( ; i < len; i++ ) {
  2962. fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
  2963. }
  2964. }
  2965. }
  2966. return chainable ?
  2967. elems :
  2968. // Gets
  2969. bulk ?
  2970. fn.call( elems ) :
  2971. len ? fn( elems[0], key ) : emptyGet;
  2972. };
  2973. /**
  2974. * Determines whether an object can have data
  2975. */
  2976. jQuery.acceptData = function( owner ) {
  2977. // Accepts only:
  2978. // - Node
  2979. // - Node.ELEMENT_NODE
  2980. // - Node.DOCUMENT_NODE
  2981. // - Object
  2982. // - Any
  2983. /* jshint -W018 */
  2984. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  2985. };
  2986. function Data() {
  2987. // Support: Android<4,
  2988. // Old WebKit does not have Object.preventExtensions/freeze method,
  2989. // return new empty object instead with no [[set]] accessor
  2990. Object.defineProperty( this.cache = {}, 0, {
  2991. get: function() {
  2992. return {};
  2993. }
  2994. });
  2995. this.expando = jQuery.expando + Data.uid++;
  2996. }
  2997. Data.uid = 1;
  2998. Data.accepts = jQuery.acceptData;
  2999. Data.prototype = {
  3000. key: function( owner ) {
  3001. // We can accept data for non-element nodes in modern browsers,
  3002. // but we should not, see #8335.
  3003. // Always return the key for a frozen object.
  3004. if ( !Data.accepts( owner ) ) {
  3005. return 0;
  3006. }
  3007. var descriptor = {},
  3008. // Check if the owner object already has a cache key
  3009. unlock = owner[ this.expando ];
  3010. // If not, create one
  3011. if ( !unlock ) {
  3012. unlock = Data.uid++;
  3013. // Secure it in a non-enumerable, non-writable property
  3014. try {
  3015. descriptor[ this.expando ] = { value: unlock };
  3016. Object.defineProperties( owner, descriptor );
  3017. // Support: Android<4
  3018. // Fallback to a less secure definition
  3019. } catch ( e ) {
  3020. descriptor[ this.expando ] = unlock;
  3021. jQuery.extend( owner, descriptor );
  3022. }
  3023. }
  3024. // Ensure the cache object
  3025. if ( !this.cache[ unlock ] ) {
  3026. this.cache[ unlock ] = {};
  3027. }
  3028. return unlock;
  3029. },
  3030. set: function( owner, data, value ) {
  3031. var prop,
  3032. // There may be an unlock assigned to this node,
  3033. // if there is no entry for this "owner", create one inline
  3034. // and set the unlock as though an owner entry had always existed
  3035. unlock = this.key( owner ),
  3036. cache = this.cache[ unlock ];
  3037. // Handle: [ owner, key, value ] args
  3038. if ( typeof data === "string" ) {
  3039. cache[ data ] = value;
  3040. // Handle: [ owner, { properties } ] args
  3041. } else {
  3042. // Fresh assignments by object are shallow copied
  3043. if ( jQuery.isEmptyObject( cache ) ) {
  3044. jQuery.extend( this.cache[ unlock ], data );
  3045. // Otherwise, copy the properties one-by-one to the cache object
  3046. } else {
  3047. for ( prop in data ) {
  3048. cache[ prop ] = data[ prop ];
  3049. }
  3050. }
  3051. }
  3052. return cache;
  3053. },
  3054. get: function( owner, key ) {
  3055. // Either a valid cache is found, or will be created.
  3056. // New caches will be created and the unlock returned,
  3057. // allowing direct access to the newly created
  3058. // empty data object. A valid owner object must be provided.
  3059. var cache = this.cache[ this.key( owner ) ];
  3060. return key === undefined ?
  3061. cache : cache[ key ];
  3062. },
  3063. access: function( owner, key, value ) {
  3064. var stored;
  3065. // In cases where either:
  3066. //
  3067. // 1. No key was specified
  3068. // 2. A string key was specified, but no value provided
  3069. //
  3070. // Take the "read" path and allow the get method to determine
  3071. // which value to return, respectively either:
  3072. //
  3073. // 1. The entire cache object
  3074. // 2. The data stored at the key
  3075. //
  3076. if ( key === undefined ||
  3077. ((key && typeof key === "string") && value === undefined) ) {
  3078. stored = this.get( owner, key );
  3079. return stored !== undefined ?
  3080. stored : this.get( owner, jQuery.camelCase(key) );
  3081. }
  3082. // [*]When the key is not a string, or both a key and value
  3083. // are specified, set or extend (existing objects) with either:
  3084. //
  3085. // 1. An object of properties
  3086. // 2. A key and value
  3087. //
  3088. this.set( owner, key, value );
  3089. // Since the "set" path can have two possible entry points
  3090. // return the expected data based on which path was taken[*]
  3091. return value !== undefined ? value : key;
  3092. },
  3093. remove: function( owner, key ) {
  3094. var i, name, camel,
  3095. unlock = this.key( owner ),
  3096. cache = this.cache[ unlock ];
  3097. if ( key === undefined ) {
  3098. this.cache[ unlock ] = {};
  3099. } else {
  3100. // Support array or space separated string of keys
  3101. if ( jQuery.isArray( key ) ) {
  3102. // If "name" is an array of keys...
  3103. // When data is initially created, via ("key", "val") signature,
  3104. // keys will be converted to camelCase.
  3105. // Since there is no way to tell _how_ a key was added, remove
  3106. // both plain key and camelCase key. #12786
  3107. // This will only penalize the array argument path.
  3108. name = key.concat( key.map( jQuery.camelCase ) );
  3109. } else {
  3110. camel = jQuery.camelCase( key );
  3111. // Try the string as a key before any manipulation
  3112. if ( key in cache ) {
  3113. name = [ key, camel ];
  3114. } else {
  3115. // If a key with the spaces exists, use it.
  3116. // Otherwise, create an array by matching non-whitespace
  3117. name = camel;
  3118. name = name in cache ?
  3119. [ name ] : ( name.match( rnotwhite ) || [] );
  3120. }
  3121. }
  3122. i = name.length;
  3123. while ( i-- ) {
  3124. delete cache[ name[ i ] ];
  3125. }
  3126. }
  3127. },
  3128. hasData: function( owner ) {
  3129. return !jQuery.isEmptyObject(
  3130. this.cache[ owner[ this.expando ] ] || {}
  3131. );
  3132. },
  3133. discard: function( owner ) {
  3134. if ( owner[ this.expando ] ) {
  3135. delete this.cache[ owner[ this.expando ] ];
  3136. }
  3137. }
  3138. };
  3139. var data_priv = new Data();
  3140. var data_user = new Data();
  3141. // Implementation Summary
  3142. //
  3143. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3144. // 2. Improve the module's maintainability by reducing the storage
  3145. // paths to a single mechanism.
  3146. // 3. Use the same single mechanism to support "private" and "user" data.
  3147. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3148. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3149. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3150. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3151. rmultiDash = /([A-Z])/g;
  3152. function dataAttr( elem, key, data ) {
  3153. var name;
  3154. // If nothing was found internally, try to fetch any
  3155. // data from the HTML5 data-* attribute
  3156. if ( data === undefined && elem.nodeType === 1 ) {
  3157. name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
  3158. data = elem.getAttribute( name );
  3159. if ( typeof data === "string" ) {
  3160. try {
  3161. data = data === "true" ? true :
  3162. data === "false" ? false :
  3163. data === "null" ? null :
  3164. // Only convert to a number if it doesn't change the string
  3165. +data + "" === data ? +data :
  3166. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  3167. data;
  3168. } catch( e ) {}
  3169. // Make sure we set the data so it isn't changed later
  3170. data_user.set( elem, key, data );
  3171. } else {
  3172. data = undefined;
  3173. }
  3174. }
  3175. return data;
  3176. }
  3177. jQuery.extend({
  3178. hasData: function( elem ) {
  3179. return data_user.hasData( elem ) || data_priv.hasData( elem );
  3180. },
  3181. data: function( elem, name, data ) {
  3182. return data_user.access( elem, name, data );
  3183. },
  3184. removeData: function( elem, name ) {
  3185. data_user.remove( elem, name );
  3186. },
  3187. // TODO: Now that all calls to _data and _removeData have been replaced
  3188. // with direct calls to data_priv methods, these can be deprecated.
  3189. _data: function( elem, name, data ) {
  3190. return data_priv.access( elem, name, data );
  3191. },
  3192. _removeData: function( elem, name ) {
  3193. data_priv.remove( elem, name );
  3194. }
  3195. });
  3196. jQuery.fn.extend({
  3197. data: function( key, value ) {
  3198. var i, name, data,
  3199. elem = this[ 0 ],
  3200. attrs = elem && elem.attributes;
  3201. // Gets all values
  3202. if ( key === undefined ) {
  3203. if ( this.length ) {
  3204. data = data_user.get( elem );
  3205. if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
  3206. i = attrs.length;
  3207. while ( i-- ) {
  3208. // Support: IE11+
  3209. // The attrs elements can be null (#14894)
  3210. if ( attrs[ i ] ) {
  3211. name = attrs[ i ].name;
  3212. if ( name.indexOf( "data-" ) === 0 ) {
  3213. name = jQuery.camelCase( name.slice(5) );
  3214. dataAttr( elem, name, data[ name ] );
  3215. }
  3216. }
  3217. }
  3218. data_priv.set( elem, "hasDataAttrs", true );
  3219. }
  3220. }
  3221. return data;
  3222. }
  3223. // Sets multiple values
  3224. if ( typeof key === "object" ) {
  3225. return this.each(function() {
  3226. data_user.set( this, key );
  3227. });
  3228. }
  3229. return access( this, function( value ) {
  3230. var data,
  3231. camelKey = jQuery.camelCase( key );
  3232. // The calling jQuery object (element matches) is not empty
  3233. // (and therefore has an element appears at this[ 0 ]) and the
  3234. // `value` parameter was not undefined. An empty jQuery object
  3235. // will result in `undefined` for elem = this[ 0 ] which will
  3236. // throw an exception if an attempt to read a data cache is made.
  3237. if ( elem && value === undefined ) {
  3238. // Attempt to get data from the cache
  3239. // with the key as-is
  3240. data = data_user.get( elem, key );
  3241. if ( data !== undefined ) {
  3242. return data;
  3243. }
  3244. // Attempt to get data from the cache
  3245. // with the key camelized
  3246. data = data_user.get( elem, camelKey );
  3247. if ( data !== undefined ) {
  3248. return data;
  3249. }
  3250. // Attempt to "discover" the data in
  3251. // HTML5 custom data-* attrs
  3252. data = dataAttr( elem, camelKey, undefined );
  3253. if ( data !== undefined ) {
  3254. return data;
  3255. }
  3256. // We tried really hard, but the data doesn't exist.
  3257. return;
  3258. }
  3259. // Set the data...
  3260. this.each(function() {
  3261. // First, attempt to store a copy or reference of any
  3262. // data that might've been store with a camelCased key.
  3263. var data = data_user.get( this, camelKey );
  3264. // For HTML5 data-* attribute interop, we have to
  3265. // store property names with dashes in a camelCase form.
  3266. // This might not apply to all properties...*
  3267. data_user.set( this, camelKey, value );
  3268. // *... In the case of properties that might _actually_
  3269. // have dashes, we need to also store a copy of that
  3270. // unchanged property.
  3271. if ( key.indexOf("-") !== -1 && data !== undefined ) {
  3272. data_user.set( this, key, value );
  3273. }
  3274. });
  3275. }, null, value, arguments.length > 1, null, true );
  3276. },
  3277. removeData: function( key ) {
  3278. return this.each(function() {
  3279. data_user.remove( this, key );
  3280. });
  3281. }
  3282. });
  3283. jQuery.extend({
  3284. queue: function( elem, type, data ) {
  3285. var queue;
  3286. if ( elem ) {
  3287. type = ( type || "fx" ) + "queue";
  3288. queue = data_priv.get( elem, type );
  3289. // Speed up dequeue by getting out quickly if this is just a lookup
  3290. if ( data ) {
  3291. if ( !queue || jQuery.isArray( data ) ) {
  3292. queue = data_priv.access( elem, type, jQuery.makeArray(data) );
  3293. } else {
  3294. queue.push( data );
  3295. }
  3296. }
  3297. return queue || [];
  3298. }
  3299. },
  3300. dequeue: function( elem, type ) {
  3301. type = type || "fx";
  3302. var queue = jQuery.queue( elem, type ),
  3303. startLength = queue.length,
  3304. fn = queue.shift(),
  3305. hooks = jQuery._queueHooks( elem, type ),
  3306. next = function() {
  3307. jQuery.dequeue( elem, type );
  3308. };
  3309. // If the fx queue is dequeued, always remove the progress sentinel
  3310. if ( fn === "inprogress" ) {
  3311. fn = queue.shift();
  3312. startLength--;
  3313. }
  3314. if ( fn ) {
  3315. // Add a progress sentinel to prevent the fx queue from being
  3316. // automatically dequeued
  3317. if ( type === "fx" ) {
  3318. queue.unshift( "inprogress" );
  3319. }
  3320. // Clear up the last queue stop function
  3321. delete hooks.stop;
  3322. fn.call( elem, next, hooks );
  3323. }
  3324. if ( !startLength && hooks ) {
  3325. hooks.empty.fire();
  3326. }
  3327. },
  3328. // Not public - generate a queueHooks object, or return the current one
  3329. _queueHooks: function( elem, type ) {
  3330. var key = type + "queueHooks";
  3331. return data_priv.get( elem, key ) || data_priv.access( elem, key, {
  3332. empty: jQuery.Callbacks("once memory").add(function() {
  3333. data_priv.remove( elem, [ type + "queue", key ] );
  3334. })
  3335. });
  3336. }
  3337. });
  3338. jQuery.fn.extend({
  3339. queue: function( type, data ) {
  3340. var setter = 2;
  3341. if ( typeof type !== "string" ) {
  3342. data = type;
  3343. type = "fx";
  3344. setter--;
  3345. }
  3346. if ( arguments.length < setter ) {
  3347. return jQuery.queue( this[0], type );
  3348. }
  3349. return data === undefined ?
  3350. this :
  3351. this.each(function() {
  3352. var queue = jQuery.queue( this, type, data );
  3353. // Ensure a hooks for this queue
  3354. jQuery._queueHooks( this, type );
  3355. if ( type === "fx" && queue[0] !== "inprogress" ) {
  3356. jQuery.dequeue( this, type );
  3357. }
  3358. });
  3359. },
  3360. dequeue: function( type ) {
  3361. return this.each(function() {
  3362. jQuery.dequeue( this, type );
  3363. });
  3364. },
  3365. clearQueue: function( type ) {
  3366. return this.queue( type || "fx", [] );
  3367. },
  3368. // Get a promise resolved when queues of a certain type
  3369. // are emptied (fx is the type by default)
  3370. promise: function( type, obj ) {
  3371. var tmp,
  3372. count = 1,
  3373. defer = jQuery.Deferred(),
  3374. elements = this,
  3375. i = this.length,
  3376. resolve = function() {
  3377. if ( !( --count ) ) {
  3378. defer.resolveWith( elements, [ elements ] );
  3379. }
  3380. };
  3381. if ( typeof type !== "string" ) {
  3382. obj = type;
  3383. type = undefined;
  3384. }
  3385. type = type || "fx";
  3386. while ( i-- ) {
  3387. tmp = data_priv.get( elements[ i ], type + "queueHooks" );
  3388. if ( tmp && tmp.empty ) {
  3389. count++;
  3390. tmp.empty.add( resolve );
  3391. }
  3392. }
  3393. resolve();
  3394. return defer.promise( obj );
  3395. }
  3396. });
  3397. var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
  3398. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3399. var isHidden = function( elem, el ) {
  3400. // isHidden might be called from jQuery#filter function;
  3401. // in that case, element will be second argument
  3402. elem = el || elem;
  3403. return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
  3404. };
  3405. var rcheckableType = (/^(?:checkbox|radio)$/i);
  3406. (function() {
  3407. var fragment = document.createDocumentFragment(),
  3408. div = fragment.appendChild( document.createElement( "div" ) ),
  3409. input = document.createElement( "input" );
  3410. // Support: Safari<=5.1
  3411. // Check state lost if the name is set (#11217)
  3412. // Support: Windows Web Apps (WWA)
  3413. // `name` and `type` must use .setAttribute for WWA (#14901)
  3414. input.setAttribute( "type", "radio" );
  3415. input.setAttribute( "checked", "checked" );
  3416. input.setAttribute( "name", "t" );
  3417. div.appendChild( input );
  3418. // Support: Safari<=5.1, Android<4.2
  3419. // Older WebKit doesn't clone checked state correctly in fragments
  3420. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3421. // Support: IE<=11+
  3422. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3423. div.innerHTML = "<textarea>x</textarea>";
  3424. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3425. })();
  3426. var strundefined = typeof undefined;
  3427. support.focusinBubbles = "onfocusin" in window;
  3428. var
  3429. rkeyEvent = /^key/,
  3430. rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
  3431. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  3432. rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
  3433. function returnTrue() {
  3434. return true;
  3435. }
  3436. function returnFalse() {
  3437. return false;
  3438. }
  3439. function safeActiveElement() {
  3440. try {
  3441. return document.activeElement;
  3442. } catch ( err ) { }
  3443. }
  3444. /*
  3445. * Helper functions for managing events -- not part of the public interface.
  3446. * Props to Dean Edwards' addEvent library for many of the ideas.
  3447. */
  3448. jQuery.event = {
  3449. global: {},
  3450. add: function( elem, types, handler, data, selector ) {
  3451. var handleObjIn, eventHandle, tmp,
  3452. events, t, handleObj,
  3453. special, handlers, type, namespaces, origType,
  3454. elemData = data_priv.get( elem );
  3455. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  3456. if ( !elemData ) {
  3457. return;
  3458. }
  3459. // Caller can pass in an object of custom data in lieu of the handler
  3460. if ( handler.handler ) {
  3461. handleObjIn = handler;
  3462. handler = handleObjIn.handler;
  3463. selector = handleObjIn.selector;
  3464. }
  3465. // Make sure that the handler has a unique ID, used to find/remove it later
  3466. if ( !handler.guid ) {
  3467. handler.guid = jQuery.guid++;
  3468. }
  3469. // Init the element's event structure and main handler, if this is the first
  3470. if ( !(events = elemData.events) ) {
  3471. events = elemData.events = {};
  3472. }
  3473. if ( !(eventHandle = elemData.handle) ) {
  3474. eventHandle = elemData.handle = function( e ) {
  3475. // Discard the second event of a jQuery.event.trigger() and
  3476. // when an event is called after a page has unloaded
  3477. return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
  3478. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  3479. };
  3480. }
  3481. // Handle multiple events separated by a space
  3482. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3483. t = types.length;
  3484. while ( t-- ) {
  3485. tmp = rtypenamespace.exec( types[t] ) || [];
  3486. type = origType = tmp[1];
  3487. namespaces = ( tmp[2] || "" ).split( "." ).sort();
  3488. // There *must* be a type, no attaching namespace-only handlers
  3489. if ( !type ) {
  3490. continue;
  3491. }
  3492. // If event changes its type, use the special event handlers for the changed type
  3493. special = jQuery.event.special[ type ] || {};
  3494. // If selector defined, determine special event api type, otherwise given type
  3495. type = ( selector ? special.delegateType : special.bindType ) || type;
  3496. // Update special based on newly reset type
  3497. special = jQuery.event.special[ type ] || {};
  3498. // handleObj is passed to all event handlers
  3499. handleObj = jQuery.extend({
  3500. type: type,
  3501. origType: origType,
  3502. data: data,
  3503. handler: handler,
  3504. guid: handler.guid,
  3505. selector: selector,
  3506. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  3507. namespace: namespaces.join(".")
  3508. }, handleObjIn );
  3509. // Init the event handler queue if we're the first
  3510. if ( !(handlers = events[ type ]) ) {
  3511. handlers = events[ type ] = [];
  3512. handlers.delegateCount = 0;
  3513. // Only use addEventListener if the special events handler returns false
  3514. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  3515. if ( elem.addEventListener ) {
  3516. elem.addEventListener( type, eventHandle, false );
  3517. }
  3518. }
  3519. }
  3520. if ( special.add ) {
  3521. special.add.call( elem, handleObj );
  3522. if ( !handleObj.handler.guid ) {
  3523. handleObj.handler.guid = handler.guid;
  3524. }
  3525. }
  3526. // Add to the element's handler list, delegates in front
  3527. if ( selector ) {
  3528. handlers.splice( handlers.delegateCount++, 0, handleObj );
  3529. } else {
  3530. handlers.push( handleObj );
  3531. }
  3532. // Keep track of which events have ever been used, for event optimization
  3533. jQuery.event.global[ type ] = true;
  3534. }
  3535. },
  3536. // Detach an event or set of events from an element
  3537. remove: function( elem, types, handler, selector, mappedTypes ) {
  3538. var j, origCount, tmp,
  3539. events, t, handleObj,
  3540. special, handlers, type, namespaces, origType,
  3541. elemData = data_priv.hasData( elem ) && data_priv.get( elem );
  3542. if ( !elemData || !(events = elemData.events) ) {
  3543. return;
  3544. }
  3545. // Once for each type.namespace in types; type may be omitted
  3546. types = ( types || "" ).match( rnotwhite ) || [ "" ];
  3547. t = types.length;
  3548. while ( t-- ) {
  3549. tmp = rtypenamespace.exec( types[t] ) || [];
  3550. type = origType = tmp[1];
  3551. namespaces = ( tmp[2] || "" ).split( "." ).sort();
  3552. // Unbind all events (on this namespace, if provided) for the element
  3553. if ( !type ) {
  3554. for ( type in events ) {
  3555. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  3556. }
  3557. continue;
  3558. }
  3559. special = jQuery.event.special[ type ] || {};
  3560. type = ( selector ? special.delegateType : special.bindType ) || type;
  3561. handlers = events[ type ] || [];
  3562. tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
  3563. // Remove matching events
  3564. origCount = j = handlers.length;
  3565. while ( j-- ) {
  3566. handleObj = handlers[ j ];
  3567. if ( ( mappedTypes || origType === handleObj.origType ) &&
  3568. ( !handler || handler.guid === handleObj.guid ) &&
  3569. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  3570. ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
  3571. handlers.splice( j, 1 );
  3572. if ( handleObj.selector ) {
  3573. handlers.delegateCount--;
  3574. }
  3575. if ( special.remove ) {
  3576. special.remove.call( elem, handleObj );
  3577. }
  3578. }
  3579. }
  3580. // Remove generic event handler if we removed something and no more handlers exist
  3581. // (avoids potential for endless recursion during removal of special event handlers)
  3582. if ( origCount && !handlers.length ) {
  3583. if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  3584. jQuery.removeEvent( elem, type, elemData.handle );
  3585. }
  3586. delete events[ type ];
  3587. }
  3588. }
  3589. // Remove the expando if it's no longer used
  3590. if ( jQuery.isEmptyObject( events ) ) {
  3591. delete elemData.handle;
  3592. data_priv.remove( elem, "events" );
  3593. }
  3594. },
  3595. trigger: function( event, data, elem, onlyHandlers ) {
  3596. var i, cur, tmp, bubbleType, ontype, handle, special,
  3597. eventPath = [ elem || document ],
  3598. type = hasOwn.call( event, "type" ) ? event.type : event,
  3599. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
  3600. cur = tmp = elem = elem || document;
  3601. // Don't do events on text and comment nodes
  3602. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  3603. return;
  3604. }
  3605. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  3606. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  3607. return;
  3608. }
  3609. if ( type.indexOf(".") >= 0 ) {
  3610. // Namespaced trigger; create a regexp to match event type in handle()
  3611. namespaces = type.split(".");
  3612. type = namespaces.shift();
  3613. namespaces.sort();
  3614. }
  3615. ontype = type.indexOf(":") < 0 && "on" + type;
  3616. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  3617. event = event[ jQuery.expando ] ?
  3618. event :
  3619. new jQuery.Event( type, typeof event === "object" && event );
  3620. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  3621. event.isTrigger = onlyHandlers ? 2 : 3;
  3622. event.namespace = namespaces.join(".");
  3623. event.namespace_re = event.namespace ?
  3624. new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
  3625. null;
  3626. // Clean up the event in case it is being reused
  3627. event.result = undefined;
  3628. if ( !event.target ) {
  3629. event.target = elem;
  3630. }
  3631. // Clone any incoming data and prepend the event, creating the handler arg list
  3632. data = data == null ?
  3633. [ event ] :
  3634. jQuery.makeArray( data, [ event ] );
  3635. // Allow special events to draw outside the lines
  3636. special = jQuery.event.special[ type ] || {};
  3637. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  3638. return;
  3639. }
  3640. // Determine event propagation path in advance, per W3C events spec (#9951)
  3641. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  3642. if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
  3643. bubbleType = special.delegateType || type;
  3644. if ( !rfocusMorph.test( bubbleType + type ) ) {
  3645. cur = cur.parentNode;
  3646. }
  3647. for ( ; cur; cur = cur.parentNode ) {
  3648. eventPath.push( cur );
  3649. tmp = cur;
  3650. }
  3651. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  3652. if ( tmp === (elem.ownerDocument || document) ) {
  3653. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  3654. }
  3655. }
  3656. // Fire handlers on the event path
  3657. i = 0;
  3658. while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
  3659. event.type = i > 1 ?
  3660. bubbleType :
  3661. special.bindType || type;
  3662. // jQuery handler
  3663. handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
  3664. if ( handle ) {
  3665. handle.apply( cur, data );
  3666. }
  3667. // Native handler
  3668. handle = ontype && cur[ ontype ];
  3669. if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
  3670. event.result = handle.apply( cur, data );
  3671. if ( event.result === false ) {
  3672. event.preventDefault();
  3673. }
  3674. }
  3675. }
  3676. event.type = type;
  3677. // If nobody prevented the default action, do it now
  3678. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  3679. if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
  3680. jQuery.acceptData( elem ) ) {
  3681. // Call a native DOM method on the target with the same name name as the event.
  3682. // Don't do default actions on window, that's where global variables be (#6170)
  3683. if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
  3684. // Don't re-trigger an onFOO event when we call its FOO() method
  3685. tmp = elem[ ontype ];
  3686. if ( tmp ) {
  3687. elem[ ontype ] = null;
  3688. }
  3689. // Prevent re-triggering of the same event, since we already bubbled it above
  3690. jQuery.event.triggered = type;
  3691. elem[ type ]();
  3692. jQuery.event.triggered = undefined;
  3693. if ( tmp ) {
  3694. elem[ ontype ] = tmp;
  3695. }
  3696. }
  3697. }
  3698. }
  3699. return event.result;
  3700. },
  3701. dispatch: function( event ) {
  3702. // Make a writable jQuery.Event from the native event object
  3703. event = jQuery.event.fix( event );
  3704. var i, j, ret, matched, handleObj,
  3705. handlerQueue = [],
  3706. args = slice.call( arguments ),
  3707. handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
  3708. special = jQuery.event.special[ event.type ] || {};
  3709. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  3710. args[0] = event;
  3711. event.delegateTarget = this;
  3712. // Call the preDispatch hook for the mapped type, and let it bail if desired
  3713. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  3714. return;
  3715. }
  3716. // Determine handlers
  3717. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  3718. // Run delegates first; they may want to stop propagation beneath us
  3719. i = 0;
  3720. while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
  3721. event.currentTarget = matched.elem;
  3722. j = 0;
  3723. while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
  3724. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  3725. // a subset or equal to those in the bound event (both can have no namespace).
  3726. if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
  3727. event.handleObj = handleObj;
  3728. event.data = handleObj.data;
  3729. ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
  3730. .apply( matched.elem, args );
  3731. if ( ret !== undefined ) {
  3732. if ( (event.result = ret) === false ) {
  3733. event.preventDefault();
  3734. event.stopPropagation();
  3735. }
  3736. }
  3737. }
  3738. }
  3739. }
  3740. // Call the postDispatch hook for the mapped type
  3741. if ( special.postDispatch ) {
  3742. special.postDispatch.call( this, event );
  3743. }
  3744. return event.result;
  3745. },
  3746. handlers: function( event, handlers ) {
  3747. var i, matches, sel, handleObj,
  3748. handlerQueue = [],
  3749. delegateCount = handlers.delegateCount,
  3750. cur = event.target;
  3751. // Find delegate handlers
  3752. // Black-hole SVG <use> instance trees (#13180)
  3753. // Avoid non-left-click bubbling in Firefox (#3861)
  3754. if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
  3755. for ( ; cur !== this; cur = cur.parentNode || this ) {
  3756. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  3757. if ( cur.disabled !== true || event.type !== "click" ) {
  3758. matches = [];
  3759. for ( i = 0; i < delegateCount; i++ ) {
  3760. handleObj = handlers[ i ];
  3761. // Don't conflict with Object.prototype properties (#13203)
  3762. sel = handleObj.selector + " ";
  3763. if ( matches[ sel ] === undefined ) {
  3764. matches[ sel ] = handleObj.needsContext ?
  3765. jQuery( sel, this ).index( cur ) >= 0 :
  3766. jQuery.find( sel, this, null, [ cur ] ).length;
  3767. }
  3768. if ( matches[ sel ] ) {
  3769. matches.push( handleObj );
  3770. }
  3771. }
  3772. if ( matches.length ) {
  3773. handlerQueue.push({ elem: cur, handlers: matches });
  3774. }
  3775. }
  3776. }
  3777. }
  3778. // Add the remaining (directly-bound) handlers
  3779. if ( delegateCount < handlers.length ) {
  3780. handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
  3781. }
  3782. return handlerQueue;
  3783. },
  3784. // Includes some event props shared by KeyEvent and MouseEvent
  3785. props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
  3786. fixHooks: {},
  3787. keyHooks: {
  3788. props: "char charCode key keyCode".split(" "),
  3789. filter: function( event, original ) {
  3790. // Add which for key events
  3791. if ( event.which == null ) {
  3792. event.which = original.charCode != null ? original.charCode : original.keyCode;
  3793. }
  3794. return event;
  3795. }
  3796. },
  3797. mouseHooks: {
  3798. props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
  3799. filter: function( event, original ) {
  3800. var eventDoc, doc, body,
  3801. button = original.button;
  3802. // Calculate pageX/Y if missing and clientX/Y available
  3803. if ( event.pageX == null && original.clientX != null ) {
  3804. eventDoc = event.target.ownerDocument || document;
  3805. doc = eventDoc.documentElement;
  3806. body = eventDoc.body;
  3807. event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
  3808. event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
  3809. }
  3810. // Add which for click: 1 === left; 2 === middle; 3 === right
  3811. // Note: button is not normalized, so don't use it
  3812. if ( !event.which && button !== undefined ) {
  3813. event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
  3814. }
  3815. return event;
  3816. }
  3817. },
  3818. fix: function( event ) {
  3819. if ( event[ jQuery.expando ] ) {
  3820. return event;
  3821. }
  3822. // Create a writable copy of the event object and normalize some properties
  3823. var i, prop, copy,
  3824. type = event.type,
  3825. originalEvent = event,
  3826. fixHook = this.fixHooks[ type ];
  3827. if ( !fixHook ) {
  3828. this.fixHooks[ type ] = fixHook =
  3829. rmouseEvent.test( type ) ? this.mouseHooks :
  3830. rkeyEvent.test( type ) ? this.keyHooks :
  3831. {};
  3832. }
  3833. copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
  3834. event = new jQuery.Event( originalEvent );
  3835. i = copy.length;
  3836. while ( i-- ) {
  3837. prop = copy[ i ];
  3838. event[ prop ] = originalEvent[ prop ];
  3839. }
  3840. // Support: Cordova 2.5 (WebKit) (#13255)
  3841. // All events should have a target; Cordova deviceready doesn't
  3842. if ( !event.target ) {
  3843. event.target = document;
  3844. }
  3845. // Support: Safari 6.0+, Chrome<28
  3846. // Target should not be a text node (#504, #13143)
  3847. if ( event.target.nodeType === 3 ) {
  3848. event.target = event.target.parentNode;
  3849. }
  3850. return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
  3851. },
  3852. special: {
  3853. load: {
  3854. // Prevent triggered image.load events from bubbling to window.load
  3855. noBubble: true
  3856. },
  3857. focus: {
  3858. // Fire native event if possible so blur/focus sequence is correct
  3859. trigger: function() {
  3860. if ( this !== safeActiveElement() && this.focus ) {
  3861. this.focus();
  3862. return false;
  3863. }
  3864. },
  3865. delegateType: "focusin"
  3866. },
  3867. blur: {
  3868. trigger: function() {
  3869. if ( this === safeActiveElement() && this.blur ) {
  3870. this.blur();
  3871. return false;
  3872. }
  3873. },
  3874. delegateType: "focusout"
  3875. },
  3876. click: {
  3877. // For checkbox, fire native event so checked state will be right
  3878. trigger: function() {
  3879. if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
  3880. this.click();
  3881. return false;
  3882. }
  3883. },
  3884. // For cross-browser consistency, don't fire native .click() on links
  3885. _default: function( event ) {
  3886. return jQuery.nodeName( event.target, "a" );
  3887. }
  3888. },
  3889. beforeunload: {
  3890. postDispatch: function( event ) {
  3891. // Support: Firefox 20+
  3892. // Firefox doesn't alert if the returnValue field is not set.
  3893. if ( event.result !== undefined && event.originalEvent ) {
  3894. event.originalEvent.returnValue = event.result;
  3895. }
  3896. }
  3897. }
  3898. },
  3899. simulate: function( type, elem, event, bubble ) {
  3900. // Piggyback on a donor event to simulate a different one.
  3901. // Fake originalEvent to avoid donor's stopPropagation, but if the
  3902. // simulated event prevents default then we do the same on the donor.
  3903. var e = jQuery.extend(
  3904. new jQuery.Event(),
  3905. event,
  3906. {
  3907. type: type,
  3908. isSimulated: true,
  3909. originalEvent: {}
  3910. }
  3911. );
  3912. if ( bubble ) {
  3913. jQuery.event.trigger( e, null, elem );
  3914. } else {
  3915. jQuery.event.dispatch.call( elem, e );
  3916. }
  3917. if ( e.isDefaultPrevented() ) {
  3918. event.preventDefault();
  3919. }
  3920. }
  3921. };
  3922. jQuery.removeEvent = function( elem, type, handle ) {
  3923. if ( elem.removeEventListener ) {
  3924. elem.removeEventListener( type, handle, false );
  3925. }
  3926. };
  3927. jQuery.Event = function( src, props ) {
  3928. // Allow instantiation without the 'new' keyword
  3929. if ( !(this instanceof jQuery.Event) ) {
  3930. return new jQuery.Event( src, props );
  3931. }
  3932. // Event object
  3933. if ( src && src.type ) {
  3934. this.originalEvent = src;
  3935. this.type = src.type;
  3936. // Events bubbling up the document may have been marked as prevented
  3937. // by a handler lower down the tree; reflect the correct value.
  3938. this.isDefaultPrevented = src.defaultPrevented ||
  3939. src.defaultPrevented === undefined &&
  3940. // Support: Android<4.0
  3941. src.returnValue === false ?
  3942. returnTrue :
  3943. returnFalse;
  3944. // Event type
  3945. } else {
  3946. this.type = src;
  3947. }
  3948. // Put explicitly provided properties onto the event object
  3949. if ( props ) {
  3950. jQuery.extend( this, props );
  3951. }
  3952. // Create a timestamp if incoming event doesn't have one
  3953. this.timeStamp = src && src.timeStamp || jQuery.now();
  3954. // Mark it as fixed
  3955. this[ jQuery.expando ] = true;
  3956. };
  3957. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  3958. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  3959. jQuery.Event.prototype = {
  3960. isDefaultPrevented: returnFalse,
  3961. isPropagationStopped: returnFalse,
  3962. isImmediatePropagationStopped: returnFalse,
  3963. preventDefault: function() {
  3964. var e = this.originalEvent;
  3965. this.isDefaultPrevented = returnTrue;
  3966. if ( e && e.preventDefault ) {
  3967. e.preventDefault();
  3968. }
  3969. },
  3970. stopPropagation: function() {
  3971. var e = this.originalEvent;
  3972. this.isPropagationStopped = returnTrue;
  3973. if ( e && e.stopPropagation ) {
  3974. e.stopPropagation();
  3975. }
  3976. },
  3977. stopImmediatePropagation: function() {
  3978. var e = this.originalEvent;
  3979. this.isImmediatePropagationStopped = returnTrue;
  3980. if ( e && e.stopImmediatePropagation ) {
  3981. e.stopImmediatePropagation();
  3982. }
  3983. this.stopPropagation();
  3984. }
  3985. };
  3986. // Create mouseenter/leave events using mouseover/out and event-time checks
  3987. // Support: Chrome 15+
  3988. jQuery.each({
  3989. mouseenter: "mouseover",
  3990. mouseleave: "mouseout",
  3991. pointerenter: "pointerover",
  3992. pointerleave: "pointerout"
  3993. }, function( orig, fix ) {
  3994. jQuery.event.special[ orig ] = {
  3995. delegateType: fix,
  3996. bindType: fix,
  3997. handle: function( event ) {
  3998. var ret,
  3999. target = this,
  4000. related = event.relatedTarget,
  4001. handleObj = event.handleObj;
  4002. // For mousenter/leave call the handler if related is outside the target.
  4003. // NB: No relatedTarget if the mouse left/entered the browser window
  4004. if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
  4005. event.type = handleObj.origType;
  4006. ret = handleObj.handler.apply( this, arguments );
  4007. event.type = fix;
  4008. }
  4009. return ret;
  4010. }
  4011. };
  4012. });
  4013. // Support: Firefox, Chrome, Safari
  4014. // Create "bubbling" focus and blur events
  4015. if ( !support.focusinBubbles ) {
  4016. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  4017. // Attach a single capturing handler on the document while someone wants focusin/focusout
  4018. var handler = function( event ) {
  4019. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
  4020. };
  4021. jQuery.event.special[ fix ] = {
  4022. setup: function() {
  4023. var doc = this.ownerDocument || this,
  4024. attaches = data_priv.access( doc, fix );
  4025. if ( !attaches ) {
  4026. doc.addEventListener( orig, handler, true );
  4027. }
  4028. data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
  4029. },
  4030. teardown: function() {
  4031. var doc = this.ownerDocument || this,
  4032. attaches = data_priv.access( doc, fix ) - 1;
  4033. if ( !attaches ) {
  4034. doc.removeEventListener( orig, handler, true );
  4035. data_priv.remove( doc, fix );
  4036. } else {
  4037. data_priv.access( doc, fix, attaches );
  4038. }
  4039. }
  4040. };
  4041. });
  4042. }
  4043. jQuery.fn.extend({
  4044. on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
  4045. var origFn, type;
  4046. // Types can be a map of types/handlers
  4047. if ( typeof types === "object" ) {
  4048. // ( types-Object, selector, data )
  4049. if ( typeof selector !== "string" ) {
  4050. // ( types-Object, data )
  4051. data = data || selector;
  4052. selector = undefined;
  4053. }
  4054. for ( type in types ) {
  4055. this.on( type, selector, data, types[ type ], one );
  4056. }
  4057. return this;
  4058. }
  4059. if ( data == null && fn == null ) {
  4060. // ( types, fn )
  4061. fn = selector;
  4062. data = selector = undefined;
  4063. } else if ( fn == null ) {
  4064. if ( typeof selector === "string" ) {
  4065. // ( types, selector, fn )
  4066. fn = data;
  4067. data = undefined;
  4068. } else {
  4069. // ( types, data, fn )
  4070. fn = data;
  4071. data = selector;
  4072. selector = undefined;
  4073. }
  4074. }
  4075. if ( fn === false ) {
  4076. fn = returnFalse;
  4077. } else if ( !fn ) {
  4078. return this;
  4079. }
  4080. if ( one === 1 ) {
  4081. origFn = fn;
  4082. fn = function( event ) {
  4083. // Can use an empty set, since event contains the info
  4084. jQuery().off( event );
  4085. return origFn.apply( this, arguments );
  4086. };
  4087. // Use same guid so caller can remove using origFn
  4088. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4089. }
  4090. return this.each( function() {
  4091. jQuery.event.add( this, types, fn, data, selector );
  4092. });
  4093. },
  4094. one: function( types, selector, data, fn ) {
  4095. return this.on( types, selector, data, fn, 1 );
  4096. },
  4097. off: function( types, selector, fn ) {
  4098. var handleObj, type;
  4099. if ( types && types.preventDefault && types.handleObj ) {
  4100. // ( event ) dispatched jQuery.Event
  4101. handleObj = types.handleObj;
  4102. jQuery( types.delegateTarget ).off(
  4103. handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
  4104. handleObj.selector,
  4105. handleObj.handler
  4106. );
  4107. return this;
  4108. }
  4109. if ( typeof types === "object" ) {
  4110. // ( types-object [, selector] )
  4111. for ( type in types ) {
  4112. this.off( type, selector, types[ type ] );
  4113. }
  4114. return this;
  4115. }
  4116. if ( selector === false || typeof selector === "function" ) {
  4117. // ( types [, fn] )
  4118. fn = selector;
  4119. selector = undefined;
  4120. }
  4121. if ( fn === false ) {
  4122. fn = returnFalse;
  4123. }
  4124. return this.each(function() {
  4125. jQuery.event.remove( this, types, fn, selector );
  4126. });
  4127. },
  4128. trigger: function( type, data ) {
  4129. return this.each(function() {
  4130. jQuery.event.trigger( type, data, this );
  4131. });
  4132. },
  4133. triggerHandler: function( type, data ) {
  4134. var elem = this[0];
  4135. if ( elem ) {
  4136. return jQuery.event.trigger( type, data, elem, true );
  4137. }
  4138. }
  4139. });
  4140. var
  4141. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
  4142. rtagName = /<([\w:]+)/,
  4143. rhtml = /<|&#?\w+;/,
  4144. rnoInnerhtml = /<(?:script|style|link)/i,
  4145. // checked="checked" or checked
  4146. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4147. rscriptType = /^$|\/(?:java|ecma)script/i,
  4148. rscriptTypeMasked = /^true\/(.*)/,
  4149. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  4150. // We have to close these tags to support XHTML (#13200)
  4151. wrapMap = {
  4152. // Support: IE9
  4153. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  4154. thead: [ 1, "<table>", "</table>" ],
  4155. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4156. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4157. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4158. _default: [ 0, "", "" ]
  4159. };
  4160. // Support: IE9
  4161. wrapMap.optgroup = wrapMap.option;
  4162. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4163. wrapMap.th = wrapMap.td;
  4164. // Support: 1.x compatibility
  4165. // Manipulating tables requires a tbody
  4166. function manipulationTarget( elem, content ) {
  4167. return jQuery.nodeName( elem, "table" ) &&
  4168. jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
  4169. elem.getElementsByTagName("tbody")[0] ||
  4170. elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
  4171. elem;
  4172. }
  4173. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4174. function disableScript( elem ) {
  4175. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  4176. return elem;
  4177. }
  4178. function restoreScript( elem ) {
  4179. var match = rscriptTypeMasked.exec( elem.type );
  4180. if ( match ) {
  4181. elem.type = match[ 1 ];
  4182. } else {
  4183. elem.removeAttribute("type");
  4184. }
  4185. return elem;
  4186. }
  4187. // Mark scripts as having already been evaluated
  4188. function setGlobalEval( elems, refElements ) {
  4189. var i = 0,
  4190. l = elems.length;
  4191. for ( ; i < l; i++ ) {
  4192. data_priv.set(
  4193. elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
  4194. );
  4195. }
  4196. }
  4197. function cloneCopyEvent( src, dest ) {
  4198. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4199. if ( dest.nodeType !== 1 ) {
  4200. return;
  4201. }
  4202. // 1. Copy private data: events, handlers, etc.
  4203. if ( data_priv.hasData( src ) ) {
  4204. pdataOld = data_priv.access( src );
  4205. pdataCur = data_priv.set( dest, pdataOld );
  4206. events = pdataOld.events;
  4207. if ( events ) {
  4208. delete pdataCur.handle;
  4209. pdataCur.events = {};
  4210. for ( type in events ) {
  4211. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4212. jQuery.event.add( dest, type, events[ type ][ i ] );
  4213. }
  4214. }
  4215. }
  4216. }
  4217. // 2. Copy user data
  4218. if ( data_user.hasData( src ) ) {
  4219. udataOld = data_user.access( src );
  4220. udataCur = jQuery.extend( {}, udataOld );
  4221. data_user.set( dest, udataCur );
  4222. }
  4223. }
  4224. function getAll( context, tag ) {
  4225. var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
  4226. context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
  4227. [];
  4228. return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
  4229. jQuery.merge( [ context ], ret ) :
  4230. ret;
  4231. }
  4232. // Fix IE bugs, see support tests
  4233. function fixInput( src, dest ) {
  4234. var nodeName = dest.nodeName.toLowerCase();
  4235. // Fails to persist the checked state of a cloned checkbox or radio button.
  4236. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4237. dest.checked = src.checked;
  4238. // Fails to return the selected option to the default selected state when cloning options
  4239. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4240. dest.defaultValue = src.defaultValue;
  4241. }
  4242. }
  4243. jQuery.extend({
  4244. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4245. var i, l, srcElements, destElements,
  4246. clone = elem.cloneNode( true ),
  4247. inPage = jQuery.contains( elem.ownerDocument, elem );
  4248. // Fix IE cloning issues
  4249. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4250. !jQuery.isXMLDoc( elem ) ) {
  4251. // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
  4252. destElements = getAll( clone );
  4253. srcElements = getAll( elem );
  4254. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4255. fixInput( srcElements[ i ], destElements[ i ] );
  4256. }
  4257. }
  4258. // Copy the events from the original to the clone
  4259. if ( dataAndEvents ) {
  4260. if ( deepDataAndEvents ) {
  4261. srcElements = srcElements || getAll( elem );
  4262. destElements = destElements || getAll( clone );
  4263. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4264. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4265. }
  4266. } else {
  4267. cloneCopyEvent( elem, clone );
  4268. }
  4269. }
  4270. // Preserve script evaluation history
  4271. destElements = getAll( clone, "script" );
  4272. if ( destElements.length > 0 ) {
  4273. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4274. }
  4275. // Return the cloned set
  4276. return clone;
  4277. },
  4278. buildFragment: function( elems, context, scripts, selection ) {
  4279. var elem, tmp, tag, wrap, contains, j,
  4280. fragment = context.createDocumentFragment(),
  4281. nodes = [],
  4282. i = 0,
  4283. l = elems.length;
  4284. for ( ; i < l; i++ ) {
  4285. elem = elems[ i ];
  4286. if ( elem || elem === 0 ) {
  4287. // Add nodes directly
  4288. if ( jQuery.type( elem ) === "object" ) {
  4289. // Support: QtWebKit, PhantomJS
  4290. // push.apply(_, arraylike) throws on ancient WebKit
  4291. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4292. // Convert non-html into a text node
  4293. } else if ( !rhtml.test( elem ) ) {
  4294. nodes.push( context.createTextNode( elem ) );
  4295. // Convert html into DOM nodes
  4296. } else {
  4297. tmp = tmp || fragment.appendChild( context.createElement("div") );
  4298. // Deserialize a standard representation
  4299. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4300. wrap = wrapMap[ tag ] || wrapMap._default;
  4301. tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
  4302. // Descend through wrappers to the right content
  4303. j = wrap[ 0 ];
  4304. while ( j-- ) {
  4305. tmp = tmp.lastChild;
  4306. }
  4307. // Support: QtWebKit, PhantomJS
  4308. // push.apply(_, arraylike) throws on ancient WebKit
  4309. jQuery.merge( nodes, tmp.childNodes );
  4310. // Remember the top-level container
  4311. tmp = fragment.firstChild;
  4312. // Ensure the created nodes are orphaned (#12392)
  4313. tmp.textContent = "";
  4314. }
  4315. }
  4316. }
  4317. // Remove wrapper from fragment
  4318. fragment.textContent = "";
  4319. i = 0;
  4320. while ( (elem = nodes[ i++ ]) ) {
  4321. // #4087 - If origin and destination elements are the same, and this is
  4322. // that element, do not do anything
  4323. if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
  4324. continue;
  4325. }
  4326. contains = jQuery.contains( elem.ownerDocument, elem );
  4327. // Append to fragment
  4328. tmp = getAll( fragment.appendChild( elem ), "script" );
  4329. // Preserve script evaluation history
  4330. if ( contains ) {
  4331. setGlobalEval( tmp );
  4332. }
  4333. // Capture executables
  4334. if ( scripts ) {
  4335. j = 0;
  4336. while ( (elem = tmp[ j++ ]) ) {
  4337. if ( rscriptType.test( elem.type || "" ) ) {
  4338. scripts.push( elem );
  4339. }
  4340. }
  4341. }
  4342. }
  4343. return fragment;
  4344. },
  4345. cleanData: function( elems ) {
  4346. var data, elem, type, key,
  4347. special = jQuery.event.special,
  4348. i = 0;
  4349. for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
  4350. if ( jQuery.acceptData( elem ) ) {
  4351. key = elem[ data_priv.expando ];
  4352. if ( key && (data = data_priv.cache[ key ]) ) {
  4353. if ( data.events ) {
  4354. for ( type in data.events ) {
  4355. if ( special[ type ] ) {
  4356. jQuery.event.remove( elem, type );
  4357. // This is a shortcut to avoid jQuery.event.remove's overhead
  4358. } else {
  4359. jQuery.removeEvent( elem, type, data.handle );
  4360. }
  4361. }
  4362. }
  4363. if ( data_priv.cache[ key ] ) {
  4364. // Discard any remaining `private` data
  4365. delete data_priv.cache[ key ];
  4366. }
  4367. }
  4368. }
  4369. // Discard any remaining `user` data
  4370. delete data_user.cache[ elem[ data_user.expando ] ];
  4371. }
  4372. }
  4373. });
  4374. jQuery.fn.extend({
  4375. text: function( value ) {
  4376. return access( this, function( value ) {
  4377. return value === undefined ?
  4378. jQuery.text( this ) :
  4379. this.empty().each(function() {
  4380. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4381. this.textContent = value;
  4382. }
  4383. });
  4384. }, null, value, arguments.length );
  4385. },
  4386. append: function() {
  4387. return this.domManip( arguments, function( elem ) {
  4388. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4389. var target = manipulationTarget( this, elem );
  4390. target.appendChild( elem );
  4391. }
  4392. });
  4393. },
  4394. prepend: function() {
  4395. return this.domManip( arguments, function( elem ) {
  4396. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4397. var target = manipulationTarget( this, elem );
  4398. target.insertBefore( elem, target.firstChild );
  4399. }
  4400. });
  4401. },
  4402. before: function() {
  4403. return this.domManip( arguments, function( elem ) {
  4404. if ( this.parentNode ) {
  4405. this.parentNode.insertBefore( elem, this );
  4406. }
  4407. });
  4408. },
  4409. after: function() {
  4410. return this.domManip( arguments, function( elem ) {
  4411. if ( this.parentNode ) {
  4412. this.parentNode.insertBefore( elem, this.nextSibling );
  4413. }
  4414. });
  4415. },
  4416. remove: function( selector, keepData /* Internal Use Only */ ) {
  4417. var elem,
  4418. elems = selector ? jQuery.filter( selector, this ) : this,
  4419. i = 0;
  4420. for ( ; (elem = elems[i]) != null; i++ ) {
  4421. if ( !keepData && elem.nodeType === 1 ) {
  4422. jQuery.cleanData( getAll( elem ) );
  4423. }
  4424. if ( elem.parentNode ) {
  4425. if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
  4426. setGlobalEval( getAll( elem, "script" ) );
  4427. }
  4428. elem.parentNode.removeChild( elem );
  4429. }
  4430. }
  4431. return this;
  4432. },
  4433. empty: function() {
  4434. var elem,
  4435. i = 0;
  4436. for ( ; (elem = this[i]) != null; i++ ) {
  4437. if ( elem.nodeType === 1 ) {
  4438. // Prevent memory leaks
  4439. jQuery.cleanData( getAll( elem, false ) );
  4440. // Remove any remaining nodes
  4441. elem.textContent = "";
  4442. }
  4443. }
  4444. return this;
  4445. },
  4446. clone: function( dataAndEvents, deepDataAndEvents ) {
  4447. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4448. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4449. return this.map(function() {
  4450. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4451. });
  4452. },
  4453. html: function( value ) {
  4454. return access( this, function( value ) {
  4455. var elem = this[ 0 ] || {},
  4456. i = 0,
  4457. l = this.length;
  4458. if ( value === undefined && elem.nodeType === 1 ) {
  4459. return elem.innerHTML;
  4460. }
  4461. // See if we can take a shortcut and just use innerHTML
  4462. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4463. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4464. value = value.replace( rxhtmlTag, "<$1></$2>" );
  4465. try {
  4466. for ( ; i < l; i++ ) {
  4467. elem = this[ i ] || {};
  4468. // Remove element nodes and prevent memory leaks
  4469. if ( elem.nodeType === 1 ) {
  4470. jQuery.cleanData( getAll( elem, false ) );
  4471. elem.innerHTML = value;
  4472. }
  4473. }
  4474. elem = 0;
  4475. // If using innerHTML throws an exception, use the fallback method
  4476. } catch( e ) {}
  4477. }
  4478. if ( elem ) {
  4479. this.empty().append( value );
  4480. }
  4481. }, null, value, arguments.length );
  4482. },
  4483. replaceWith: function() {
  4484. var arg = arguments[ 0 ];
  4485. // Make the changes, replacing each context element with the new content
  4486. this.domManip( arguments, function( elem ) {
  4487. arg = this.parentNode;
  4488. jQuery.cleanData( getAll( this ) );
  4489. if ( arg ) {
  4490. arg.replaceChild( elem, this );
  4491. }
  4492. });
  4493. // Force removal if there was no new content (e.g., from empty arguments)
  4494. return arg && (arg.length || arg.nodeType) ? this : this.remove();
  4495. },
  4496. detach: function( selector ) {
  4497. return this.remove( selector, true );
  4498. },
  4499. domManip: function( args, callback ) {
  4500. // Flatten any nested arrays
  4501. args = concat.apply( [], args );
  4502. var fragment, first, scripts, hasScripts, node, doc,
  4503. i = 0,
  4504. l = this.length,
  4505. set = this,
  4506. iNoClone = l - 1,
  4507. value = args[ 0 ],
  4508. isFunction = jQuery.isFunction( value );
  4509. // We can't cloneNode fragments that contain checked, in WebKit
  4510. if ( isFunction ||
  4511. ( l > 1 && typeof value === "string" &&
  4512. !support.checkClone && rchecked.test( value ) ) ) {
  4513. return this.each(function( index ) {
  4514. var self = set.eq( index );
  4515. if ( isFunction ) {
  4516. args[ 0 ] = value.call( this, index, self.html() );
  4517. }
  4518. self.domManip( args, callback );
  4519. });
  4520. }
  4521. if ( l ) {
  4522. fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
  4523. first = fragment.firstChild;
  4524. if ( fragment.childNodes.length === 1 ) {
  4525. fragment = first;
  4526. }
  4527. if ( first ) {
  4528. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4529. hasScripts = scripts.length;
  4530. // Use the original fragment for the last item instead of the first because it can end up
  4531. // being emptied incorrectly in certain situations (#8070).
  4532. for ( ; i < l; i++ ) {
  4533. node = fragment;
  4534. if ( i !== iNoClone ) {
  4535. node = jQuery.clone( node, true, true );
  4536. // Keep references to cloned scripts for later restoration
  4537. if ( hasScripts ) {
  4538. // Support: QtWebKit
  4539. // jQuery.merge because push.apply(_, arraylike) throws
  4540. jQuery.merge( scripts, getAll( node, "script" ) );
  4541. }
  4542. }
  4543. callback.call( this[ i ], node, i );
  4544. }
  4545. if ( hasScripts ) {
  4546. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4547. // Reenable scripts
  4548. jQuery.map( scripts, restoreScript );
  4549. // Evaluate executable scripts on first document insertion
  4550. for ( i = 0; i < hasScripts; i++ ) {
  4551. node = scripts[ i ];
  4552. if ( rscriptType.test( node.type || "" ) &&
  4553. !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
  4554. if ( node.src ) {
  4555. // Optional AJAX dependency, but won't run scripts if not present
  4556. if ( jQuery._evalUrl ) {
  4557. jQuery._evalUrl( node.src );
  4558. }
  4559. } else {
  4560. jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
  4561. }
  4562. }
  4563. }
  4564. }
  4565. }
  4566. }
  4567. return this;
  4568. }
  4569. });
  4570. jQuery.each({
  4571. appendTo: "append",
  4572. prependTo: "prepend",
  4573. insertBefore: "before",
  4574. insertAfter: "after",
  4575. replaceAll: "replaceWith"
  4576. }, function( name, original ) {
  4577. jQuery.fn[ name ] = function( selector ) {
  4578. var elems,
  4579. ret = [],
  4580. insert = jQuery( selector ),
  4581. last = insert.length - 1,
  4582. i = 0;
  4583. for ( ; i <= last; i++ ) {
  4584. elems = i === last ? this : this.clone( true );
  4585. jQuery( insert[ i ] )[ original ]( elems );
  4586. // Support: QtWebKit
  4587. // .get() because push.apply(_, arraylike) throws
  4588. push.apply( ret, elems.get() );
  4589. }
  4590. return this.pushStack( ret );
  4591. };
  4592. });
  4593. var iframe,
  4594. elemdisplay = {};
  4595. /**
  4596. * Retrieve the actual display of a element
  4597. * @param {String} name nodeName of the element
  4598. * @param {Object} doc Document object
  4599. */
  4600. // Called only from within defaultDisplay
  4601. function actualDisplay( name, doc ) {
  4602. var style,
  4603. elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  4604. // getDefaultComputedStyle might be reliably used only on attached element
  4605. display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
  4606. // Use of this method is a temporary fix (more like optimization) until something better comes along,
  4607. // since it was removed from specification and supported only in FF
  4608. style.display : jQuery.css( elem[ 0 ], "display" );
  4609. // We don't have any data stored on the element,
  4610. // so use "detach" method as fast way to get rid of the element
  4611. elem.detach();
  4612. return display;
  4613. }
  4614. /**
  4615. * Try to determine the default display value of an element
  4616. * @param {String} nodeName
  4617. */
  4618. function defaultDisplay( nodeName ) {
  4619. var doc = document,
  4620. display = elemdisplay[ nodeName ];
  4621. if ( !display ) {
  4622. display = actualDisplay( nodeName, doc );
  4623. // If the simple way fails, read from inside an iframe
  4624. if ( display === "none" || !display ) {
  4625. // Use the already-created iframe if possible
  4626. iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
  4627. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  4628. doc = iframe[ 0 ].contentDocument;
  4629. // Support: IE
  4630. doc.write();
  4631. doc.close();
  4632. display = actualDisplay( nodeName, doc );
  4633. iframe.detach();
  4634. }
  4635. // Store the correct default display
  4636. elemdisplay[ nodeName ] = display;
  4637. }
  4638. return display;
  4639. }
  4640. var rmargin = (/^margin/);
  4641. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4642. var getStyles = function( elem ) {
  4643. // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
  4644. // IE throws on elements created in popups
  4645. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4646. if ( elem.ownerDocument.defaultView.opener ) {
  4647. return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
  4648. }
  4649. return window.getComputedStyle( elem, null );
  4650. };
  4651. function curCSS( elem, name, computed ) {
  4652. var width, minWidth, maxWidth, ret,
  4653. style = elem.style;
  4654. computed = computed || getStyles( elem );
  4655. // Support: IE9
  4656. // getPropertyValue is only needed for .css('filter') (#12537)
  4657. if ( computed ) {
  4658. ret = computed.getPropertyValue( name ) || computed[ name ];
  4659. }
  4660. if ( computed ) {
  4661. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  4662. ret = jQuery.style( elem, name );
  4663. }
  4664. // Support: iOS < 6
  4665. // A tribute to the "awesome hack by Dean Edwards"
  4666. // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
  4667. // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
  4668. if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  4669. // Remember the original values
  4670. width = style.width;
  4671. minWidth = style.minWidth;
  4672. maxWidth = style.maxWidth;
  4673. // Put in the new values to get a computed value out
  4674. style.minWidth = style.maxWidth = style.width = ret;
  4675. ret = computed.width;
  4676. // Revert the changed values
  4677. style.width = width;
  4678. style.minWidth = minWidth;
  4679. style.maxWidth = maxWidth;
  4680. }
  4681. }
  4682. return ret !== undefined ?
  4683. // Support: IE
  4684. // IE returns zIndex value as an integer.
  4685. ret + "" :
  4686. ret;
  4687. }
  4688. function addGetHookIf( conditionFn, hookFn ) {
  4689. // Define the hook, we'll check on the first run if it's really needed.
  4690. return {
  4691. get: function() {
  4692. if ( conditionFn() ) {
  4693. // Hook not needed (or it's not possible to use it due
  4694. // to missing dependency), remove it.
  4695. delete this.get;
  4696. return;
  4697. }
  4698. // Hook needed; redefine it so that the support test is not executed again.
  4699. return (this.get = hookFn).apply( this, arguments );
  4700. }
  4701. };
  4702. }
  4703. (function() {
  4704. var pixelPositionVal, boxSizingReliableVal,
  4705. docElem = document.documentElement,
  4706. container = document.createElement( "div" ),
  4707. div = document.createElement( "div" );
  4708. if ( !div.style ) {
  4709. return;
  4710. }
  4711. // Support: IE9-11+
  4712. // Style of cloned element affects source element cloned (#8908)
  4713. div.style.backgroundClip = "content-box";
  4714. div.cloneNode( true ).style.backgroundClip = "";
  4715. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  4716. container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
  4717. "position:absolute";
  4718. container.appendChild( div );
  4719. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4720. // so they're executed at the same time to save the second computation.
  4721. function computePixelPositionAndBoxSizingReliable() {
  4722. div.style.cssText =
  4723. // Support: Firefox<29, Android 2.3
  4724. // Vendor-prefix box-sizing
  4725. "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
  4726. "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
  4727. "border:1px;padding:1px;width:4px;position:absolute";
  4728. div.innerHTML = "";
  4729. docElem.appendChild( container );
  4730. var divStyle = window.getComputedStyle( div, null );
  4731. pixelPositionVal = divStyle.top !== "1%";
  4732. boxSizingReliableVal = divStyle.width === "4px";
  4733. docElem.removeChild( container );
  4734. }
  4735. // Support: node.js jsdom
  4736. // Don't assume that getComputedStyle is a property of the global object
  4737. if ( window.getComputedStyle ) {
  4738. jQuery.extend( support, {
  4739. pixelPosition: function() {
  4740. // This test is executed only once but we still do memoizing
  4741. // since we can use the boxSizingReliable pre-computing.
  4742. // No need to check if the test was already performed, though.
  4743. computePixelPositionAndBoxSizingReliable();
  4744. return pixelPositionVal;
  4745. },
  4746. boxSizingReliable: function() {
  4747. if ( boxSizingReliableVal == null ) {
  4748. computePixelPositionAndBoxSizingReliable();
  4749. }
  4750. return boxSizingReliableVal;
  4751. },
  4752. reliableMarginRight: function() {
  4753. // Support: Android 2.3
  4754. // Check if div with explicit width and no margin-right incorrectly
  4755. // gets computed margin-right based on width of container. (#3333)
  4756. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  4757. // This support function is only executed once so no memoizing is needed.
  4758. var ret,
  4759. marginDiv = div.appendChild( document.createElement( "div" ) );
  4760. // Reset CSS: box-sizing; display; margin; border; padding
  4761. marginDiv.style.cssText = div.style.cssText =
  4762. // Support: Firefox<29, Android 2.3
  4763. // Vendor-prefix box-sizing
  4764. "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
  4765. "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  4766. marginDiv.style.marginRight = marginDiv.style.width = "0";
  4767. div.style.width = "1px";
  4768. docElem.appendChild( container );
  4769. ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
  4770. docElem.removeChild( container );
  4771. div.removeChild( marginDiv );
  4772. return ret;
  4773. }
  4774. });
  4775. }
  4776. })();
  4777. // A method for quickly swapping in/out CSS properties to get correct calculations.
  4778. jQuery.swap = function( elem, options, callback, args ) {
  4779. var ret, name,
  4780. old = {};
  4781. // Remember the old values, and insert the new ones
  4782. for ( name in options ) {
  4783. old[ name ] = elem.style[ name ];
  4784. elem.style[ name ] = options[ name ];
  4785. }
  4786. ret = callback.apply( elem, args || [] );
  4787. // Revert the old values
  4788. for ( name in options ) {
  4789. elem.style[ name ] = old[ name ];
  4790. }
  4791. return ret;
  4792. };
  4793. var
  4794. // Swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
  4795. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  4796. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  4797. rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
  4798. rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
  4799. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  4800. cssNormalTransform = {
  4801. letterSpacing: "0",
  4802. fontWeight: "400"
  4803. },
  4804. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
  4805. // Return a css property mapped to a potentially vendor prefixed property
  4806. function vendorPropName( style, name ) {
  4807. // Shortcut for names that are not vendor prefixed
  4808. if ( name in style ) {
  4809. return name;
  4810. }
  4811. // Check for vendor prefixed names
  4812. var capName = name[0].toUpperCase() + name.slice(1),
  4813. origName = name,
  4814. i = cssPrefixes.length;
  4815. while ( i-- ) {
  4816. name = cssPrefixes[ i ] + capName;
  4817. if ( name in style ) {
  4818. return name;
  4819. }
  4820. }
  4821. return origName;
  4822. }
  4823. function setPositiveNumber( elem, value, subtract ) {
  4824. var matches = rnumsplit.exec( value );
  4825. return matches ?
  4826. // Guard against undefined "subtract", e.g., when used as in cssHooks
  4827. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  4828. value;
  4829. }
  4830. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  4831. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  4832. // If we already have the right measurement, avoid augmentation
  4833. 4 :
  4834. // Otherwise initialize for horizontal or vertical properties
  4835. name === "width" ? 1 : 0,
  4836. val = 0;
  4837. for ( ; i < 4; i += 2 ) {
  4838. // Both box models exclude margin, so add it if we want it
  4839. if ( extra === "margin" ) {
  4840. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  4841. }
  4842. if ( isBorderBox ) {
  4843. // border-box includes padding, so remove it if we want content
  4844. if ( extra === "content" ) {
  4845. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  4846. }
  4847. // At this point, extra isn't border nor margin, so remove border
  4848. if ( extra !== "margin" ) {
  4849. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  4850. }
  4851. } else {
  4852. // At this point, extra isn't content, so add padding
  4853. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  4854. // At this point, extra isn't content nor padding, so add border
  4855. if ( extra !== "padding" ) {
  4856. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  4857. }
  4858. }
  4859. }
  4860. return val;
  4861. }
  4862. function getWidthOrHeight( elem, name, extra ) {
  4863. // Start with offset property, which is equivalent to the border-box value
  4864. var valueIsBorderBox = true,
  4865. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  4866. styles = getStyles( elem ),
  4867. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  4868. // Some non-html elements return undefined for offsetWidth, so check for null/undefined
  4869. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  4870. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  4871. if ( val <= 0 || val == null ) {
  4872. // Fall back to computed then uncomputed css if necessary
  4873. val = curCSS( elem, name, styles );
  4874. if ( val < 0 || val == null ) {
  4875. val = elem.style[ name ];
  4876. }
  4877. // Computed unit is not pixels. Stop here and return.
  4878. if ( rnumnonpx.test(val) ) {
  4879. return val;
  4880. }
  4881. // Check for style in case a browser which returns unreliable values
  4882. // for getComputedStyle silently falls back to the reliable elem.style
  4883. valueIsBorderBox = isBorderBox &&
  4884. ( support.boxSizingReliable() || val === elem.style[ name ] );
  4885. // Normalize "", auto, and prepare for extra
  4886. val = parseFloat( val ) || 0;
  4887. }
  4888. // Use the active box-sizing model to add/subtract irrelevant styles
  4889. return ( val +
  4890. augmentWidthOrHeight(
  4891. elem,
  4892. name,
  4893. extra || ( isBorderBox ? "border" : "content" ),
  4894. valueIsBorderBox,
  4895. styles
  4896. )
  4897. ) + "px";
  4898. }
  4899. function showHide( elements, show ) {
  4900. var display, elem, hidden,
  4901. values = [],
  4902. index = 0,
  4903. length = elements.length;
  4904. for ( ; index < length; index++ ) {
  4905. elem = elements[ index ];
  4906. if ( !elem.style ) {
  4907. continue;
  4908. }
  4909. values[ index ] = data_priv.get( elem, "olddisplay" );
  4910. display = elem.style.display;
  4911. if ( show ) {
  4912. // Reset the inline display of this element to learn if it is
  4913. // being hidden by cascaded rules or not
  4914. if ( !values[ index ] && display === "none" ) {
  4915. elem.style.display = "";
  4916. }
  4917. // Set elements which have been overridden with display: none
  4918. // in a stylesheet to whatever the default browser style is
  4919. // for such an element
  4920. if ( elem.style.display === "" && isHidden( elem ) ) {
  4921. values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
  4922. }
  4923. } else {
  4924. hidden = isHidden( elem );
  4925. if ( display !== "none" || !hidden ) {
  4926. data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
  4927. }
  4928. }
  4929. }
  4930. // Set the display of most of the elements in a second loop
  4931. // to avoid the constant reflow
  4932. for ( index = 0; index < length; index++ ) {
  4933. elem = elements[ index ];
  4934. if ( !elem.style ) {
  4935. continue;
  4936. }
  4937. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  4938. elem.style.display = show ? values[ index ] || "" : "none";
  4939. }
  4940. }
  4941. return elements;
  4942. }
  4943. jQuery.extend({
  4944. // Add in style property hooks for overriding the default
  4945. // behavior of getting and setting a style property
  4946. cssHooks: {
  4947. opacity: {
  4948. get: function( elem, computed ) {
  4949. if ( computed ) {
  4950. // We should always get a number back from opacity
  4951. var ret = curCSS( elem, "opacity" );
  4952. return ret === "" ? "1" : ret;
  4953. }
  4954. }
  4955. }
  4956. },
  4957. // Don't automatically add "px" to these possibly-unitless properties
  4958. cssNumber: {
  4959. "columnCount": true,
  4960. "fillOpacity": true,
  4961. "flexGrow": true,
  4962. "flexShrink": true,
  4963. "fontWeight": true,
  4964. "lineHeight": true,
  4965. "opacity": true,
  4966. "order": true,
  4967. "orphans": true,
  4968. "widows": true,
  4969. "zIndex": true,
  4970. "zoom": true
  4971. },
  4972. // Add in properties whose names you wish to fix before
  4973. // setting or getting the value
  4974. cssProps: {
  4975. "float": "cssFloat"
  4976. },
  4977. // Get and set the style property on a DOM Node
  4978. style: function( elem, name, value, extra ) {
  4979. // Don't set styles on text and comment nodes
  4980. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  4981. return;
  4982. }
  4983. // Make sure that we're working with the right name
  4984. var ret, type, hooks,
  4985. origName = jQuery.camelCase( name ),
  4986. style = elem.style;
  4987. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
  4988. // Gets hook for the prefixed version, then unprefixed version
  4989. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  4990. // Check if we're setting a value
  4991. if ( value !== undefined ) {
  4992. type = typeof value;
  4993. // Convert "+=" or "-=" to relative numbers (#7345)
  4994. if ( type === "string" && (ret = rrelNum.exec( value )) ) {
  4995. value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
  4996. // Fixes bug #9237
  4997. type = "number";
  4998. }
  4999. // Make sure that null and NaN values aren't set (#7116)
  5000. if ( value == null || value !== value ) {
  5001. return;
  5002. }
  5003. // If a number, add 'px' to the (except for certain CSS properties)
  5004. if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
  5005. value += "px";
  5006. }
  5007. // Support: IE9-11+
  5008. // background-* props affect original clone's values
  5009. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5010. style[ name ] = "inherit";
  5011. }
  5012. // If a hook was provided, use that value, otherwise just set the specified value
  5013. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
  5014. style[ name ] = value;
  5015. }
  5016. } else {
  5017. // If a hook was provided get the non-computed value from there
  5018. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  5019. return ret;
  5020. }
  5021. // Otherwise just get the value from the style object
  5022. return style[ name ];
  5023. }
  5024. },
  5025. css: function( elem, name, extra, styles ) {
  5026. var val, num, hooks,
  5027. origName = jQuery.camelCase( name );
  5028. // Make sure that we're working with the right name
  5029. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
  5030. // Try prefixed name followed by the unprefixed name
  5031. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5032. // If a hook was provided get the computed value from there
  5033. if ( hooks && "get" in hooks ) {
  5034. val = hooks.get( elem, true, extra );
  5035. }
  5036. // Otherwise, if a way to get the computed value exists, use that
  5037. if ( val === undefined ) {
  5038. val = curCSS( elem, name, styles );
  5039. }
  5040. // Convert "normal" to computed value
  5041. if ( val === "normal" && name in cssNormalTransform ) {
  5042. val = cssNormalTransform[ name ];
  5043. }
  5044. // Make numeric if forced or a qualifier was provided and val looks numeric
  5045. if ( extra === "" || extra ) {
  5046. num = parseFloat( val );
  5047. return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
  5048. }
  5049. return val;
  5050. }
  5051. });
  5052. jQuery.each([ "height", "width" ], function( i, name ) {
  5053. jQuery.cssHooks[ name ] = {
  5054. get: function( elem, computed, extra ) {
  5055. if ( computed ) {
  5056. // Certain elements can have dimension info if we invisibly show them
  5057. // but it must have a current display style that would benefit
  5058. return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
  5059. jQuery.swap( elem, cssShow, function() {
  5060. return getWidthOrHeight( elem, name, extra );
  5061. }) :
  5062. getWidthOrHeight( elem, name, extra );
  5063. }
  5064. },
  5065. set: function( elem, value, extra ) {
  5066. var styles = extra && getStyles( elem );
  5067. return setPositiveNumber( elem, value, extra ?
  5068. augmentWidthOrHeight(
  5069. elem,
  5070. name,
  5071. extra,
  5072. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5073. styles
  5074. ) : 0
  5075. );
  5076. }
  5077. };
  5078. });
  5079. // Support: Android 2.3
  5080. jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
  5081. function( elem, computed ) {
  5082. if ( computed ) {
  5083. return jQuery.swap( elem, { "display": "inline-block" },
  5084. curCSS, [ elem, "marginRight" ] );
  5085. }
  5086. }
  5087. );
  5088. // These hooks are used by animate to expand properties
  5089. jQuery.each({
  5090. margin: "",
  5091. padding: "",
  5092. border: "Width"
  5093. }, function( prefix, suffix ) {
  5094. jQuery.cssHooks[ prefix + suffix ] = {
  5095. expand: function( value ) {
  5096. var i = 0,
  5097. expanded = {},
  5098. // Assumes a single number if not a string
  5099. parts = typeof value === "string" ? value.split(" ") : [ value ];
  5100. for ( ; i < 4; i++ ) {
  5101. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5102. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5103. }
  5104. return expanded;
  5105. }
  5106. };
  5107. if ( !rmargin.test( prefix ) ) {
  5108. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5109. }
  5110. });
  5111. jQuery.fn.extend({
  5112. css: function( name, value ) {
  5113. return access( this, function( elem, name, value ) {
  5114. var styles, len,
  5115. map = {},
  5116. i = 0;
  5117. if ( jQuery.isArray( name ) ) {
  5118. styles = getStyles( elem );
  5119. len = name.length;
  5120. for ( ; i < len; i++ ) {
  5121. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5122. }
  5123. return map;
  5124. }
  5125. return value !== undefined ?
  5126. jQuery.style( elem, name, value ) :
  5127. jQuery.css( elem, name );
  5128. }, name, value, arguments.length > 1 );
  5129. },
  5130. show: function() {
  5131. return showHide( this, true );
  5132. },
  5133. hide: function() {
  5134. return showHide( this );
  5135. },
  5136. toggle: function( state ) {
  5137. if ( typeof state === "boolean" ) {
  5138. return state ? this.show() : this.hide();
  5139. }
  5140. return this.each(function() {
  5141. if ( isHidden( this ) ) {
  5142. jQuery( this ).show();
  5143. } else {
  5144. jQuery( this ).hide();
  5145. }
  5146. });
  5147. }
  5148. });
  5149. function Tween( elem, options, prop, end, easing ) {
  5150. return new Tween.prototype.init( elem, options, prop, end, easing );
  5151. }
  5152. jQuery.Tween = Tween;
  5153. Tween.prototype = {
  5154. constructor: Tween,
  5155. init: function( elem, options, prop, end, easing, unit ) {
  5156. this.elem = elem;
  5157. this.prop = prop;
  5158. this.easing = easing || "swing";
  5159. this.options = options;
  5160. this.start = this.now = this.cur();
  5161. this.end = end;
  5162. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  5163. },
  5164. cur: function() {
  5165. var hooks = Tween.propHooks[ this.prop ];
  5166. return hooks && hooks.get ?
  5167. hooks.get( this ) :
  5168. Tween.propHooks._default.get( this );
  5169. },
  5170. run: function( percent ) {
  5171. var eased,
  5172. hooks = Tween.propHooks[ this.prop ];
  5173. if ( this.options.duration ) {
  5174. this.pos = eased = jQuery.easing[ this.easing ](
  5175. percent, this.options.duration * percent, 0, 1, this.options.duration
  5176. );
  5177. } else {
  5178. this.pos = eased = percent;
  5179. }
  5180. this.now = ( this.end - this.start ) * eased + this.start;
  5181. if ( this.options.step ) {
  5182. this.options.step.call( this.elem, this.now, this );
  5183. }
  5184. if ( hooks && hooks.set ) {
  5185. hooks.set( this );
  5186. } else {
  5187. Tween.propHooks._default.set( this );
  5188. }
  5189. return this;
  5190. }
  5191. };
  5192. Tween.prototype.init.prototype = Tween.prototype;
  5193. Tween.propHooks = {
  5194. _default: {
  5195. get: function( tween ) {
  5196. var result;
  5197. if ( tween.elem[ tween.prop ] != null &&
  5198. (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
  5199. return tween.elem[ tween.prop ];
  5200. }
  5201. // Passing an empty string as a 3rd parameter to .css will automatically
  5202. // attempt a parseFloat and fallback to a string if the parse fails.
  5203. // Simple values such as "10px" are parsed to Float;
  5204. // complex values such as "rotate(1rad)" are returned as-is.
  5205. result = jQuery.css( tween.elem, tween.prop, "" );
  5206. // Empty strings, null, undefined and "auto" are converted to 0.
  5207. return !result || result === "auto" ? 0 : result;
  5208. },
  5209. set: function( tween ) {
  5210. // Use step hook for back compat.
  5211. // Use cssHook if its there.
  5212. // Use .style if available and use plain properties where available.
  5213. if ( jQuery.fx.step[ tween.prop ] ) {
  5214. jQuery.fx.step[ tween.prop ]( tween );
  5215. } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
  5216. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  5217. } else {
  5218. tween.elem[ tween.prop ] = tween.now;
  5219. }
  5220. }
  5221. }
  5222. };
  5223. // Support: IE9
  5224. // Panic based approach to setting things on disconnected nodes
  5225. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5226. set: function( tween ) {
  5227. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  5228. tween.elem[ tween.prop ] = tween.now;
  5229. }
  5230. }
  5231. };
  5232. jQuery.easing = {
  5233. linear: function( p ) {
  5234. return p;
  5235. },
  5236. swing: function( p ) {
  5237. return 0.5 - Math.cos( p * Math.PI ) / 2;
  5238. }
  5239. };
  5240. jQuery.fx = Tween.prototype.init;
  5241. // Back Compat <1.8 extension point
  5242. jQuery.fx.step = {};
  5243. var
  5244. fxNow, timerId,
  5245. rfxtypes = /^(?:toggle|show|hide)$/,
  5246. rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
  5247. rrun = /queueHooks$/,
  5248. animationPrefilters = [ defaultPrefilter ],
  5249. tweeners = {
  5250. "*": [ function( prop, value ) {
  5251. var tween = this.createTween( prop, value ),
  5252. target = tween.cur(),
  5253. parts = rfxnum.exec( value ),
  5254. unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  5255. // Starting value computation is required for potential unit mismatches
  5256. start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
  5257. rfxnum.exec( jQuery.css( tween.elem, prop ) ),
  5258. scale = 1,
  5259. maxIterations = 20;
  5260. if ( start && start[ 3 ] !== unit ) {
  5261. // Trust units reported by jQuery.css
  5262. unit = unit || start[ 3 ];
  5263. // Make sure we update the tween properties later on
  5264. parts = parts || [];
  5265. // Iteratively approximate from a nonzero starting point
  5266. start = +target || 1;
  5267. do {
  5268. // If previous iteration zeroed out, double until we get *something*.
  5269. // Use string for doubling so we don't accidentally see scale as unchanged below
  5270. scale = scale || ".5";
  5271. // Adjust and apply
  5272. start = start / scale;
  5273. jQuery.style( tween.elem, prop, start + unit );
  5274. // Update scale, tolerating zero or NaN from tween.cur(),
  5275. // break the loop if scale is unchanged or perfect, or if we've just had enough
  5276. } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
  5277. }
  5278. // Update tween properties
  5279. if ( parts ) {
  5280. start = tween.start = +start || +target || 0;
  5281. tween.unit = unit;
  5282. // If a +=/-= token was provided, we're doing a relative animation
  5283. tween.end = parts[ 1 ] ?
  5284. start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
  5285. +parts[ 2 ];
  5286. }
  5287. return tween;
  5288. } ]
  5289. };
  5290. // Animations created synchronously will run synchronously
  5291. function createFxNow() {
  5292. setTimeout(function() {
  5293. fxNow = undefined;
  5294. });
  5295. return ( fxNow = jQuery.now() );
  5296. }
  5297. // Generate parameters to create a standard animation
  5298. function genFx( type, includeWidth ) {
  5299. var which,
  5300. i = 0,
  5301. attrs = { height: type };
  5302. // If we include width, step value is 1 to do all cssExpand values,
  5303. // otherwise step value is 2 to skip over Left and Right
  5304. includeWidth = includeWidth ? 1 : 0;
  5305. for ( ; i < 4 ; i += 2 - includeWidth ) {
  5306. which = cssExpand[ i ];
  5307. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  5308. }
  5309. if ( includeWidth ) {
  5310. attrs.opacity = attrs.width = type;
  5311. }
  5312. return attrs;
  5313. }
  5314. function createTween( value, prop, animation ) {
  5315. var tween,
  5316. collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
  5317. index = 0,
  5318. length = collection.length;
  5319. for ( ; index < length; index++ ) {
  5320. if ( (tween = collection[ index ].call( animation, prop, value )) ) {
  5321. // We're done with this property
  5322. return tween;
  5323. }
  5324. }
  5325. }
  5326. function defaultPrefilter( elem, props, opts ) {
  5327. /* jshint validthis: true */
  5328. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  5329. anim = this,
  5330. orig = {},
  5331. style = elem.style,
  5332. hidden = elem.nodeType && isHidden( elem ),
  5333. dataShow = data_priv.get( elem, "fxshow" );
  5334. // Handle queue: false promises
  5335. if ( !opts.queue ) {
  5336. hooks = jQuery._queueHooks( elem, "fx" );
  5337. if ( hooks.unqueued == null ) {
  5338. hooks.unqueued = 0;
  5339. oldfire = hooks.empty.fire;
  5340. hooks.empty.fire = function() {
  5341. if ( !hooks.unqueued ) {
  5342. oldfire();
  5343. }
  5344. };
  5345. }
  5346. hooks.unqueued++;
  5347. anim.always(function() {
  5348. // Ensure the complete handler is called before this completes
  5349. anim.always(function() {
  5350. hooks.unqueued--;
  5351. if ( !jQuery.queue( elem, "fx" ).length ) {
  5352. hooks.empty.fire();
  5353. }
  5354. });
  5355. });
  5356. }
  5357. // Height/width overflow pass
  5358. if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
  5359. // Make sure that nothing sneaks out
  5360. // Record all 3 overflow attributes because IE9-10 do not
  5361. // change the overflow attribute when overflowX and
  5362. // overflowY are set to the same value
  5363. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  5364. // Set display property to inline-block for height/width
  5365. // animations on inline elements that are having width/height animated
  5366. display = jQuery.css( elem, "display" );
  5367. // Test default display if display is currently "none"
  5368. checkDisplay = display === "none" ?
  5369. data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
  5370. if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  5371. style.display = "inline-block";
  5372. }
  5373. }
  5374. if ( opts.overflow ) {
  5375. style.overflow = "hidden";
  5376. anim.always(function() {
  5377. style.overflow = opts.overflow[ 0 ];
  5378. style.overflowX = opts.overflow[ 1 ];
  5379. style.overflowY = opts.overflow[ 2 ];
  5380. });
  5381. }
  5382. // show/hide pass
  5383. for ( prop in props ) {
  5384. value = props[ prop ];
  5385. if ( rfxtypes.exec( value ) ) {
  5386. delete props[ prop ];
  5387. toggle = toggle || value === "toggle";
  5388. if ( value === ( hidden ? "hide" : "show" ) ) {
  5389. // 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
  5390. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  5391. hidden = true;
  5392. } else {
  5393. continue;
  5394. }
  5395. }
  5396. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  5397. // Any non-fx value stops us from restoring the original display value
  5398. } else {
  5399. display = undefined;
  5400. }
  5401. }
  5402. if ( !jQuery.isEmptyObject( orig ) ) {
  5403. if ( dataShow ) {
  5404. if ( "hidden" in dataShow ) {
  5405. hidden = dataShow.hidden;
  5406. }
  5407. } else {
  5408. dataShow = data_priv.access( elem, "fxshow", {} );
  5409. }
  5410. // Store state if its toggle - enables .stop().toggle() to "reverse"
  5411. if ( toggle ) {
  5412. dataShow.hidden = !hidden;
  5413. }
  5414. if ( hidden ) {
  5415. jQuery( elem ).show();
  5416. } else {
  5417. anim.done(function() {
  5418. jQuery( elem ).hide();
  5419. });
  5420. }
  5421. anim.done(function() {
  5422. var prop;
  5423. data_priv.remove( elem, "fxshow" );
  5424. for ( prop in orig ) {
  5425. jQuery.style( elem, prop, orig[ prop ] );
  5426. }
  5427. });
  5428. for ( prop in orig ) {
  5429. tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  5430. if ( !( prop in dataShow ) ) {
  5431. dataShow[ prop ] = tween.start;
  5432. if ( hidden ) {
  5433. tween.end = tween.start;
  5434. tween.start = prop === "width" || prop === "height" ? 1 : 0;
  5435. }
  5436. }
  5437. }
  5438. // If this is a noop like .hide().hide(), restore an overwritten display value
  5439. } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
  5440. style.display = display;
  5441. }
  5442. }
  5443. function propFilter( props, specialEasing ) {
  5444. var index, name, easing, value, hooks;
  5445. // camelCase, specialEasing and expand cssHook pass
  5446. for ( index in props ) {
  5447. name = jQuery.camelCase( index );
  5448. easing = specialEasing[ name ];
  5449. value = props[ index ];
  5450. if ( jQuery.isArray( value ) ) {
  5451. easing = value[ 1 ];
  5452. value = props[ index ] = value[ 0 ];
  5453. }
  5454. if ( index !== name ) {
  5455. props[ name ] = value;
  5456. delete props[ index ];
  5457. }
  5458. hooks = jQuery.cssHooks[ name ];
  5459. if ( hooks && "expand" in hooks ) {
  5460. value = hooks.expand( value );
  5461. delete props[ name ];
  5462. // Not quite $.extend, this won't overwrite existing keys.
  5463. // Reusing 'index' because we have the correct "name"
  5464. for ( index in value ) {
  5465. if ( !( index in props ) ) {
  5466. props[ index ] = value[ index ];
  5467. specialEasing[ index ] = easing;
  5468. }
  5469. }
  5470. } else {
  5471. specialEasing[ name ] = easing;
  5472. }
  5473. }
  5474. }
  5475. function Animation( elem, properties, options ) {
  5476. var result,
  5477. stopped,
  5478. index = 0,
  5479. length = animationPrefilters.length,
  5480. deferred = jQuery.Deferred().always( function() {
  5481. // Don't match elem in the :animated selector
  5482. delete tick.elem;
  5483. }),
  5484. tick = function() {
  5485. if ( stopped ) {
  5486. return false;
  5487. }
  5488. var currentTime = fxNow || createFxNow(),
  5489. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  5490. // Support: Android 2.3
  5491. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5492. temp = remaining / animation.duration || 0,
  5493. percent = 1 - temp,
  5494. index = 0,
  5495. length = animation.tweens.length;
  5496. for ( ; index < length ; index++ ) {
  5497. animation.tweens[ index ].run( percent );
  5498. }
  5499. deferred.notifyWith( elem, [ animation, percent, remaining ]);
  5500. if ( percent < 1 && length ) {
  5501. return remaining;
  5502. } else {
  5503. deferred.resolveWith( elem, [ animation ] );
  5504. return false;
  5505. }
  5506. },
  5507. animation = deferred.promise({
  5508. elem: elem,
  5509. props: jQuery.extend( {}, properties ),
  5510. opts: jQuery.extend( true, { specialEasing: {} }, options ),
  5511. originalProperties: properties,
  5512. originalOptions: options,
  5513. startTime: fxNow || createFxNow(),
  5514. duration: options.duration,
  5515. tweens: [],
  5516. createTween: function( prop, end ) {
  5517. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  5518. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  5519. animation.tweens.push( tween );
  5520. return tween;
  5521. },
  5522. stop: function( gotoEnd ) {
  5523. var index = 0,
  5524. // If we are going to the end, we want to run all the tweens
  5525. // otherwise we skip this part
  5526. length = gotoEnd ? animation.tweens.length : 0;
  5527. if ( stopped ) {
  5528. return this;
  5529. }
  5530. stopped = true;
  5531. for ( ; index < length ; index++ ) {
  5532. animation.tweens[ index ].run( 1 );
  5533. }
  5534. // Resolve when we played the last frame; otherwise, reject
  5535. if ( gotoEnd ) {
  5536. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  5537. } else {
  5538. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  5539. }
  5540. return this;
  5541. }
  5542. }),
  5543. props = animation.props;
  5544. propFilter( props, animation.opts.specialEasing );
  5545. for ( ; index < length ; index++ ) {
  5546. result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
  5547. if ( result ) {
  5548. return result;
  5549. }
  5550. }
  5551. jQuery.map( props, createTween, animation );
  5552. if ( jQuery.isFunction( animation.opts.start ) ) {
  5553. animation.opts.start.call( elem, animation );
  5554. }
  5555. jQuery.fx.timer(
  5556. jQuery.extend( tick, {
  5557. elem: elem,
  5558. anim: animation,
  5559. queue: animation.opts.queue
  5560. })
  5561. );
  5562. // attach callbacks from options
  5563. return animation.progress( animation.opts.progress )
  5564. .done( animation.opts.done, animation.opts.complete )
  5565. .fail( animation.opts.fail )
  5566. .always( animation.opts.always );
  5567. }
  5568. jQuery.Animation = jQuery.extend( Animation, {
  5569. tweener: function( props, callback ) {
  5570. if ( jQuery.isFunction( props ) ) {
  5571. callback = props;
  5572. props = [ "*" ];
  5573. } else {
  5574. props = props.split(" ");
  5575. }
  5576. var prop,
  5577. index = 0,
  5578. length = props.length;
  5579. for ( ; index < length ; index++ ) {
  5580. prop = props[ index ];
  5581. tweeners[ prop ] = tweeners[ prop ] || [];
  5582. tweeners[ prop ].unshift( callback );
  5583. }
  5584. },
  5585. prefilter: function( callback, prepend ) {
  5586. if ( prepend ) {
  5587. animationPrefilters.unshift( callback );
  5588. } else {
  5589. animationPrefilters.push( callback );
  5590. }
  5591. }
  5592. });
  5593. jQuery.speed = function( speed, easing, fn ) {
  5594. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  5595. complete: fn || !fn && easing ||
  5596. jQuery.isFunction( speed ) && speed,
  5597. duration: speed,
  5598. easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  5599. };
  5600. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  5601. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
  5602. // Normalize opt.queue - true/undefined/null -> "fx"
  5603. if ( opt.queue == null || opt.queue === true ) {
  5604. opt.queue = "fx";
  5605. }
  5606. // Queueing
  5607. opt.old = opt.complete;
  5608. opt.complete = function() {
  5609. if ( jQuery.isFunction( opt.old ) ) {
  5610. opt.old.call( this );
  5611. }
  5612. if ( opt.queue ) {
  5613. jQuery.dequeue( this, opt.queue );
  5614. }
  5615. };
  5616. return opt;
  5617. };
  5618. jQuery.fn.extend({
  5619. fadeTo: function( speed, to, easing, callback ) {
  5620. // Show any hidden elements after setting opacity to 0
  5621. return this.filter( isHidden ).css( "opacity", 0 ).show()
  5622. // Animate to the value specified
  5623. .end().animate({ opacity: to }, speed, easing, callback );
  5624. },
  5625. animate: function( prop, speed, easing, callback ) {
  5626. var empty = jQuery.isEmptyObject( prop ),
  5627. optall = jQuery.speed( speed, easing, callback ),
  5628. doAnimation = function() {
  5629. // Operate on a copy of prop so per-property easing won't be lost
  5630. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  5631. // Empty animations, or finishing resolves immediately
  5632. if ( empty || data_priv.get( this, "finish" ) ) {
  5633. anim.stop( true );
  5634. }
  5635. };
  5636. doAnimation.finish = doAnimation;
  5637. return empty || optall.queue === false ?
  5638. this.each( doAnimation ) :
  5639. this.queue( optall.queue, doAnimation );
  5640. },
  5641. stop: function( type, clearQueue, gotoEnd ) {
  5642. var stopQueue = function( hooks ) {
  5643. var stop = hooks.stop;
  5644. delete hooks.stop;
  5645. stop( gotoEnd );
  5646. };
  5647. if ( typeof type !== "string" ) {
  5648. gotoEnd = clearQueue;
  5649. clearQueue = type;
  5650. type = undefined;
  5651. }
  5652. if ( clearQueue && type !== false ) {
  5653. this.queue( type || "fx", [] );
  5654. }
  5655. return this.each(function() {
  5656. var dequeue = true,
  5657. index = type != null && type + "queueHooks",
  5658. timers = jQuery.timers,
  5659. data = data_priv.get( this );
  5660. if ( index ) {
  5661. if ( data[ index ] && data[ index ].stop ) {
  5662. stopQueue( data[ index ] );
  5663. }
  5664. } else {
  5665. for ( index in data ) {
  5666. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  5667. stopQueue( data[ index ] );
  5668. }
  5669. }
  5670. }
  5671. for ( index = timers.length; index--; ) {
  5672. if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
  5673. timers[ index ].anim.stop( gotoEnd );
  5674. dequeue = false;
  5675. timers.splice( index, 1 );
  5676. }
  5677. }
  5678. // Start the next in the queue if the last step wasn't forced.
  5679. // Timers currently will call their complete callbacks, which
  5680. // will dequeue but only if they were gotoEnd.
  5681. if ( dequeue || !gotoEnd ) {
  5682. jQuery.dequeue( this, type );
  5683. }
  5684. });
  5685. },
  5686. finish: function( type ) {
  5687. if ( type !== false ) {
  5688. type = type || "fx";
  5689. }
  5690. return this.each(function() {
  5691. var index,
  5692. data = data_priv.get( this ),
  5693. queue = data[ type + "queue" ],
  5694. hooks = data[ type + "queueHooks" ],
  5695. timers = jQuery.timers,
  5696. length = queue ? queue.length : 0;
  5697. // Enable finishing flag on private data
  5698. data.finish = true;
  5699. // Empty the queue first
  5700. jQuery.queue( this, type, [] );
  5701. if ( hooks && hooks.stop ) {
  5702. hooks.stop.call( this, true );
  5703. }
  5704. // Look for any active animations, and finish them
  5705. for ( index = timers.length; index--; ) {
  5706. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  5707. timers[ index ].anim.stop( true );
  5708. timers.splice( index, 1 );
  5709. }
  5710. }
  5711. // Look for any animations in the old queue and finish them
  5712. for ( index = 0; index < length; index++ ) {
  5713. if ( queue[ index ] && queue[ index ].finish ) {
  5714. queue[ index ].finish.call( this );
  5715. }
  5716. }
  5717. // Turn off finishing flag
  5718. delete data.finish;
  5719. });
  5720. }
  5721. });
  5722. jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
  5723. var cssFn = jQuery.fn[ name ];
  5724. jQuery.fn[ name ] = function( speed, easing, callback ) {
  5725. return speed == null || typeof speed === "boolean" ?
  5726. cssFn.apply( this, arguments ) :
  5727. this.animate( genFx( name, true ), speed, easing, callback );
  5728. };
  5729. });
  5730. // Generate shortcuts for custom animations
  5731. jQuery.each({
  5732. slideDown: genFx("show"),
  5733. slideUp: genFx("hide"),
  5734. slideToggle: genFx("toggle"),
  5735. fadeIn: { opacity: "show" },
  5736. fadeOut: { opacity: "hide" },
  5737. fadeToggle: { opacity: "toggle" }
  5738. }, function( name, props ) {
  5739. jQuery.fn[ name ] = function( speed, easing, callback ) {
  5740. return this.animate( props, speed, easing, callback );
  5741. };
  5742. });
  5743. jQuery.timers = [];
  5744. jQuery.fx.tick = function() {
  5745. var timer,
  5746. i = 0,
  5747. timers = jQuery.timers;
  5748. fxNow = jQuery.now();
  5749. for ( ; i < timers.length; i++ ) {
  5750. timer = timers[ i ];
  5751. // Checks the timer has not already been removed
  5752. if ( !timer() && timers[ i ] === timer ) {
  5753. timers.splice( i--, 1 );
  5754. }
  5755. }
  5756. if ( !timers.length ) {
  5757. jQuery.fx.stop();
  5758. }
  5759. fxNow = undefined;
  5760. };
  5761. jQuery.fx.timer = function( timer ) {
  5762. jQuery.timers.push( timer );
  5763. if ( timer() ) {
  5764. jQuery.fx.start();
  5765. } else {
  5766. jQuery.timers.pop();
  5767. }
  5768. };
  5769. jQuery.fx.interval = 13;
  5770. jQuery.fx.start = function() {
  5771. if ( !timerId ) {
  5772. timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
  5773. }
  5774. };
  5775. jQuery.fx.stop = function() {
  5776. clearInterval( timerId );
  5777. timerId = null;
  5778. };
  5779. jQuery.fx.speeds = {
  5780. slow: 600,
  5781. fast: 200,
  5782. // Default speed
  5783. _default: 400
  5784. };
  5785. // Based off of the plugin by Clint Helfers, with permission.
  5786. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  5787. jQuery.fn.delay = function( time, type ) {
  5788. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  5789. type = type || "fx";
  5790. return this.queue( type, function( next, hooks ) {
  5791. var timeout = setTimeout( next, time );
  5792. hooks.stop = function() {
  5793. clearTimeout( timeout );
  5794. };
  5795. });
  5796. };
  5797. (function() {
  5798. var input = document.createElement( "input" ),
  5799. select = document.createElement( "select" ),
  5800. opt = select.appendChild( document.createElement( "option" ) );
  5801. input.type = "checkbox";
  5802. // Support: iOS<=5.1, Android<=4.2+
  5803. // Default value for a checkbox should be "on"
  5804. support.checkOn = input.value !== "";
  5805. // Support: IE<=11+
  5806. // Must access selectedIndex to make default options select
  5807. support.optSelected = opt.selected;
  5808. // Support: Android<=2.3
  5809. // Options inside disabled selects are incorrectly marked as disabled
  5810. select.disabled = true;
  5811. support.optDisabled = !opt.disabled;
  5812. // Support: IE<=11+
  5813. // An input loses its value after becoming a radio
  5814. input = document.createElement( "input" );
  5815. input.value = "t";
  5816. input.type = "radio";
  5817. support.radioValue = input.value === "t";
  5818. })();
  5819. var nodeHook, boolHook,
  5820. attrHandle = jQuery.expr.attrHandle;
  5821. jQuery.fn.extend({
  5822. attr: function( name, value ) {
  5823. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  5824. },
  5825. removeAttr: function( name ) {
  5826. return this.each(function() {
  5827. jQuery.removeAttr( this, name );
  5828. });
  5829. }
  5830. });
  5831. jQuery.extend({
  5832. attr: function( elem, name, value ) {
  5833. var hooks, ret,
  5834. nType = elem.nodeType;
  5835. // don't get/set attributes on text, comment and attribute nodes
  5836. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  5837. return;
  5838. }
  5839. // Fallback to prop when attributes are not supported
  5840. if ( typeof elem.getAttribute === strundefined ) {
  5841. return jQuery.prop( elem, name, value );
  5842. }
  5843. // All attributes are lowercase
  5844. // Grab necessary hook if one is defined
  5845. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  5846. name = name.toLowerCase();
  5847. hooks = jQuery.attrHooks[ name ] ||
  5848. ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
  5849. }
  5850. if ( value !== undefined ) {
  5851. if ( value === null ) {
  5852. jQuery.removeAttr( elem, name );
  5853. } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
  5854. return ret;
  5855. } else {
  5856. elem.setAttribute( name, value + "" );
  5857. return value;
  5858. }
  5859. } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
  5860. return ret;
  5861. } else {
  5862. ret = jQuery.find.attr( elem, name );
  5863. // Non-existent attributes return null, we normalize to undefined
  5864. return ret == null ?
  5865. undefined :
  5866. ret;
  5867. }
  5868. },
  5869. removeAttr: function( elem, value ) {
  5870. var name, propName,
  5871. i = 0,
  5872. attrNames = value && value.match( rnotwhite );
  5873. if ( attrNames && elem.nodeType === 1 ) {
  5874. while ( (name = attrNames[i++]) ) {
  5875. propName = jQuery.propFix[ name ] || name;
  5876. // Boolean attributes get special treatment (#10870)
  5877. if ( jQuery.expr.match.bool.test( name ) ) {
  5878. // Set corresponding property to false
  5879. elem[ propName ] = false;
  5880. }
  5881. elem.removeAttribute( name );
  5882. }
  5883. }
  5884. },
  5885. attrHooks: {
  5886. type: {
  5887. set: function( elem, value ) {
  5888. if ( !support.radioValue && value === "radio" &&
  5889. jQuery.nodeName( elem, "input" ) ) {
  5890. var val = elem.value;
  5891. elem.setAttribute( "type", value );
  5892. if ( val ) {
  5893. elem.value = val;
  5894. }
  5895. return value;
  5896. }
  5897. }
  5898. }
  5899. }
  5900. });
  5901. // Hooks for boolean attributes
  5902. boolHook = {
  5903. set: function( elem, value, name ) {
  5904. if ( value === false ) {
  5905. // Remove boolean attributes when set to false
  5906. jQuery.removeAttr( elem, name );
  5907. } else {
  5908. elem.setAttribute( name, name );
  5909. }
  5910. return name;
  5911. }
  5912. };
  5913. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  5914. var getter = attrHandle[ name ] || jQuery.find.attr;
  5915. attrHandle[ name ] = function( elem, name, isXML ) {
  5916. var ret, handle;
  5917. if ( !isXML ) {
  5918. // Avoid an infinite loop by temporarily removing this function from the getter
  5919. handle = attrHandle[ name ];
  5920. attrHandle[ name ] = ret;
  5921. ret = getter( elem, name, isXML ) != null ?
  5922. name.toLowerCase() :
  5923. null;
  5924. attrHandle[ name ] = handle;
  5925. }
  5926. return ret;
  5927. };
  5928. });
  5929. var rfocusable = /^(?:input|select|textarea|button)$/i;
  5930. jQuery.fn.extend({
  5931. prop: function( name, value ) {
  5932. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  5933. },
  5934. removeProp: function( name ) {
  5935. return this.each(function() {
  5936. delete this[ jQuery.propFix[ name ] || name ];
  5937. });
  5938. }
  5939. });
  5940. jQuery.extend({
  5941. propFix: {
  5942. "for": "htmlFor",
  5943. "class": "className"
  5944. },
  5945. prop: function( elem, name, value ) {
  5946. var ret, hooks, notxml,
  5947. nType = elem.nodeType;
  5948. // Don't get/set properties on text, comment and attribute nodes
  5949. if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
  5950. return;
  5951. }
  5952. notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
  5953. if ( notxml ) {
  5954. // Fix name and attach hooks
  5955. name = jQuery.propFix[ name ] || name;
  5956. hooks = jQuery.propHooks[ name ];
  5957. }
  5958. if ( value !== undefined ) {
  5959. return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
  5960. ret :
  5961. ( elem[ name ] = value );
  5962. } else {
  5963. return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
  5964. ret :
  5965. elem[ name ];
  5966. }
  5967. },
  5968. propHooks: {
  5969. tabIndex: {
  5970. get: function( elem ) {
  5971. return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
  5972. elem.tabIndex :
  5973. -1;
  5974. }
  5975. }
  5976. }
  5977. });
  5978. if ( !support.optSelected ) {
  5979. jQuery.propHooks.selected = {
  5980. get: function( elem ) {
  5981. var parent = elem.parentNode;
  5982. if ( parent && parent.parentNode ) {
  5983. parent.parentNode.selectedIndex;
  5984. }
  5985. return null;
  5986. }
  5987. };
  5988. }
  5989. jQuery.each([
  5990. "tabIndex",
  5991. "readOnly",
  5992. "maxLength",
  5993. "cellSpacing",
  5994. "cellPadding",
  5995. "rowSpan",
  5996. "colSpan",
  5997. "useMap",
  5998. "frameBorder",
  5999. "contentEditable"
  6000. ], function() {
  6001. jQuery.propFix[ this.toLowerCase() ] = this;
  6002. });
  6003. var rclass = /[\t\r\n\f]/g;
  6004. jQuery.fn.extend({
  6005. addClass: function( value ) {
  6006. var classes, elem, cur, clazz, j, finalValue,
  6007. proceed = typeof value === "string" && value,
  6008. i = 0,
  6009. len = this.length;
  6010. if ( jQuery.isFunction( value ) ) {
  6011. return this.each(function( j ) {
  6012. jQuery( this ).addClass( value.call( this, j, this.className ) );
  6013. });
  6014. }
  6015. if ( proceed ) {
  6016. // The disjunction here is for better compressibility (see removeClass)
  6017. classes = ( value || "" ).match( rnotwhite ) || [];
  6018. for ( ; i < len; i++ ) {
  6019. elem = this[ i ];
  6020. cur = elem.nodeType === 1 && ( elem.className ?
  6021. ( " " + elem.className + " " ).replace( rclass, " " ) :
  6022. " "
  6023. );
  6024. if ( cur ) {
  6025. j = 0;
  6026. while ( (clazz = classes[j++]) ) {
  6027. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  6028. cur += clazz + " ";
  6029. }
  6030. }
  6031. // only assign if different to avoid unneeded rendering.
  6032. finalValue = jQuery.trim( cur );
  6033. if ( elem.className !== finalValue ) {
  6034. elem.className = finalValue;
  6035. }
  6036. }
  6037. }
  6038. }
  6039. return this;
  6040. },
  6041. removeClass: function( value ) {
  6042. var classes, elem, cur, clazz, j, finalValue,
  6043. proceed = arguments.length === 0 || typeof value === "string" && value,
  6044. i = 0,
  6045. len = this.length;
  6046. if ( jQuery.isFunction( value ) ) {
  6047. return this.each(function( j ) {
  6048. jQuery( this ).removeClass( value.call( this, j, this.className ) );
  6049. });
  6050. }
  6051. if ( proceed ) {
  6052. classes = ( value || "" ).match( rnotwhite ) || [];
  6053. for ( ; i < len; i++ ) {
  6054. elem = this[ i ];
  6055. // This expression is here for better compressibility (see addClass)
  6056. cur = elem.nodeType === 1 && ( elem.className ?
  6057. ( " " + elem.className + " " ).replace( rclass, " " ) :
  6058. ""
  6059. );
  6060. if ( cur ) {
  6061. j = 0;
  6062. while ( (clazz = classes[j++]) ) {
  6063. // Remove *all* instances
  6064. while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
  6065. cur = cur.replace( " " + clazz + " ", " " );
  6066. }
  6067. }
  6068. // Only assign if different to avoid unneeded rendering.
  6069. finalValue = value ? jQuery.trim( cur ) : "";
  6070. if ( elem.className !== finalValue ) {
  6071. elem.className = finalValue;
  6072. }
  6073. }
  6074. }
  6075. }
  6076. return this;
  6077. },
  6078. toggleClass: function( value, stateVal ) {
  6079. var type = typeof value;
  6080. if ( typeof stateVal === "boolean" && type === "string" ) {
  6081. return stateVal ? this.addClass( value ) : this.removeClass( value );
  6082. }
  6083. if ( jQuery.isFunction( value ) ) {
  6084. return this.each(function( i ) {
  6085. jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
  6086. });
  6087. }
  6088. return this.each(function() {
  6089. if ( type === "string" ) {
  6090. // Toggle individual class names
  6091. var className,
  6092. i = 0,
  6093. self = jQuery( this ),
  6094. classNames = value.match( rnotwhite ) || [];
  6095. while ( (className = classNames[ i++ ]) ) {
  6096. // Check each className given, space separated list
  6097. if ( self.hasClass( className ) ) {
  6098. self.removeClass( className );
  6099. } else {
  6100. self.addClass( className );
  6101. }
  6102. }
  6103. // Toggle whole class name
  6104. } else if ( type === strundefined || type === "boolean" ) {
  6105. if ( this.className ) {
  6106. // store className if set
  6107. data_priv.set( this, "__className__", this.className );
  6108. }
  6109. // If the element has a class name or if we're passed `false`,
  6110. // then remove the whole classname (if there was one, the above saved it).
  6111. // Otherwise bring back whatever was previously saved (if anything),
  6112. // falling back to the empty string if nothing was stored.
  6113. this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
  6114. }
  6115. });
  6116. },
  6117. hasClass: function( selector ) {
  6118. var className = " " + selector + " ",
  6119. i = 0,
  6120. l = this.length;
  6121. for ( ; i < l; i++ ) {
  6122. if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
  6123. return true;
  6124. }
  6125. }
  6126. return false;
  6127. }
  6128. });
  6129. var rreturn = /\r/g;
  6130. jQuery.fn.extend({
  6131. val: function( value ) {
  6132. var hooks, ret, isFunction,
  6133. elem = this[0];
  6134. if ( !arguments.length ) {
  6135. if ( elem ) {
  6136. hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  6137. if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
  6138. return ret;
  6139. }
  6140. ret = elem.value;
  6141. return typeof ret === "string" ?
  6142. // Handle most common string cases
  6143. ret.replace(rreturn, "") :
  6144. // Handle cases where value is null/undef or number
  6145. ret == null ? "" : ret;
  6146. }
  6147. return;
  6148. }
  6149. isFunction = jQuery.isFunction( value );
  6150. return this.each(function( i ) {
  6151. var val;
  6152. if ( this.nodeType !== 1 ) {
  6153. return;
  6154. }
  6155. if ( isFunction ) {
  6156. val = value.call( this, i, jQuery( this ).val() );
  6157. } else {
  6158. val = value;
  6159. }
  6160. // Treat null/undefined as ""; convert numbers to string
  6161. if ( val == null ) {
  6162. val = "";
  6163. } else if ( typeof val === "number" ) {
  6164. val += "";
  6165. } else if ( jQuery.isArray( val ) ) {
  6166. val = jQuery.map( val, function( value ) {
  6167. return value == null ? "" : value + "";
  6168. });
  6169. }
  6170. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  6171. // If set returns undefined, fall back to normal setting
  6172. if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
  6173. this.value = val;
  6174. }
  6175. });
  6176. }
  6177. });
  6178. jQuery.extend({
  6179. valHooks: {
  6180. option: {
  6181. get: function( elem ) {
  6182. var val = jQuery.find.attr( elem, "value" );
  6183. return val != null ?
  6184. val :
  6185. // Support: IE10-11+
  6186. // option.text throws exceptions (#14686, #14858)
  6187. jQuery.trim( jQuery.text( elem ) );
  6188. }
  6189. },
  6190. select: {
  6191. get: function( elem ) {
  6192. var value, option,
  6193. options = elem.options,
  6194. index = elem.selectedIndex,
  6195. one = elem.type === "select-one" || index < 0,
  6196. values = one ? null : [],
  6197. max = one ? index + 1 : options.length,
  6198. i = index < 0 ?
  6199. max :
  6200. one ? index : 0;
  6201. // Loop through all the selected options
  6202. for ( ; i < max; i++ ) {
  6203. option = options[ i ];
  6204. // IE6-9 doesn't update selected after form reset (#2551)
  6205. if ( ( option.selected || i === index ) &&
  6206. // Don't return options that are disabled or in a disabled optgroup
  6207. ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
  6208. ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
  6209. // Get the specific value for the option
  6210. value = jQuery( option ).val();
  6211. // We don't need an array for one selects
  6212. if ( one ) {
  6213. return value;
  6214. }
  6215. // Multi-Selects return an array
  6216. values.push( value );
  6217. }
  6218. }
  6219. return values;
  6220. },
  6221. set: function( elem, value ) {
  6222. var optionSet, option,
  6223. options = elem.options,
  6224. values = jQuery.makeArray( value ),
  6225. i = options.length;
  6226. while ( i-- ) {
  6227. option = options[ i ];
  6228. if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
  6229. optionSet = true;
  6230. }
  6231. }
  6232. // Force browsers to behave consistently when non-matching value is set
  6233. if ( !optionSet ) {
  6234. elem.selectedIndex = -1;
  6235. }
  6236. return values;
  6237. }
  6238. }
  6239. }
  6240. });
  6241. // Radios and checkboxes getter/setter
  6242. jQuery.each([ "radio", "checkbox" ], function() {
  6243. jQuery.valHooks[ this ] = {
  6244. set: function( elem, value ) {
  6245. if ( jQuery.isArray( value ) ) {
  6246. return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
  6247. }
  6248. }
  6249. };
  6250. if ( !support.checkOn ) {
  6251. jQuery.valHooks[ this ].get = function( elem ) {
  6252. return elem.getAttribute("value") === null ? "on" : elem.value;
  6253. };
  6254. }
  6255. });
  6256. // Return jQuery for attributes-only inclusion
  6257. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  6258. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  6259. "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
  6260. // Handle event binding
  6261. jQuery.fn[ name ] = function( data, fn ) {
  6262. return arguments.length > 0 ?
  6263. this.on( name, null, data, fn ) :
  6264. this.trigger( name );
  6265. };
  6266. });
  6267. jQuery.fn.extend({
  6268. hover: function( fnOver, fnOut ) {
  6269. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  6270. },
  6271. bind: function( types, data, fn ) {
  6272. return this.on( types, null, data, fn );
  6273. },
  6274. unbind: function( types, fn ) {
  6275. return this.off( types, null, fn );
  6276. },
  6277. delegate: function( selector, types, data, fn ) {
  6278. return this.on( types, selector, data, fn );
  6279. },
  6280. undelegate: function( selector, types, fn ) {
  6281. // ( namespace ) or ( selector, types [, fn] )
  6282. return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
  6283. }
  6284. });
  6285. var nonce = jQuery.now();
  6286. var rquery = (/\?/);
  6287. // Support: Android 2.3
  6288. // Workaround failure to string-cast null input
  6289. jQuery.parseJSON = function( data ) {
  6290. return JSON.parse( data + "" );
  6291. };
  6292. // Cross-browser xml parsing
  6293. jQuery.parseXML = function( data ) {
  6294. var xml, tmp;
  6295. if ( !data || typeof data !== "string" ) {
  6296. return null;
  6297. }
  6298. // Support: IE9
  6299. try {
  6300. tmp = new DOMParser();
  6301. xml = tmp.parseFromString( data, "text/xml" );
  6302. } catch ( e ) {
  6303. xml = undefined;
  6304. }
  6305. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  6306. jQuery.error( "Invalid XML: " + data );
  6307. }
  6308. return xml;
  6309. };
  6310. var
  6311. rhash = /#.*$/,
  6312. rts = /([?&])_=[^&]*/,
  6313. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6314. // #7653, #8125, #8152: local protocol detection
  6315. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6316. rnoContent = /^(?:GET|HEAD)$/,
  6317. rprotocol = /^\/\//,
  6318. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  6319. /* Prefilters
  6320. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6321. * 2) These are called:
  6322. * - BEFORE asking for a transport
  6323. * - AFTER param serialization (s.data is a string if s.processData is true)
  6324. * 3) key is the dataType
  6325. * 4) the catchall symbol "*" can be used
  6326. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6327. */
  6328. prefilters = {},
  6329. /* Transports bindings
  6330. * 1) key is the dataType
  6331. * 2) the catchall symbol "*" can be used
  6332. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6333. */
  6334. transports = {},
  6335. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6336. allTypes = "*/".concat( "*" ),
  6337. // Document location
  6338. ajaxLocation = window.location.href,
  6339. // Segment location into parts
  6340. ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
  6341. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6342. function addToPrefiltersOrTransports( structure ) {
  6343. // dataTypeExpression is optional and defaults to "*"
  6344. return function( dataTypeExpression, func ) {
  6345. if ( typeof dataTypeExpression !== "string" ) {
  6346. func = dataTypeExpression;
  6347. dataTypeExpression = "*";
  6348. }
  6349. var dataType,
  6350. i = 0,
  6351. dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
  6352. if ( jQuery.isFunction( func ) ) {
  6353. // For each dataType in the dataTypeExpression
  6354. while ( (dataType = dataTypes[i++]) ) {
  6355. // Prepend if requested
  6356. if ( dataType[0] === "+" ) {
  6357. dataType = dataType.slice( 1 ) || "*";
  6358. (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
  6359. // Otherwise append
  6360. } else {
  6361. (structure[ dataType ] = structure[ dataType ] || []).push( func );
  6362. }
  6363. }
  6364. }
  6365. };
  6366. }
  6367. // Base inspection function for prefilters and transports
  6368. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  6369. var inspected = {},
  6370. seekingTransport = ( structure === transports );
  6371. function inspect( dataType ) {
  6372. var selected;
  6373. inspected[ dataType ] = true;
  6374. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  6375. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  6376. if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  6377. options.dataTypes.unshift( dataTypeOrTransport );
  6378. inspect( dataTypeOrTransport );
  6379. return false;
  6380. } else if ( seekingTransport ) {
  6381. return !( selected = dataTypeOrTransport );
  6382. }
  6383. });
  6384. return selected;
  6385. }
  6386. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  6387. }
  6388. // A special extend for ajax options
  6389. // that takes "flat" options (not to be deep extended)
  6390. // Fixes #9887
  6391. function ajaxExtend( target, src ) {
  6392. var key, deep,
  6393. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  6394. for ( key in src ) {
  6395. if ( src[ key ] !== undefined ) {
  6396. ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
  6397. }
  6398. }
  6399. if ( deep ) {
  6400. jQuery.extend( true, target, deep );
  6401. }
  6402. return target;
  6403. }
  6404. /* Handles responses to an ajax request:
  6405. * - finds the right dataType (mediates between content-type and expected dataType)
  6406. * - returns the corresponding response
  6407. */
  6408. function ajaxHandleResponses( s, jqXHR, responses ) {
  6409. var ct, type, finalDataType, firstDataType,
  6410. contents = s.contents,
  6411. dataTypes = s.dataTypes;
  6412. // Remove auto dataType and get content-type in the process
  6413. while ( dataTypes[ 0 ] === "*" ) {
  6414. dataTypes.shift();
  6415. if ( ct === undefined ) {
  6416. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  6417. }
  6418. }
  6419. // Check if we're dealing with a known content-type
  6420. if ( ct ) {
  6421. for ( type in contents ) {
  6422. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  6423. dataTypes.unshift( type );
  6424. break;
  6425. }
  6426. }
  6427. }
  6428. // Check to see if we have a response for the expected dataType
  6429. if ( dataTypes[ 0 ] in responses ) {
  6430. finalDataType = dataTypes[ 0 ];
  6431. } else {
  6432. // Try convertible dataTypes
  6433. for ( type in responses ) {
  6434. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
  6435. finalDataType = type;
  6436. break;
  6437. }
  6438. if ( !firstDataType ) {
  6439. firstDataType = type;
  6440. }
  6441. }
  6442. // Or just use first one
  6443. finalDataType = finalDataType || firstDataType;
  6444. }
  6445. // If we found a dataType
  6446. // We add the dataType to the list if needed
  6447. // and return the corresponding response
  6448. if ( finalDataType ) {
  6449. if ( finalDataType !== dataTypes[ 0 ] ) {
  6450. dataTypes.unshift( finalDataType );
  6451. }
  6452. return responses[ finalDataType ];
  6453. }
  6454. }
  6455. /* Chain conversions given the request and the original response
  6456. * Also sets the responseXXX fields on the jqXHR instance
  6457. */
  6458. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  6459. var conv2, current, conv, tmp, prev,
  6460. converters = {},
  6461. // Work with a copy of dataTypes in case we need to modify it for conversion
  6462. dataTypes = s.dataTypes.slice();
  6463. // Create converters map with lowercased keys
  6464. if ( dataTypes[ 1 ] ) {
  6465. for ( conv in s.converters ) {
  6466. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  6467. }
  6468. }
  6469. current = dataTypes.shift();
  6470. // Convert to each sequential dataType
  6471. while ( current ) {
  6472. if ( s.responseFields[ current ] ) {
  6473. jqXHR[ s.responseFields[ current ] ] = response;
  6474. }
  6475. // Apply the dataFilter if provided
  6476. if ( !prev && isSuccess && s.dataFilter ) {
  6477. response = s.dataFilter( response, s.dataType );
  6478. }
  6479. prev = current;
  6480. current = dataTypes.shift();
  6481. if ( current ) {
  6482. // There's only work to do if current dataType is non-auto
  6483. if ( current === "*" ) {
  6484. current = prev;
  6485. // Convert response if prev dataType is non-auto and differs from current
  6486. } else if ( prev !== "*" && prev !== current ) {
  6487. // Seek a direct converter
  6488. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  6489. // If none found, seek a pair
  6490. if ( !conv ) {
  6491. for ( conv2 in converters ) {
  6492. // If conv2 outputs current
  6493. tmp = conv2.split( " " );
  6494. if ( tmp[ 1 ] === current ) {
  6495. // If prev can be converted to accepted input
  6496. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  6497. converters[ "* " + tmp[ 0 ] ];
  6498. if ( conv ) {
  6499. // Condense equivalence converters
  6500. if ( conv === true ) {
  6501. conv = converters[ conv2 ];
  6502. // Otherwise, insert the intermediate dataType
  6503. } else if ( converters[ conv2 ] !== true ) {
  6504. current = tmp[ 0 ];
  6505. dataTypes.unshift( tmp[ 1 ] );
  6506. }
  6507. break;
  6508. }
  6509. }
  6510. }
  6511. }
  6512. // Apply converter (if not an equivalence)
  6513. if ( conv !== true ) {
  6514. // Unless errors are allowed to bubble, catch and return them
  6515. if ( conv && s[ "throws" ] ) {
  6516. response = conv( response );
  6517. } else {
  6518. try {
  6519. response = conv( response );
  6520. } catch ( e ) {
  6521. return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
  6522. }
  6523. }
  6524. }
  6525. }
  6526. }
  6527. }
  6528. return { state: "success", data: response };
  6529. }
  6530. jQuery.extend({
  6531. // Counter for holding the number of active queries
  6532. active: 0,
  6533. // Last-Modified header cache for next request
  6534. lastModified: {},
  6535. etag: {},
  6536. ajaxSettings: {
  6537. url: ajaxLocation,
  6538. type: "GET",
  6539. isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
  6540. global: true,
  6541. processData: true,
  6542. async: true,
  6543. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  6544. /*
  6545. timeout: 0,
  6546. data: null,
  6547. dataType: null,
  6548. username: null,
  6549. password: null,
  6550. cache: null,
  6551. throws: false,
  6552. traditional: false,
  6553. headers: {},
  6554. */
  6555. accepts: {
  6556. "*": allTypes,
  6557. text: "text/plain",
  6558. html: "text/html",
  6559. xml: "application/xml, text/xml",
  6560. json: "application/json, text/javascript"
  6561. },
  6562. contents: {
  6563. xml: /xml/,
  6564. html: /html/,
  6565. json: /json/
  6566. },
  6567. responseFields: {
  6568. xml: "responseXML",
  6569. text: "responseText",
  6570. json: "responseJSON"
  6571. },
  6572. // Data converters
  6573. // Keys separate source (or catchall "*") and destination types with a single space
  6574. converters: {
  6575. // Convert anything to text
  6576. "* text": String,
  6577. // Text to html (true = no transformation)
  6578. "text html": true,
  6579. // Evaluate text as a json expression
  6580. "text json": jQuery.parseJSON,
  6581. // Parse text as xml
  6582. "text xml": jQuery.parseXML
  6583. },
  6584. // For options that shouldn't be deep extended:
  6585. // you can add your own custom options here if
  6586. // and when you create one that shouldn't be
  6587. // deep extended (see ajaxExtend)
  6588. flatOptions: {
  6589. url: true,
  6590. context: true
  6591. }
  6592. },
  6593. // Creates a full fledged settings object into target
  6594. // with both ajaxSettings and settings fields.
  6595. // If target is omitted, writes into ajaxSettings.
  6596. ajaxSetup: function( target, settings ) {
  6597. return settings ?
  6598. // Building a settings object
  6599. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  6600. // Extending ajaxSettings
  6601. ajaxExtend( jQuery.ajaxSettings, target );
  6602. },
  6603. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  6604. ajaxTransport: addToPrefiltersOrTransports( transports ),
  6605. // Main method
  6606. ajax: function( url, options ) {
  6607. // If url is an object, simulate pre-1.5 signature
  6608. if ( typeof url === "object" ) {
  6609. options = url;
  6610. url = undefined;
  6611. }
  6612. // Force options to be an object
  6613. options = options || {};
  6614. var transport,
  6615. // URL without anti-cache param
  6616. cacheURL,
  6617. // Response headers
  6618. responseHeadersString,
  6619. responseHeaders,
  6620. // timeout handle
  6621. timeoutTimer,
  6622. // Cross-domain detection vars
  6623. parts,
  6624. // To know if global events are to be dispatched
  6625. fireGlobals,
  6626. // Loop variable
  6627. i,
  6628. // Create the final options object
  6629. s = jQuery.ajaxSetup( {}, options ),
  6630. // Callbacks context
  6631. callbackContext = s.context || s,
  6632. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  6633. globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
  6634. jQuery( callbackContext ) :
  6635. jQuery.event,
  6636. // Deferreds
  6637. deferred = jQuery.Deferred(),
  6638. completeDeferred = jQuery.Callbacks("once memory"),
  6639. // Status-dependent callbacks
  6640. statusCode = s.statusCode || {},
  6641. // Headers (they are sent all at once)
  6642. requestHeaders = {},
  6643. requestHeadersNames = {},
  6644. // The jqXHR state
  6645. state = 0,
  6646. // Default abort message
  6647. strAbort = "canceled",
  6648. // Fake xhr
  6649. jqXHR = {
  6650. readyState: 0,
  6651. // Builds headers hashtable if needed
  6652. getResponseHeader: function( key ) {
  6653. var match;
  6654. if ( state === 2 ) {
  6655. if ( !responseHeaders ) {
  6656. responseHeaders = {};
  6657. while ( (match = rheaders.exec( responseHeadersString )) ) {
  6658. responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
  6659. }
  6660. }
  6661. match = responseHeaders[ key.toLowerCase() ];
  6662. }
  6663. return match == null ? null : match;
  6664. },
  6665. // Raw string
  6666. getAllResponseHeaders: function() {
  6667. return state === 2 ? responseHeadersString : null;
  6668. },
  6669. // Caches the header
  6670. setRequestHeader: function( name, value ) {
  6671. var lname = name.toLowerCase();
  6672. if ( !state ) {
  6673. name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
  6674. requestHeaders[ name ] = value;
  6675. }
  6676. return this;
  6677. },
  6678. // Overrides response content-type header
  6679. overrideMimeType: function( type ) {
  6680. if ( !state ) {
  6681. s.mimeType = type;
  6682. }
  6683. return this;
  6684. },
  6685. // Status-dependent callbacks
  6686. statusCode: function( map ) {
  6687. var code;
  6688. if ( map ) {
  6689. if ( state < 2 ) {
  6690. for ( code in map ) {
  6691. // Lazy-add the new callback in a way that preserves old ones
  6692. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  6693. }
  6694. } else {
  6695. // Execute the appropriate callbacks
  6696. jqXHR.always( map[ jqXHR.status ] );
  6697. }
  6698. }
  6699. return this;
  6700. },
  6701. // Cancel the request
  6702. abort: function( statusText ) {
  6703. var finalText = statusText || strAbort;
  6704. if ( transport ) {
  6705. transport.abort( finalText );
  6706. }
  6707. done( 0, finalText );
  6708. return this;
  6709. }
  6710. };
  6711. // Attach deferreds
  6712. deferred.promise( jqXHR ).complete = completeDeferred.add;
  6713. jqXHR.success = jqXHR.done;
  6714. jqXHR.error = jqXHR.fail;
  6715. // Remove hash character (#7531: and string promotion)
  6716. // Add protocol if not provided (prefilters might expect it)
  6717. // Handle falsy url in the settings object (#10093: consistency with old signature)
  6718. // We also use the url parameter if available
  6719. s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
  6720. .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
  6721. // Alias method option to type as per ticket #12004
  6722. s.type = options.method || options.type || s.method || s.type;
  6723. // Extract dataTypes list
  6724. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
  6725. // A cross-domain request is in order when we have a protocol:host:port mismatch
  6726. if ( s.crossDomain == null ) {
  6727. parts = rurl.exec( s.url.toLowerCase() );
  6728. s.crossDomain = !!( parts &&
  6729. ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
  6730. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
  6731. ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
  6732. );
  6733. }
  6734. // Convert data if not already a string
  6735. if ( s.data && s.processData && typeof s.data !== "string" ) {
  6736. s.data = jQuery.param( s.data, s.traditional );
  6737. }
  6738. // Apply prefilters
  6739. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  6740. // If request was aborted inside a prefilter, stop there
  6741. if ( state === 2 ) {
  6742. return jqXHR;
  6743. }
  6744. // We can fire global events as of now if asked to
  6745. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  6746. fireGlobals = jQuery.event && s.global;
  6747. // Watch for a new set of requests
  6748. if ( fireGlobals && jQuery.active++ === 0 ) {
  6749. jQuery.event.trigger("ajaxStart");
  6750. }
  6751. // Uppercase the type
  6752. s.type = s.type.toUpperCase();
  6753. // Determine if request has content
  6754. s.hasContent = !rnoContent.test( s.type );
  6755. // Save the URL in case we're toying with the If-Modified-Since
  6756. // and/or If-None-Match header later on
  6757. cacheURL = s.url;
  6758. // More options handling for requests with no content
  6759. if ( !s.hasContent ) {
  6760. // If data is available, append data to url
  6761. if ( s.data ) {
  6762. cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
  6763. // #9682: remove data so that it's not used in an eventual retry
  6764. delete s.data;
  6765. }
  6766. // Add anti-cache in url if needed
  6767. if ( s.cache === false ) {
  6768. s.url = rts.test( cacheURL ) ?
  6769. // If there is already a '_' parameter, set its value
  6770. cacheURL.replace( rts, "$1_=" + nonce++ ) :
  6771. // Otherwise add one to the end
  6772. cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
  6773. }
  6774. }
  6775. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  6776. if ( s.ifModified ) {
  6777. if ( jQuery.lastModified[ cacheURL ] ) {
  6778. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  6779. }
  6780. if ( jQuery.etag[ cacheURL ] ) {
  6781. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  6782. }
  6783. }
  6784. // Set the correct header, if data is being sent
  6785. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  6786. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  6787. }
  6788. // Set the Accepts header for the server, depending on the dataType
  6789. jqXHR.setRequestHeader(
  6790. "Accept",
  6791. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
  6792. s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  6793. s.accepts[ "*" ]
  6794. );
  6795. // Check for headers option
  6796. for ( i in s.headers ) {
  6797. jqXHR.setRequestHeader( i, s.headers[ i ] );
  6798. }
  6799. // Allow custom headers/mimetypes and early abort
  6800. if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
  6801. // Abort if not done already and return
  6802. return jqXHR.abort();
  6803. }
  6804. // Aborting is no longer a cancellation
  6805. strAbort = "abort";
  6806. // Install callbacks on deferreds
  6807. for ( i in { success: 1, error: 1, complete: 1 } ) {
  6808. jqXHR[ i ]( s[ i ] );
  6809. }
  6810. // Get transport
  6811. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  6812. // If no transport, we auto-abort
  6813. if ( !transport ) {
  6814. done( -1, "No Transport" );
  6815. } else {
  6816. jqXHR.readyState = 1;
  6817. // Send global event
  6818. if ( fireGlobals ) {
  6819. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  6820. }
  6821. // Timeout
  6822. if ( s.async && s.timeout > 0 ) {
  6823. timeoutTimer = setTimeout(function() {
  6824. jqXHR.abort("timeout");
  6825. }, s.timeout );
  6826. }
  6827. try {
  6828. state = 1;
  6829. transport.send( requestHeaders, done );
  6830. } catch ( e ) {
  6831. // Propagate exception as error if not done
  6832. if ( state < 2 ) {
  6833. done( -1, e );
  6834. // Simply rethrow otherwise
  6835. } else {
  6836. throw e;
  6837. }
  6838. }
  6839. }
  6840. // Callback for when everything is done
  6841. function done( status, nativeStatusText, responses, headers ) {
  6842. var isSuccess, success, error, response, modified,
  6843. statusText = nativeStatusText;
  6844. // Called once
  6845. if ( state === 2 ) {
  6846. return;
  6847. }
  6848. // State is "done" now
  6849. state = 2;
  6850. // Clear timeout if it exists
  6851. if ( timeoutTimer ) {
  6852. clearTimeout( timeoutTimer );
  6853. }
  6854. // Dereference transport for early garbage collection
  6855. // (no matter how long the jqXHR object will be used)
  6856. transport = undefined;
  6857. // Cache response headers
  6858. responseHeadersString = headers || "";
  6859. // Set readyState
  6860. jqXHR.readyState = status > 0 ? 4 : 0;
  6861. // Determine if successful
  6862. isSuccess = status >= 200 && status < 300 || status === 304;
  6863. // Get response data
  6864. if ( responses ) {
  6865. response = ajaxHandleResponses( s, jqXHR, responses );
  6866. }
  6867. // Convert no matter what (that way responseXXX fields are always set)
  6868. response = ajaxConvert( s, response, jqXHR, isSuccess );
  6869. // If successful, handle type chaining
  6870. if ( isSuccess ) {
  6871. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  6872. if ( s.ifModified ) {
  6873. modified = jqXHR.getResponseHeader("Last-Modified");
  6874. if ( modified ) {
  6875. jQuery.lastModified[ cacheURL ] = modified;
  6876. }
  6877. modified = jqXHR.getResponseHeader("etag");
  6878. if ( modified ) {
  6879. jQuery.etag[ cacheURL ] = modified;
  6880. }
  6881. }
  6882. // if no content
  6883. if ( status === 204 || s.type === "HEAD" ) {
  6884. statusText = "nocontent";
  6885. // if not modified
  6886. } else if ( status === 304 ) {
  6887. statusText = "notmodified";
  6888. // If we have data, let's convert it
  6889. } else {
  6890. statusText = response.state;
  6891. success = response.data;
  6892. error = response.error;
  6893. isSuccess = !error;
  6894. }
  6895. } else {
  6896. // Extract error from statusText and normalize for non-aborts
  6897. error = statusText;
  6898. if ( status || !statusText ) {
  6899. statusText = "error";
  6900. if ( status < 0 ) {
  6901. status = 0;
  6902. }
  6903. }
  6904. }
  6905. // Set data for the fake xhr object
  6906. jqXHR.status = status;
  6907. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  6908. // Success/Error
  6909. if ( isSuccess ) {
  6910. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  6911. } else {
  6912. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  6913. }
  6914. // Status-dependent callbacks
  6915. jqXHR.statusCode( statusCode );
  6916. statusCode = undefined;
  6917. if ( fireGlobals ) {
  6918. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  6919. [ jqXHR, s, isSuccess ? success : error ] );
  6920. }
  6921. // Complete
  6922. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  6923. if ( fireGlobals ) {
  6924. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  6925. // Handle the global AJAX counter
  6926. if ( !( --jQuery.active ) ) {
  6927. jQuery.event.trigger("ajaxStop");
  6928. }
  6929. }
  6930. }
  6931. return jqXHR;
  6932. },
  6933. getJSON: function( url, data, callback ) {
  6934. return jQuery.get( url, data, callback, "json" );
  6935. },
  6936. getScript: function( url, callback ) {
  6937. return jQuery.get( url, undefined, callback, "script" );
  6938. }
  6939. });
  6940. jQuery.each( [ "get", "post" ], function( i, method ) {
  6941. jQuery[ method ] = function( url, data, callback, type ) {
  6942. // Shift arguments if data argument was omitted
  6943. if ( jQuery.isFunction( data ) ) {
  6944. type = type || callback;
  6945. callback = data;
  6946. data = undefined;
  6947. }
  6948. return jQuery.ajax({
  6949. url: url,
  6950. type: method,
  6951. dataType: type,
  6952. data: data,
  6953. success: callback
  6954. });
  6955. };
  6956. });
  6957. jQuery._evalUrl = function( url ) {
  6958. return jQuery.ajax({
  6959. url: url,
  6960. type: "GET",
  6961. dataType: "script",
  6962. async: false,
  6963. global: false,
  6964. "throws": true
  6965. });
  6966. };
  6967. jQuery.fn.extend({
  6968. wrapAll: function( html ) {
  6969. var wrap;
  6970. if ( jQuery.isFunction( html ) ) {
  6971. return this.each(function( i ) {
  6972. jQuery( this ).wrapAll( html.call(this, i) );
  6973. });
  6974. }
  6975. if ( this[ 0 ] ) {
  6976. // The elements to wrap the target around
  6977. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  6978. if ( this[ 0 ].parentNode ) {
  6979. wrap.insertBefore( this[ 0 ] );
  6980. }
  6981. wrap.map(function() {
  6982. var elem = this;
  6983. while ( elem.firstElementChild ) {
  6984. elem = elem.firstElementChild;
  6985. }
  6986. return elem;
  6987. }).append( this );
  6988. }
  6989. return this;
  6990. },
  6991. wrapInner: function( html ) {
  6992. if ( jQuery.isFunction( html ) ) {
  6993. return this.each(function( i ) {
  6994. jQuery( this ).wrapInner( html.call(this, i) );
  6995. });
  6996. }
  6997. return this.each(function() {
  6998. var self = jQuery( this ),
  6999. contents = self.contents();
  7000. if ( contents.length ) {
  7001. contents.wrapAll( html );
  7002. } else {
  7003. self.append( html );
  7004. }
  7005. });
  7006. },
  7007. wrap: function( html ) {
  7008. var isFunction = jQuery.isFunction( html );
  7009. return this.each(function( i ) {
  7010. jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
  7011. });
  7012. },
  7013. unwrap: function() {
  7014. return this.parent().each(function() {
  7015. if ( !jQuery.nodeName( this, "body" ) ) {
  7016. jQuery( this ).replaceWith( this.childNodes );
  7017. }
  7018. }).end();
  7019. }
  7020. });
  7021. jQuery.expr.filters.hidden = function( elem ) {
  7022. // Support: Opera <= 12.12
  7023. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  7024. return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
  7025. };
  7026. jQuery.expr.filters.visible = function( elem ) {
  7027. return !jQuery.expr.filters.hidden( elem );
  7028. };
  7029. var r20 = /%20/g,
  7030. rbracket = /\[\]$/,
  7031. rCRLF = /\r?\n/g,
  7032. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  7033. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7034. function buildParams( prefix, obj, traditional, add ) {
  7035. var name;
  7036. if ( jQuery.isArray( obj ) ) {
  7037. // Serialize array item.
  7038. jQuery.each( obj, function( i, v ) {
  7039. if ( traditional || rbracket.test( prefix ) ) {
  7040. // Treat each array item as a scalar.
  7041. add( prefix, v );
  7042. } else {
  7043. // Item is non-scalar (array or object), encode its numeric index.
  7044. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
  7045. }
  7046. });
  7047. } else if ( !traditional && jQuery.type( obj ) === "object" ) {
  7048. // Serialize object item.
  7049. for ( name in obj ) {
  7050. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  7051. }
  7052. } else {
  7053. // Serialize scalar item.
  7054. add( prefix, obj );
  7055. }
  7056. }
  7057. // Serialize an array of form elements or a set of
  7058. // key/values into a query string
  7059. jQuery.param = function( a, traditional ) {
  7060. var prefix,
  7061. s = [],
  7062. add = function( key, value ) {
  7063. // If value is a function, invoke it and return its value
  7064. value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
  7065. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  7066. };
  7067. // Set traditional to true for jQuery <= 1.3.2 behavior.
  7068. if ( traditional === undefined ) {
  7069. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  7070. }
  7071. // If an array was passed in, assume that it is an array of form elements.
  7072. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  7073. // Serialize the form elements
  7074. jQuery.each( a, function() {
  7075. add( this.name, this.value );
  7076. });
  7077. } else {
  7078. // If traditional, encode the "old" way (the way 1.3.2 or older
  7079. // did it), otherwise encode params recursively.
  7080. for ( prefix in a ) {
  7081. buildParams( prefix, a[ prefix ], traditional, add );
  7082. }
  7083. }
  7084. // Return the resulting serialization
  7085. return s.join( "&" ).replace( r20, "+" );
  7086. };
  7087. jQuery.fn.extend({
  7088. serialize: function() {
  7089. return jQuery.param( this.serializeArray() );
  7090. },
  7091. serializeArray: function() {
  7092. return this.map(function() {
  7093. // Can add propHook for "elements" to filter or add form elements
  7094. var elements = jQuery.prop( this, "elements" );
  7095. return elements ? jQuery.makeArray( elements ) : this;
  7096. })
  7097. .filter(function() {
  7098. var type = this.type;
  7099. // Use .is( ":disabled" ) so that fieldset[disabled] works
  7100. return this.name && !jQuery( this ).is( ":disabled" ) &&
  7101. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  7102. ( this.checked || !rcheckableType.test( type ) );
  7103. })
  7104. .map(function( i, elem ) {
  7105. var val = jQuery( this ).val();
  7106. return val == null ?
  7107. null :
  7108. jQuery.isArray( val ) ?
  7109. jQuery.map( val, function( val ) {
  7110. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7111. }) :
  7112. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  7113. }).get();
  7114. }
  7115. });
  7116. jQuery.ajaxSettings.xhr = function() {
  7117. try {
  7118. return new XMLHttpRequest();
  7119. } catch( e ) {}
  7120. };
  7121. var xhrId = 0,
  7122. xhrCallbacks = {},
  7123. xhrSuccessStatus = {
  7124. // file protocol always yields status code 0, assume 200
  7125. 0: 200,
  7126. // Support: IE9
  7127. // #1450: sometimes IE returns 1223 when it should be 204
  7128. 1223: 204
  7129. },
  7130. xhrSupported = jQuery.ajaxSettings.xhr();
  7131. // Support: IE9
  7132. // Open requests must be manually aborted on unload (#5280)
  7133. // See https://support.microsoft.com/kb/2856746 for more info
  7134. if ( window.attachEvent ) {
  7135. window.attachEvent( "onunload", function() {
  7136. for ( var key in xhrCallbacks ) {
  7137. xhrCallbacks[ key ]();
  7138. }
  7139. });
  7140. }
  7141. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  7142. support.ajax = xhrSupported = !!xhrSupported;
  7143. jQuery.ajaxTransport(function( options ) {
  7144. var callback;
  7145. // Cross domain only allowed if supported through XMLHttpRequest
  7146. if ( support.cors || xhrSupported && !options.crossDomain ) {
  7147. return {
  7148. send: function( headers, complete ) {
  7149. var i,
  7150. xhr = options.xhr(),
  7151. id = ++xhrId;
  7152. xhr.open( options.type, options.url, options.async, options.username, options.password );
  7153. // Apply custom fields if provided
  7154. if ( options.xhrFields ) {
  7155. for ( i in options.xhrFields ) {
  7156. xhr[ i ] = options.xhrFields[ i ];
  7157. }
  7158. }
  7159. // Override mime type if needed
  7160. if ( options.mimeType && xhr.overrideMimeType ) {
  7161. xhr.overrideMimeType( options.mimeType );
  7162. }
  7163. // X-Requested-With header
  7164. // For cross-domain requests, seeing as conditions for a preflight are
  7165. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7166. // (it can always be set on a per-request basis or even using ajaxSetup)
  7167. // For same-domain requests, won't change header if already provided.
  7168. if ( !options.crossDomain && !headers["X-Requested-With"] ) {
  7169. headers["X-Requested-With"] = "XMLHttpRequest";
  7170. }
  7171. // Set headers
  7172. for ( i in headers ) {
  7173. xhr.setRequestHeader( i, headers[ i ] );
  7174. }
  7175. // Callback
  7176. callback = function( type ) {
  7177. return function() {
  7178. if ( callback ) {
  7179. delete xhrCallbacks[ id ];
  7180. callback = xhr.onload = xhr.onerror = null;
  7181. if ( type === "abort" ) {
  7182. xhr.abort();
  7183. } else if ( type === "error" ) {
  7184. complete(
  7185. // file: protocol always yields status 0; see #8605, #14207
  7186. xhr.status,
  7187. xhr.statusText
  7188. );
  7189. } else {
  7190. complete(
  7191. xhrSuccessStatus[ xhr.status ] || xhr.status,
  7192. xhr.statusText,
  7193. // Support: IE9
  7194. // Accessing binary-data responseText throws an exception
  7195. // (#11426)
  7196. typeof xhr.responseText === "string" ? {
  7197. text: xhr.responseText
  7198. } : undefined,
  7199. xhr.getAllResponseHeaders()
  7200. );
  7201. }
  7202. }
  7203. };
  7204. };
  7205. // Listen to events
  7206. xhr.onload = callback();
  7207. xhr.onerror = callback("error");
  7208. // Create the abort callback
  7209. callback = xhrCallbacks[ id ] = callback("abort");
  7210. try {
  7211. // Do send the request (this may raise an exception)
  7212. xhr.send( options.hasContent && options.data || null );
  7213. } catch ( e ) {
  7214. // #14683: Only rethrow if this hasn't been notified as an error yet
  7215. if ( callback ) {
  7216. throw e;
  7217. }
  7218. }
  7219. },
  7220. abort: function() {
  7221. if ( callback ) {
  7222. callback();
  7223. }
  7224. }
  7225. };
  7226. }
  7227. });
  7228. // Install script dataType
  7229. jQuery.ajaxSetup({
  7230. accepts: {
  7231. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  7232. },
  7233. contents: {
  7234. script: /(?:java|ecma)script/
  7235. },
  7236. converters: {
  7237. "text script": function( text ) {
  7238. jQuery.globalEval( text );
  7239. return text;
  7240. }
  7241. }
  7242. });
  7243. // Handle cache's special case and crossDomain
  7244. jQuery.ajaxPrefilter( "script", function( s ) {
  7245. if ( s.cache === undefined ) {
  7246. s.cache = false;
  7247. }
  7248. if ( s.crossDomain ) {
  7249. s.type = "GET";
  7250. }
  7251. });
  7252. // Bind script tag hack transport
  7253. jQuery.ajaxTransport( "script", function( s ) {
  7254. // This transport only deals with cross domain requests
  7255. if ( s.crossDomain ) {
  7256. var script, callback;
  7257. return {
  7258. send: function( _, complete ) {
  7259. script = jQuery("<script>").prop({
  7260. async: true,
  7261. charset: s.scriptCharset,
  7262. src: s.url
  7263. }).on(
  7264. "load error",
  7265. callback = function( evt ) {
  7266. script.remove();
  7267. callback = null;
  7268. if ( evt ) {
  7269. complete( evt.type === "error" ? 404 : 200, evt.type );
  7270. }
  7271. }
  7272. );
  7273. document.head.appendChild( script[ 0 ] );
  7274. },
  7275. abort: function() {
  7276. if ( callback ) {
  7277. callback();
  7278. }
  7279. }
  7280. };
  7281. }
  7282. });
  7283. var oldCallbacks = [],
  7284. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7285. // Default jsonp settings
  7286. jQuery.ajaxSetup({
  7287. jsonp: "callback",
  7288. jsonpCallback: function() {
  7289. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  7290. this[ callback ] = true;
  7291. return callback;
  7292. }
  7293. });
  7294. // Detect, normalize options and install callbacks for jsonp requests
  7295. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  7296. var callbackName, overwritten, responseContainer,
  7297. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  7298. "url" :
  7299. typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
  7300. );
  7301. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7302. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  7303. // Get callback name, remembering preexisting value associated with it
  7304. callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
  7305. s.jsonpCallback() :
  7306. s.jsonpCallback;
  7307. // Insert callback into url or form data
  7308. if ( jsonProp ) {
  7309. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  7310. } else if ( s.jsonp !== false ) {
  7311. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  7312. }
  7313. // Use data converter to retrieve json after script execution
  7314. s.converters["script json"] = function() {
  7315. if ( !responseContainer ) {
  7316. jQuery.error( callbackName + " was not called" );
  7317. }
  7318. return responseContainer[ 0 ];
  7319. };
  7320. // force json dataType
  7321. s.dataTypes[ 0 ] = "json";
  7322. // Install callback
  7323. overwritten = window[ callbackName ];
  7324. window[ callbackName ] = function() {
  7325. responseContainer = arguments;
  7326. };
  7327. // Clean-up function (fires after converters)
  7328. jqXHR.always(function() {
  7329. // Restore preexisting value
  7330. window[ callbackName ] = overwritten;
  7331. // Save back as free
  7332. if ( s[ callbackName ] ) {
  7333. // make sure that re-using the options doesn't screw things around
  7334. s.jsonpCallback = originalSettings.jsonpCallback;
  7335. // save the callback name for future use
  7336. oldCallbacks.push( callbackName );
  7337. }
  7338. // Call if it was a function and we have a response
  7339. if ( responseContainer && jQuery.isFunction( overwritten ) ) {
  7340. overwritten( responseContainer[ 0 ] );
  7341. }
  7342. responseContainer = overwritten = undefined;
  7343. });
  7344. // Delegate to script
  7345. return "script";
  7346. }
  7347. });
  7348. // data: string of html
  7349. // context (optional): If specified, the fragment will be created in this context, defaults to document
  7350. // keepScripts (optional): If true, will include scripts passed in the html string
  7351. jQuery.parseHTML = function( data, context, keepScripts ) {
  7352. if ( !data || typeof data !== "string" ) {
  7353. return null;
  7354. }
  7355. if ( typeof context === "boolean" ) {
  7356. keepScripts = context;
  7357. context = false;
  7358. }
  7359. context = context || document;
  7360. var parsed = rsingleTag.exec( data ),
  7361. scripts = !keepScripts && [];
  7362. // Single tag
  7363. if ( parsed ) {
  7364. return [ context.createElement( parsed[1] ) ];
  7365. }
  7366. parsed = jQuery.buildFragment( [ data ], context, scripts );
  7367. if ( scripts && scripts.length ) {
  7368. jQuery( scripts ).remove();
  7369. }
  7370. return jQuery.merge( [], parsed.childNodes );
  7371. };
  7372. // Keep a copy of the old load method
  7373. var _load = jQuery.fn.load;
  7374. /**
  7375. * Load a url into a page
  7376. */
  7377. jQuery.fn.load = function( url, params, callback ) {
  7378. if ( typeof url !== "string" && _load ) {
  7379. return _load.apply( this, arguments );
  7380. }
  7381. var selector, type, response,
  7382. self = this,
  7383. off = url.indexOf(" ");
  7384. if ( off >= 0 ) {
  7385. selector = jQuery.trim( url.slice( off ) );
  7386. url = url.slice( 0, off );
  7387. }
  7388. // If it's a function
  7389. if ( jQuery.isFunction( params ) ) {
  7390. // We assume that it's the callback
  7391. callback = params;
  7392. params = undefined;
  7393. // Otherwise, build a param string
  7394. } else if ( params && typeof params === "object" ) {
  7395. type = "POST";
  7396. }
  7397. // If we have elements to modify, make the request
  7398. if ( self.length > 0 ) {
  7399. jQuery.ajax({
  7400. url: url,
  7401. // if "type" variable is undefined, then "GET" method will be used
  7402. type: type,
  7403. dataType: "html",
  7404. data: params
  7405. }).done(function( responseText ) {
  7406. // Save response for use in complete callback
  7407. response = arguments;
  7408. self.html( selector ?
  7409. // If a selector was specified, locate the right elements in a dummy div
  7410. // Exclude scripts to avoid IE 'Permission Denied' errors
  7411. jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
  7412. // Otherwise use the full result
  7413. responseText );
  7414. }).complete( callback && function( jqXHR, status ) {
  7415. self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
  7416. });
  7417. }
  7418. return this;
  7419. };
  7420. // Attach a bunch of functions for handling common AJAX events
  7421. jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
  7422. jQuery.fn[ type ] = function( fn ) {
  7423. return this.on( type, fn );
  7424. };
  7425. });
  7426. jQuery.expr.filters.animated = function( elem ) {
  7427. return jQuery.grep(jQuery.timers, function( fn ) {
  7428. return elem === fn.elem;
  7429. }).length;
  7430. };
  7431. var docElem = window.document.documentElement;
  7432. /**
  7433. * Gets a window from an element
  7434. */
  7435. function getWindow( elem ) {
  7436. return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
  7437. }
  7438. jQuery.offset = {
  7439. setOffset: function( elem, options, i ) {
  7440. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  7441. position = jQuery.css( elem, "position" ),
  7442. curElem = jQuery( elem ),
  7443. props = {};
  7444. // Set position first, in-case top/left are set even on static elem
  7445. if ( position === "static" ) {
  7446. elem.style.position = "relative";
  7447. }
  7448. curOffset = curElem.offset();
  7449. curCSSTop = jQuery.css( elem, "top" );
  7450. curCSSLeft = jQuery.css( elem, "left" );
  7451. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  7452. ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
  7453. // Need to be able to calculate position if either
  7454. // top or left is auto and position is either absolute or fixed
  7455. if ( calculatePosition ) {
  7456. curPosition = curElem.position();
  7457. curTop = curPosition.top;
  7458. curLeft = curPosition.left;
  7459. } else {
  7460. curTop = parseFloat( curCSSTop ) || 0;
  7461. curLeft = parseFloat( curCSSLeft ) || 0;
  7462. }
  7463. if ( jQuery.isFunction( options ) ) {
  7464. options = options.call( elem, i, curOffset );
  7465. }
  7466. if ( options.top != null ) {
  7467. props.top = ( options.top - curOffset.top ) + curTop;
  7468. }
  7469. if ( options.left != null ) {
  7470. props.left = ( options.left - curOffset.left ) + curLeft;
  7471. }
  7472. if ( "using" in options ) {
  7473. options.using.call( elem, props );
  7474. } else {
  7475. curElem.css( props );
  7476. }
  7477. }
  7478. };
  7479. jQuery.fn.extend({
  7480. offset: function( options ) {
  7481. if ( arguments.length ) {
  7482. return options === undefined ?
  7483. this :
  7484. this.each(function( i ) {
  7485. jQuery.offset.setOffset( this, options, i );
  7486. });
  7487. }
  7488. var docElem, win,
  7489. elem = this[ 0 ],
  7490. box = { top: 0, left: 0 },
  7491. doc = elem && elem.ownerDocument;
  7492. if ( !doc ) {
  7493. return;
  7494. }
  7495. docElem = doc.documentElement;
  7496. // Make sure it's not a disconnected DOM node
  7497. if ( !jQuery.contains( docElem, elem ) ) {
  7498. return box;
  7499. }
  7500. // Support: BlackBerry 5, iOS 3 (original iPhone)
  7501. // If we don't have gBCR, just use 0,0 rather than error
  7502. if ( typeof elem.getBoundingClientRect !== strundefined ) {
  7503. box = elem.getBoundingClientRect();
  7504. }
  7505. win = getWindow( doc );
  7506. return {
  7507. top: box.top + win.pageYOffset - docElem.clientTop,
  7508. left: box.left + win.pageXOffset - docElem.clientLeft
  7509. };
  7510. },
  7511. position: function() {
  7512. if ( !this[ 0 ] ) {
  7513. return;
  7514. }
  7515. var offsetParent, offset,
  7516. elem = this[ 0 ],
  7517. parentOffset = { top: 0, left: 0 };
  7518. // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
  7519. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  7520. // Assume getBoundingClientRect is there when computed position is fixed
  7521. offset = elem.getBoundingClientRect();
  7522. } else {
  7523. // Get *real* offsetParent
  7524. offsetParent = this.offsetParent();
  7525. // Get correct offsets
  7526. offset = this.offset();
  7527. if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
  7528. parentOffset = offsetParent.offset();
  7529. }
  7530. // Add offsetParent borders
  7531. parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
  7532. parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
  7533. }
  7534. // Subtract parent offsets and element margins
  7535. return {
  7536. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  7537. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  7538. };
  7539. },
  7540. offsetParent: function() {
  7541. return this.map(function() {
  7542. var offsetParent = this.offsetParent || docElem;
  7543. while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
  7544. offsetParent = offsetParent.offsetParent;
  7545. }
  7546. return offsetParent || docElem;
  7547. });
  7548. }
  7549. });
  7550. // Create scrollLeft and scrollTop methods
  7551. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  7552. var top = "pageYOffset" === prop;
  7553. jQuery.fn[ method ] = function( val ) {
  7554. return access( this, function( elem, method, val ) {
  7555. var win = getWindow( elem );
  7556. if ( val === undefined ) {
  7557. return win ? win[ prop ] : elem[ method ];
  7558. }
  7559. if ( win ) {
  7560. win.scrollTo(
  7561. !top ? val : window.pageXOffset,
  7562. top ? val : window.pageYOffset
  7563. );
  7564. } else {
  7565. elem[ method ] = val;
  7566. }
  7567. }, method, val, arguments.length, null );
  7568. };
  7569. });
  7570. // Support: Safari<7+, Chrome<37+
  7571. // Add the top/left cssHooks using jQuery.fn.position
  7572. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  7573. // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
  7574. // getComputedStyle returns percent when specified for top/left/bottom/right;
  7575. // rather than make the css module depend on the offset module, just check for it here
  7576. jQuery.each( [ "top", "left" ], function( i, prop ) {
  7577. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  7578. function( elem, computed ) {
  7579. if ( computed ) {
  7580. computed = curCSS( elem, prop );
  7581. // If curCSS returns percentage, fallback to offset
  7582. return rnumnonpx.test( computed ) ?
  7583. jQuery( elem ).position()[ prop ] + "px" :
  7584. computed;
  7585. }
  7586. }
  7587. );
  7588. });
  7589. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  7590. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  7591. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
  7592. // Margin is only for outerHeight, outerWidth
  7593. jQuery.fn[ funcName ] = function( margin, value ) {
  7594. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  7595. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  7596. return access( this, function( elem, type, value ) {
  7597. var doc;
  7598. if ( jQuery.isWindow( elem ) ) {
  7599. // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
  7600. // isn't a whole lot we can do. See pull request at this URL for discussion:
  7601. // https://github.com/jquery/jquery/pull/764
  7602. return elem.document.documentElement[ "client" + name ];
  7603. }
  7604. // Get document width or height
  7605. if ( elem.nodeType === 9 ) {
  7606. doc = elem.documentElement;
  7607. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  7608. // whichever is greatest
  7609. return Math.max(
  7610. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  7611. elem.body[ "offset" + name ], doc[ "offset" + name ],
  7612. doc[ "client" + name ]
  7613. );
  7614. }
  7615. return value === undefined ?
  7616. // Get width or height on the element, requesting but not forcing parseFloat
  7617. jQuery.css( elem, type, extra ) :
  7618. // Set width or height on the element
  7619. jQuery.style( elem, type, value, extra );
  7620. }, type, chainable ? margin : undefined, chainable, null );
  7621. };
  7622. });
  7623. });
  7624. // The number of elements contained in the matched element set
  7625. jQuery.fn.size = function() {
  7626. return this.length;
  7627. };
  7628. jQuery.fn.andSelf = jQuery.fn.addBack;
  7629. // Register as a named AMD module, since jQuery can be concatenated with other
  7630. // files that may use define, but not via a proper concatenation script that
  7631. // understands anonymous AMD modules. A named AMD is safest and most robust
  7632. // way to register. Lowercase jquery is used because AMD module names are
  7633. // derived from file names, and jQuery is normally delivered in a lowercase
  7634. // file name. Do this after creating the global so that if an AMD module wants
  7635. // to call noConflict to hide this version of jQuery, it will work.
  7636. // Note that for maximum portability, libraries that are not jQuery should
  7637. // declare themselves as anonymous modules, and avoid setting a global if an
  7638. // AMD loader is present. jQuery is a special case. For more information, see
  7639. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  7640. if ( typeof define === "function" && define.amd ) {
  7641. define( "jquery", [], function() {
  7642. return jQuery;
  7643. });
  7644. }
  7645. var
  7646. // Map over jQuery in case of overwrite
  7647. _jQuery = window.jQuery,
  7648. // Map over the $ in case of overwrite
  7649. _$ = window.$;
  7650. jQuery.noConflict = function( deep ) {
  7651. if ( window.$ === jQuery ) {
  7652. window.$ = _$;
  7653. }
  7654. if ( deep && window.jQuery === jQuery ) {
  7655. window.jQuery = _jQuery;
  7656. }
  7657. return jQuery;
  7658. };
  7659. // Expose jQuery and $ identifiers, even in AMD
  7660. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  7661. // and CommonJS for browser emulators (#13566)
  7662. if ( typeof noGlobal === strundefined ) {
  7663. window.jQuery = window.$ = jQuery;
  7664. }
  7665. return jQuery;
  7666. }));
  7667. },{}],3:[function(require,module,exports){
  7668. ;(function(exports) {
  7669. // export the class if we are in a Node-like system.
  7670. if (typeof module === 'object' && module.exports === exports)
  7671. exports = module.exports = SemVer;
  7672. // The debug function is excluded entirely from the minified version.
  7673. // Note: this is the semver.org version of the spec that it implements
  7674. // Not necessarily the package version of this code.
  7675. exports.SEMVER_SPEC_VERSION = '2.0.0';
  7676. // The actual regexps go on exports.re
  7677. var re = exports.re = [];
  7678. var src = exports.src = [];
  7679. var R = 0;
  7680. // The following Regular Expressions can be used for tokenizing,
  7681. // validating, and parsing SemVer version strings.
  7682. // ## Numeric Identifier
  7683. // A single `0`, or a non-zero digit followed by zero or more digits.
  7684. var NUMERICIDENTIFIER = R++;
  7685. src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
  7686. var NUMERICIDENTIFIERLOOSE = R++;
  7687. src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
  7688. // ## Non-numeric Identifier
  7689. // Zero or more digits, followed by a letter or hyphen, and then zero or
  7690. // more letters, digits, or hyphens.
  7691. var NONNUMERICIDENTIFIER = R++;
  7692. src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
  7693. // ## Main Version
  7694. // Three dot-separated numeric identifiers.
  7695. var MAINVERSION = R++;
  7696. src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  7697. '(' + src[NUMERICIDENTIFIER] + ')\\.' +
  7698. '(' + src[NUMERICIDENTIFIER] + ')';
  7699. var MAINVERSIONLOOSE = R++;
  7700. src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  7701. '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
  7702. '(' + src[NUMERICIDENTIFIERLOOSE] + ')';
  7703. // ## Pre-release Version Identifier
  7704. // A numeric identifier, or a non-numeric identifier.
  7705. var PRERELEASEIDENTIFIER = R++;
  7706. src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
  7707. '|' + src[NONNUMERICIDENTIFIER] + ')';
  7708. var PRERELEASEIDENTIFIERLOOSE = R++;
  7709. src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
  7710. '|' + src[NONNUMERICIDENTIFIER] + ')';
  7711. // ## Pre-release Version
  7712. // Hyphen, followed by one or more dot-separated pre-release version
  7713. // identifiers.
  7714. var PRERELEASE = R++;
  7715. src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
  7716. '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
  7717. var PRERELEASELOOSE = R++;
  7718. src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
  7719. '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
  7720. // ## Build Metadata Identifier
  7721. // Any combination of digits, letters, or hyphens.
  7722. var BUILDIDENTIFIER = R++;
  7723. src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
  7724. // ## Build Metadata
  7725. // Plus sign, followed by one or more period-separated build metadata
  7726. // identifiers.
  7727. var BUILD = R++;
  7728. src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
  7729. '(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
  7730. // ## Full Version String
  7731. // A main version, followed optionally by a pre-release version and
  7732. // build metadata.
  7733. // Note that the only major, minor, patch, and pre-release sections of
  7734. // the version string are capturing groups. The build metadata is not a
  7735. // capturing group, because it should not ever be used in version
  7736. // comparison.
  7737. var FULL = R++;
  7738. var FULLPLAIN = 'v?' + src[MAINVERSION] +
  7739. src[PRERELEASE] + '?' +
  7740. src[BUILD] + '?';
  7741. src[FULL] = '^' + FULLPLAIN + '$';
  7742. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  7743. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  7744. // common in the npm registry.
  7745. var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
  7746. src[PRERELEASELOOSE] + '?' +
  7747. src[BUILD] + '?';
  7748. var LOOSE = R++;
  7749. src[LOOSE] = '^' + LOOSEPLAIN + '$';
  7750. var GTLT = R++;
  7751. src[GTLT] = '((?:<|>)?=?)';
  7752. // Something like "2.*" or "1.2.x".
  7753. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  7754. // Only the first item is strictly required.
  7755. var XRANGEIDENTIFIERLOOSE = R++;
  7756. src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
  7757. var XRANGEIDENTIFIER = R++;
  7758. src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
  7759. var XRANGEPLAIN = R++;
  7760. src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
  7761. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  7762. '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
  7763. '(?:' + src[PRERELEASE] + ')?' +
  7764. src[BUILD] + '?' +
  7765. ')?)?';
  7766. var XRANGEPLAINLOOSE = R++;
  7767. src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  7768. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  7769. '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
  7770. '(?:' + src[PRERELEASELOOSE] + ')?' +
  7771. src[BUILD] + '?' +
  7772. ')?)?';
  7773. var XRANGE = R++;
  7774. src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
  7775. var XRANGELOOSE = R++;
  7776. src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
  7777. // Tilde ranges.
  7778. // Meaning is "reasonably at or greater than"
  7779. var LONETILDE = R++;
  7780. src[LONETILDE] = '(?:~>?)';
  7781. var TILDETRIM = R++;
  7782. src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
  7783. re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
  7784. var tildeTrimReplace = '$1~';
  7785. var TILDE = R++;
  7786. src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
  7787. var TILDELOOSE = R++;
  7788. src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
  7789. // Caret ranges.
  7790. // Meaning is "at least and backwards compatible with"
  7791. var LONECARET = R++;
  7792. src[LONECARET] = '(?:\\^)';
  7793. var CARETTRIM = R++;
  7794. src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
  7795. re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
  7796. var caretTrimReplace = '$1^';
  7797. var CARET = R++;
  7798. src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
  7799. var CARETLOOSE = R++;
  7800. src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
  7801. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  7802. var COMPARATORLOOSE = R++;
  7803. src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
  7804. var COMPARATOR = R++;
  7805. src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
  7806. // An expression to strip any whitespace between the gtlt and the thing
  7807. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  7808. var COMPARATORTRIM = R++;
  7809. src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
  7810. '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
  7811. // this one has to use the /g flag
  7812. re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
  7813. var comparatorTrimReplace = '$1$2$3';
  7814. // Something like `1.2.3 - 1.2.4`
  7815. // Note that these all use the loose form, because they'll be
  7816. // checked against either the strict or loose comparator form
  7817. // later.
  7818. var HYPHENRANGE = R++;
  7819. src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
  7820. '\\s+-\\s+' +
  7821. '(' + src[XRANGEPLAIN] + ')' +
  7822. '\\s*$';
  7823. var HYPHENRANGELOOSE = R++;
  7824. src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
  7825. '\\s+-\\s+' +
  7826. '(' + src[XRANGEPLAINLOOSE] + ')' +
  7827. '\\s*$';
  7828. // Star ranges basically just allow anything at all.
  7829. var STAR = R++;
  7830. src[STAR] = '(<|>)?=?\\s*\\*';
  7831. // Compile to actual regexp objects.
  7832. // All are flag-free, unless they were created above with a flag.
  7833. for (var i = 0; i < R; i++) {
  7834. ;
  7835. if (!re[i])
  7836. re[i] = new RegExp(src[i]);
  7837. }
  7838. exports.parse = parse;
  7839. function parse(version, loose) {
  7840. var r = loose ? re[LOOSE] : re[FULL];
  7841. return (r.test(version)) ? new SemVer(version, loose) : null;
  7842. }
  7843. exports.valid = valid;
  7844. function valid(version, loose) {
  7845. var v = parse(version, loose);
  7846. return v ? v.version : null;
  7847. }
  7848. exports.clean = clean;
  7849. function clean(version, loose) {
  7850. var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
  7851. return s ? s.version : null;
  7852. }
  7853. exports.SemVer = SemVer;
  7854. function SemVer(version, loose) {
  7855. if (version instanceof SemVer) {
  7856. if (version.loose === loose)
  7857. return version;
  7858. else
  7859. version = version.version;
  7860. } else if (typeof version !== 'string') {
  7861. throw new TypeError('Invalid Version: ' + version);
  7862. }
  7863. if (!(this instanceof SemVer))
  7864. return new SemVer(version, loose);
  7865. ;
  7866. this.loose = loose;
  7867. var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
  7868. if (!m)
  7869. throw new TypeError('Invalid Version: ' + version);
  7870. this.raw = version;
  7871. // these are actually numbers
  7872. this.major = +m[1];
  7873. this.minor = +m[2];
  7874. this.patch = +m[3];
  7875. // numberify any prerelease numeric ids
  7876. if (!m[4])
  7877. this.prerelease = [];
  7878. else
  7879. this.prerelease = m[4].split('.').map(function(id) {
  7880. return (/^[0-9]+$/.test(id)) ? +id : id;
  7881. });
  7882. this.build = m[5] ? m[5].split('.') : [];
  7883. this.format();
  7884. }
  7885. SemVer.prototype.format = function() {
  7886. this.version = this.major + '.' + this.minor + '.' + this.patch;
  7887. if (this.prerelease.length)
  7888. this.version += '-' + this.prerelease.join('.');
  7889. return this.version;
  7890. };
  7891. SemVer.prototype.inspect = function() {
  7892. return '<SemVer "' + this + '">';
  7893. };
  7894. SemVer.prototype.toString = function() {
  7895. return this.version;
  7896. };
  7897. SemVer.prototype.compare = function(other) {
  7898. ;
  7899. if (!(other instanceof SemVer))
  7900. other = new SemVer(other, this.loose);
  7901. return this.compareMain(other) || this.comparePre(other);
  7902. };
  7903. SemVer.prototype.compareMain = function(other) {
  7904. if (!(other instanceof SemVer))
  7905. other = new SemVer(other, this.loose);
  7906. return compareIdentifiers(this.major, other.major) ||
  7907. compareIdentifiers(this.minor, other.minor) ||
  7908. compareIdentifiers(this.patch, other.patch);
  7909. };
  7910. SemVer.prototype.comparePre = function(other) {
  7911. if (!(other instanceof SemVer))
  7912. other = new SemVer(other, this.loose);
  7913. // NOT having a prerelease is > having one
  7914. if (this.prerelease.length && !other.prerelease.length)
  7915. return -1;
  7916. else if (!this.prerelease.length && other.prerelease.length)
  7917. return 1;
  7918. else if (!this.prerelease.length && !other.prerelease.length)
  7919. return 0;
  7920. var i = 0;
  7921. do {
  7922. var a = this.prerelease[i];
  7923. var b = other.prerelease[i];
  7924. ;
  7925. if (a === undefined && b === undefined)
  7926. return 0;
  7927. else if (b === undefined)
  7928. return 1;
  7929. else if (a === undefined)
  7930. return -1;
  7931. else if (a === b)
  7932. continue;
  7933. else
  7934. return compareIdentifiers(a, b);
  7935. } while (++i);
  7936. };
  7937. // preminor will bump the version up to the next minor release, and immediately
  7938. // down to pre-release. premajor and prepatch work the same way.
  7939. SemVer.prototype.inc = function(release, identifier) {
  7940. switch (release) {
  7941. case 'premajor':
  7942. this.prerelease.length = 0;
  7943. this.patch = 0;
  7944. this.minor = 0;
  7945. this.major++;
  7946. this.inc('pre', identifier);
  7947. break;
  7948. case 'preminor':
  7949. this.prerelease.length = 0;
  7950. this.patch = 0;
  7951. this.minor++;
  7952. this.inc('pre', identifier);
  7953. break;
  7954. case 'prepatch':
  7955. // If this is already a prerelease, it will bump to the next version
  7956. // drop any prereleases that might already exist, since they are not
  7957. // relevant at this point.
  7958. this.prerelease.length = 0;
  7959. this.inc('patch', identifier);
  7960. this.inc('pre', identifier);
  7961. break;
  7962. // If the input is a non-prerelease version, this acts the same as
  7963. // prepatch.
  7964. case 'prerelease':
  7965. if (this.prerelease.length === 0)
  7966. this.inc('patch', identifier);
  7967. this.inc('pre', identifier);
  7968. break;
  7969. case 'major':
  7970. // If this is a pre-major version, bump up to the same major version.
  7971. // Otherwise increment major.
  7972. // 1.0.0-5 bumps to 1.0.0
  7973. // 1.1.0 bumps to 2.0.0
  7974. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0)
  7975. this.major++;
  7976. this.minor = 0;
  7977. this.patch = 0;
  7978. this.prerelease = [];
  7979. break;
  7980. case 'minor':
  7981. // If this is a pre-minor version, bump up to the same minor version.
  7982. // Otherwise increment minor.
  7983. // 1.2.0-5 bumps to 1.2.0
  7984. // 1.2.1 bumps to 1.3.0
  7985. if (this.patch !== 0 || this.prerelease.length === 0)
  7986. this.minor++;
  7987. this.patch = 0;
  7988. this.prerelease = [];
  7989. break;
  7990. case 'patch':
  7991. // If this is not a pre-release version, it will increment the patch.
  7992. // If it is a pre-release it will bump up to the same patch version.
  7993. // 1.2.0-5 patches to 1.2.0
  7994. // 1.2.0 patches to 1.2.1
  7995. if (this.prerelease.length === 0)
  7996. this.patch++;
  7997. this.prerelease = [];
  7998. break;
  7999. // This probably shouldn't be used publicly.
  8000. // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
  8001. case 'pre':
  8002. if (this.prerelease.length === 0)
  8003. this.prerelease = [0];
  8004. else {
  8005. var i = this.prerelease.length;
  8006. while (--i >= 0) {
  8007. if (typeof this.prerelease[i] === 'number') {
  8008. this.prerelease[i]++;
  8009. i = -2;
  8010. }
  8011. }
  8012. if (i === -1) // didn't increment anything
  8013. this.prerelease.push(0);
  8014. }
  8015. if (identifier) {
  8016. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  8017. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  8018. if (this.prerelease[0] === identifier) {
  8019. if (isNaN(this.prerelease[1]))
  8020. this.prerelease = [identifier, 0];
  8021. } else
  8022. this.prerelease = [identifier, 0];
  8023. }
  8024. break;
  8025. default:
  8026. throw new Error('invalid increment argument: ' + release);
  8027. }
  8028. this.format();
  8029. return this;
  8030. };
  8031. exports.inc = inc;
  8032. function inc(version, release, loose, identifier) {
  8033. if (typeof(loose) === 'string') {
  8034. identifier = loose;
  8035. loose = undefined;
  8036. }
  8037. try {
  8038. return new SemVer(version, loose).inc(release, identifier).version;
  8039. } catch (er) {
  8040. return null;
  8041. }
  8042. }
  8043. exports.diff = diff;
  8044. function diff(version1, version2) {
  8045. if (eq(version1, version2)) {
  8046. return null;
  8047. } else {
  8048. var v1 = parse(version1);
  8049. var v2 = parse(version2);
  8050. if (v1.prerelease.length || v2.prerelease.length) {
  8051. for (var key in v1) {
  8052. if (key === 'major' || key === 'minor' || key === 'patch') {
  8053. if (v1[key] !== v2[key]) {
  8054. return 'pre'+key;
  8055. }
  8056. }
  8057. }
  8058. return 'prerelease';
  8059. }
  8060. for (var key in v1) {
  8061. if (key === 'major' || key === 'minor' || key === 'patch') {
  8062. if (v1[key] !== v2[key]) {
  8063. return key;
  8064. }
  8065. }
  8066. }
  8067. }
  8068. }
  8069. exports.compareIdentifiers = compareIdentifiers;
  8070. var numeric = /^[0-9]+$/;
  8071. function compareIdentifiers(a, b) {
  8072. var anum = numeric.test(a);
  8073. var bnum = numeric.test(b);
  8074. if (anum && bnum) {
  8075. a = +a;
  8076. b = +b;
  8077. }
  8078. return (anum && !bnum) ? -1 :
  8079. (bnum && !anum) ? 1 :
  8080. a < b ? -1 :
  8081. a > b ? 1 :
  8082. 0;
  8083. }
  8084. exports.rcompareIdentifiers = rcompareIdentifiers;
  8085. function rcompareIdentifiers(a, b) {
  8086. return compareIdentifiers(b, a);
  8087. }
  8088. exports.major = major;
  8089. function major(a, loose) {
  8090. return new SemVer(a, loose).major;
  8091. }
  8092. exports.minor = minor;
  8093. function minor(a, loose) {
  8094. return new SemVer(a, loose).minor;
  8095. }
  8096. exports.patch = patch;
  8097. function patch(a, loose) {
  8098. return new SemVer(a, loose).patch;
  8099. }
  8100. exports.compare = compare;
  8101. function compare(a, b, loose) {
  8102. return new SemVer(a, loose).compare(b);
  8103. }
  8104. exports.compareLoose = compareLoose;
  8105. function compareLoose(a, b) {
  8106. return compare(a, b, true);
  8107. }
  8108. exports.rcompare = rcompare;
  8109. function rcompare(a, b, loose) {
  8110. return compare(b, a, loose);
  8111. }
  8112. exports.sort = sort;
  8113. function sort(list, loose) {
  8114. return list.sort(function(a, b) {
  8115. return exports.compare(a, b, loose);
  8116. });
  8117. }
  8118. exports.rsort = rsort;
  8119. function rsort(list, loose) {
  8120. return list.sort(function(a, b) {
  8121. return exports.rcompare(a, b, loose);
  8122. });
  8123. }
  8124. exports.gt = gt;
  8125. function gt(a, b, loose) {
  8126. return compare(a, b, loose) > 0;
  8127. }
  8128. exports.lt = lt;
  8129. function lt(a, b, loose) {
  8130. return compare(a, b, loose) < 0;
  8131. }
  8132. exports.eq = eq;
  8133. function eq(a, b, loose) {
  8134. return compare(a, b, loose) === 0;
  8135. }
  8136. exports.neq = neq;
  8137. function neq(a, b, loose) {
  8138. return compare(a, b, loose) !== 0;
  8139. }
  8140. exports.gte = gte;
  8141. function gte(a, b, loose) {
  8142. return compare(a, b, loose) >= 0;
  8143. }
  8144. exports.lte = lte;
  8145. function lte(a, b, loose) {
  8146. return compare(a, b, loose) <= 0;
  8147. }
  8148. exports.cmp = cmp;
  8149. function cmp(a, op, b, loose) {
  8150. var ret;
  8151. switch (op) {
  8152. case '===':
  8153. if (typeof a === 'object') a = a.version;
  8154. if (typeof b === 'object') b = b.version;
  8155. ret = a === b;
  8156. break;
  8157. case '!==':
  8158. if (typeof a === 'object') a = a.version;
  8159. if (typeof b === 'object') b = b.version;
  8160. ret = a !== b;
  8161. break;
  8162. case '': case '=': case '==': ret = eq(a, b, loose); break;
  8163. case '!=': ret = neq(a, b, loose); break;
  8164. case '>': ret = gt(a, b, loose); break;
  8165. case '>=': ret = gte(a, b, loose); break;
  8166. case '<': ret = lt(a, b, loose); break;
  8167. case '<=': ret = lte(a, b, loose); break;
  8168. default: throw new TypeError('Invalid operator: ' + op);
  8169. }
  8170. return ret;
  8171. }
  8172. exports.Comparator = Comparator;
  8173. function Comparator(comp, loose) {
  8174. if (comp instanceof Comparator) {
  8175. if (comp.loose === loose)
  8176. return comp;
  8177. else
  8178. comp = comp.value;
  8179. }
  8180. if (!(this instanceof Comparator))
  8181. return new Comparator(comp, loose);
  8182. ;
  8183. this.loose = loose;
  8184. this.parse(comp);
  8185. if (this.semver === ANY)
  8186. this.value = '';
  8187. else
  8188. this.value = this.operator + this.semver.version;
  8189. ;
  8190. }
  8191. var ANY = {};
  8192. Comparator.prototype.parse = function(comp) {
  8193. var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  8194. var m = comp.match(r);
  8195. if (!m)
  8196. throw new TypeError('Invalid comparator: ' + comp);
  8197. this.operator = m[1];
  8198. if (this.operator === '=')
  8199. this.operator = '';
  8200. // if it literally is just '>' or '' then allow anything.
  8201. if (!m[2])
  8202. this.semver = ANY;
  8203. else
  8204. this.semver = new SemVer(m[2], this.loose);
  8205. };
  8206. Comparator.prototype.inspect = function() {
  8207. return '<SemVer Comparator "' + this + '">';
  8208. };
  8209. Comparator.prototype.toString = function() {
  8210. return this.value;
  8211. };
  8212. Comparator.prototype.test = function(version) {
  8213. ;
  8214. if (this.semver === ANY)
  8215. return true;
  8216. if (typeof version === 'string')
  8217. version = new SemVer(version, this.loose);
  8218. return cmp(version, this.operator, this.semver, this.loose);
  8219. };
  8220. exports.Range = Range;
  8221. function Range(range, loose) {
  8222. if ((range instanceof Range) && range.loose === loose)
  8223. return range;
  8224. if (!(this instanceof Range))
  8225. return new Range(range, loose);
  8226. this.loose = loose;
  8227. // First, split based on boolean or ||
  8228. this.raw = range;
  8229. this.set = range.split(/\s*\|\|\s*/).map(function(range) {
  8230. return this.parseRange(range.trim());
  8231. }, this).filter(function(c) {
  8232. // throw out any that are not relevant for whatever reason
  8233. return c.length;
  8234. });
  8235. if (!this.set.length) {
  8236. throw new TypeError('Invalid SemVer Range: ' + range);
  8237. }
  8238. this.format();
  8239. }
  8240. Range.prototype.inspect = function() {
  8241. return '<SemVer Range "' + this.range + '">';
  8242. };
  8243. Range.prototype.format = function() {
  8244. this.range = this.set.map(function(comps) {
  8245. return comps.join(' ').trim();
  8246. }).join('||').trim();
  8247. return this.range;
  8248. };
  8249. Range.prototype.toString = function() {
  8250. return this.range;
  8251. };
  8252. Range.prototype.parseRange = function(range) {
  8253. var loose = this.loose;
  8254. range = range.trim();
  8255. ;
  8256. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  8257. var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
  8258. range = range.replace(hr, hyphenReplace);
  8259. ;
  8260. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  8261. range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
  8262. ;
  8263. // `~ 1.2.3` => `~1.2.3`
  8264. range = range.replace(re[TILDETRIM], tildeTrimReplace);
  8265. // `^ 1.2.3` => `^1.2.3`
  8266. range = range.replace(re[CARETTRIM], caretTrimReplace);
  8267. // normalize spaces
  8268. range = range.split(/\s+/).join(' ');
  8269. // At this point, the range is completely trimmed and
  8270. // ready to be split into comparators.
  8271. var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
  8272. var set = range.split(' ').map(function(comp) {
  8273. return parseComparator(comp, loose);
  8274. }).join(' ').split(/\s+/);
  8275. if (this.loose) {
  8276. // in loose mode, throw out any that are not valid comparators
  8277. set = set.filter(function(comp) {
  8278. return !!comp.match(compRe);
  8279. });
  8280. }
  8281. set = set.map(function(comp) {
  8282. return new Comparator(comp, loose);
  8283. });
  8284. return set;
  8285. };
  8286. // Mostly just for testing and legacy API reasons
  8287. exports.toComparators = toComparators;
  8288. function toComparators(range, loose) {
  8289. return new Range(range, loose).set.map(function(comp) {
  8290. return comp.map(function(c) {
  8291. return c.value;
  8292. }).join(' ').trim().split(' ');
  8293. });
  8294. }
  8295. // comprised of xranges, tildes, stars, and gtlt's at this point.
  8296. // already replaced the hyphen ranges
  8297. // turn into a set of JUST comparators.
  8298. function parseComparator(comp, loose) {
  8299. ;
  8300. comp = replaceCarets(comp, loose);
  8301. ;
  8302. comp = replaceTildes(comp, loose);
  8303. ;
  8304. comp = replaceXRanges(comp, loose);
  8305. ;
  8306. comp = replaceStars(comp, loose);
  8307. ;
  8308. return comp;
  8309. }
  8310. function isX(id) {
  8311. return !id || id.toLowerCase() === 'x' || id === '*';
  8312. }
  8313. // ~, ~> --> * (any, kinda silly)
  8314. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
  8315. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
  8316. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
  8317. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
  8318. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
  8319. function replaceTildes(comp, loose) {
  8320. return comp.trim().split(/\s+/).map(function(comp) {
  8321. return replaceTilde(comp, loose);
  8322. }).join(' ');
  8323. }
  8324. function replaceTilde(comp, loose) {
  8325. var r = loose ? re[TILDELOOSE] : re[TILDE];
  8326. return comp.replace(r, function(_, M, m, p, pr) {
  8327. ;
  8328. var ret;
  8329. if (isX(M))
  8330. ret = '';
  8331. else if (isX(m))
  8332. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  8333. else if (isX(p))
  8334. // ~1.2 == >=1.2.0- <1.3.0-
  8335. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  8336. else if (pr) {
  8337. ;
  8338. if (pr.charAt(0) !== '-')
  8339. pr = '-' + pr;
  8340. ret = '>=' + M + '.' + m + '.' + p + pr +
  8341. ' <' + M + '.' + (+m + 1) + '.0';
  8342. } else
  8343. // ~1.2.3 == >=1.2.3 <1.3.0
  8344. ret = '>=' + M + '.' + m + '.' + p +
  8345. ' <' + M + '.' + (+m + 1) + '.0';
  8346. ;
  8347. return ret;
  8348. });
  8349. }
  8350. // ^ --> * (any, kinda silly)
  8351. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
  8352. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
  8353. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
  8354. // ^1.2.3 --> >=1.2.3 <2.0.0
  8355. // ^1.2.0 --> >=1.2.0 <2.0.0
  8356. function replaceCarets(comp, loose) {
  8357. return comp.trim().split(/\s+/).map(function(comp) {
  8358. return replaceCaret(comp, loose);
  8359. }).join(' ');
  8360. }
  8361. function replaceCaret(comp, loose) {
  8362. ;
  8363. var r = loose ? re[CARETLOOSE] : re[CARET];
  8364. return comp.replace(r, function(_, M, m, p, pr) {
  8365. ;
  8366. var ret;
  8367. if (isX(M))
  8368. ret = '';
  8369. else if (isX(m))
  8370. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  8371. else if (isX(p)) {
  8372. if (M === '0')
  8373. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  8374. else
  8375. ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
  8376. } else if (pr) {
  8377. ;
  8378. if (pr.charAt(0) !== '-')
  8379. pr = '-' + pr;
  8380. if (M === '0') {
  8381. if (m === '0')
  8382. ret = '>=' + M + '.' + m + '.' + p + pr +
  8383. ' <' + M + '.' + m + '.' + (+p + 1);
  8384. else
  8385. ret = '>=' + M + '.' + m + '.' + p + pr +
  8386. ' <' + M + '.' + (+m + 1) + '.0';
  8387. } else
  8388. ret = '>=' + M + '.' + m + '.' + p + pr +
  8389. ' <' + (+M + 1) + '.0.0';
  8390. } else {
  8391. ;
  8392. if (M === '0') {
  8393. if (m === '0')
  8394. ret = '>=' + M + '.' + m + '.' + p +
  8395. ' <' + M + '.' + m + '.' + (+p + 1);
  8396. else
  8397. ret = '>=' + M + '.' + m + '.' + p +
  8398. ' <' + M + '.' + (+m + 1) + '.0';
  8399. } else
  8400. ret = '>=' + M + '.' + m + '.' + p +
  8401. ' <' + (+M + 1) + '.0.0';
  8402. }
  8403. ;
  8404. return ret;
  8405. });
  8406. }
  8407. function replaceXRanges(comp, loose) {
  8408. ;
  8409. return comp.split(/\s+/).map(function(comp) {
  8410. return replaceXRange(comp, loose);
  8411. }).join(' ');
  8412. }
  8413. function replaceXRange(comp, loose) {
  8414. comp = comp.trim();
  8415. var r = loose ? re[XRANGELOOSE] : re[XRANGE];
  8416. return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
  8417. ;
  8418. var xM = isX(M);
  8419. var xm = xM || isX(m);
  8420. var xp = xm || isX(p);
  8421. var anyX = xp;
  8422. if (gtlt === '=' && anyX)
  8423. gtlt = '';
  8424. if (xM) {
  8425. if (gtlt === '>' || gtlt === '<') {
  8426. // nothing is allowed
  8427. ret = '<0.0.0';
  8428. } else {
  8429. // nothing is forbidden
  8430. ret = '*';
  8431. }
  8432. } else if (gtlt && anyX) {
  8433. // replace X with 0
  8434. if (xm)
  8435. m = 0;
  8436. if (xp)
  8437. p = 0;
  8438. if (gtlt === '>') {
  8439. // >1 => >=2.0.0
  8440. // >1.2 => >=1.3.0
  8441. // >1.2.3 => >= 1.2.4
  8442. gtlt = '>=';
  8443. if (xm) {
  8444. M = +M + 1;
  8445. m = 0;
  8446. p = 0;
  8447. } else if (xp) {
  8448. m = +m + 1;
  8449. p = 0;
  8450. }
  8451. } else if (gtlt === '<=') {
  8452. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  8453. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  8454. gtlt = '<'
  8455. if (xm)
  8456. M = +M + 1
  8457. else
  8458. m = +m + 1
  8459. }
  8460. ret = gtlt + M + '.' + m + '.' + p;
  8461. } else if (xm) {
  8462. ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
  8463. } else if (xp) {
  8464. ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
  8465. }
  8466. ;
  8467. return ret;
  8468. });
  8469. }
  8470. // Because * is AND-ed with everything else in the comparator,
  8471. // and '' means "any version", just remove the *s entirely.
  8472. function replaceStars(comp, loose) {
  8473. ;
  8474. // Looseness is ignored here. star is always as loose as it gets!
  8475. return comp.trim().replace(re[STAR], '');
  8476. }
  8477. // This function is passed to string.replace(re[HYPHENRANGE])
  8478. // M, m, patch, prerelease, build
  8479. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  8480. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
  8481. // 1.2 - 3.4 => >=1.2.0 <3.5.0
  8482. function hyphenReplace($0,
  8483. from, fM, fm, fp, fpr, fb,
  8484. to, tM, tm, tp, tpr, tb) {
  8485. if (isX(fM))
  8486. from = '';
  8487. else if (isX(fm))
  8488. from = '>=' + fM + '.0.0';
  8489. else if (isX(fp))
  8490. from = '>=' + fM + '.' + fm + '.0';
  8491. else
  8492. from = '>=' + from;
  8493. if (isX(tM))
  8494. to = '';
  8495. else if (isX(tm))
  8496. to = '<' + (+tM + 1) + '.0.0';
  8497. else if (isX(tp))
  8498. to = '<' + tM + '.' + (+tm + 1) + '.0';
  8499. else if (tpr)
  8500. to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
  8501. else
  8502. to = '<=' + to;
  8503. return (from + ' ' + to).trim();
  8504. }
  8505. // if ANY of the sets match ALL of its comparators, then pass
  8506. Range.prototype.test = function(version) {
  8507. if (!version)
  8508. return false;
  8509. if (typeof version === 'string')
  8510. version = new SemVer(version, this.loose);
  8511. for (var i = 0; i < this.set.length; i++) {
  8512. if (testSet(this.set[i], version))
  8513. return true;
  8514. }
  8515. return false;
  8516. };
  8517. function testSet(set, version) {
  8518. for (var i = 0; i < set.length; i++) {
  8519. if (!set[i].test(version))
  8520. return false;
  8521. }
  8522. if (version.prerelease.length) {
  8523. // Find the set of versions that are allowed to have prereleases
  8524. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  8525. // That should allow `1.2.3-pr.2` to pass.
  8526. // However, `1.2.4-alpha.notready` should NOT be allowed,
  8527. // even though it's within the range set by the comparators.
  8528. for (var i = 0; i < set.length; i++) {
  8529. ;
  8530. if (set[i].semver === ANY)
  8531. return true;
  8532. if (set[i].semver.prerelease.length > 0) {
  8533. var allowed = set[i].semver;
  8534. if (allowed.major === version.major &&
  8535. allowed.minor === version.minor &&
  8536. allowed.patch === version.patch)
  8537. return true;
  8538. }
  8539. }
  8540. // Version has a -pre, but it's not one of the ones we like.
  8541. return false;
  8542. }
  8543. return true;
  8544. }
  8545. exports.satisfies = satisfies;
  8546. function satisfies(version, range, loose) {
  8547. try {
  8548. range = new Range(range, loose);
  8549. } catch (er) {
  8550. return false;
  8551. }
  8552. return range.test(version);
  8553. }
  8554. exports.maxSatisfying = maxSatisfying;
  8555. function maxSatisfying(versions, range, loose) {
  8556. return versions.filter(function(version) {
  8557. return satisfies(version, range, loose);
  8558. }).sort(function(a, b) {
  8559. return rcompare(a, b, loose);
  8560. })[0] || null;
  8561. }
  8562. exports.validRange = validRange;
  8563. function validRange(range, loose) {
  8564. try {
  8565. // Return '*' instead of '' so that truthiness works.
  8566. // This will throw if it's invalid anyway
  8567. return new Range(range, loose).range || '*';
  8568. } catch (er) {
  8569. return null;
  8570. }
  8571. }
  8572. // Determine if version is less than all the versions possible in the range
  8573. exports.ltr = ltr;
  8574. function ltr(version, range, loose) {
  8575. return outside(version, range, '<', loose);
  8576. }
  8577. // Determine if version is greater than all the versions possible in the range.
  8578. exports.gtr = gtr;
  8579. function gtr(version, range, loose) {
  8580. return outside(version, range, '>', loose);
  8581. }
  8582. exports.outside = outside;
  8583. function outside(version, range, hilo, loose) {
  8584. version = new SemVer(version, loose);
  8585. range = new Range(range, loose);
  8586. var gtfn, ltefn, ltfn, comp, ecomp;
  8587. switch (hilo) {
  8588. case '>':
  8589. gtfn = gt;
  8590. ltefn = lte;
  8591. ltfn = lt;
  8592. comp = '>';
  8593. ecomp = '>=';
  8594. break;
  8595. case '<':
  8596. gtfn = lt;
  8597. ltefn = gte;
  8598. ltfn = gt;
  8599. comp = '<';
  8600. ecomp = '<=';
  8601. break;
  8602. default:
  8603. throw new TypeError('Must provide a hilo val of "<" or ">"');
  8604. }
  8605. // If it satisifes the range it is not outside
  8606. if (satisfies(version, range, loose)) {
  8607. return false;
  8608. }
  8609. // From now on, variable terms are as if we're in "gtr" mode.
  8610. // but note that everything is flipped for the "ltr" function.
  8611. for (var i = 0; i < range.set.length; ++i) {
  8612. var comparators = range.set[i];
  8613. var high = null;
  8614. var low = null;
  8615. comparators.forEach(function(comparator) {
  8616. high = high || comparator;
  8617. low = low || comparator;
  8618. if (gtfn(comparator.semver, high.semver, loose)) {
  8619. high = comparator;
  8620. } else if (ltfn(comparator.semver, low.semver, loose)) {
  8621. low = comparator;
  8622. }
  8623. });
  8624. // If the edge version comparator has a operator then our version
  8625. // isn't outside it
  8626. if (high.operator === comp || high.operator === ecomp) {
  8627. return false;
  8628. }
  8629. // If the lowest version comparator has an operator and our version
  8630. // is less than it then it isn't higher than the range
  8631. if ((!low.operator || low.operator === comp) &&
  8632. ltefn(version, low.semver)) {
  8633. return false;
  8634. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  8635. return false;
  8636. }
  8637. }
  8638. return true;
  8639. }
  8640. // Use the define() function if we're in AMD land
  8641. if (typeof define === 'function' && define.amd)
  8642. define(exports);
  8643. })(
  8644. typeof exports === 'object' ? exports :
  8645. typeof define === 'function' && define.amd ? {} :
  8646. semver = {}
  8647. );
  8648. },{}],4:[function(require,module,exports){
  8649. /**
  8650. * This file automatically generated from `pre-publish.js`.
  8651. * Do not manually edit.
  8652. */
  8653. module.exports = {
  8654. "area": true,
  8655. "base": true,
  8656. "br": true,
  8657. "col": true,
  8658. "embed": true,
  8659. "hr": true,
  8660. "img": true,
  8661. "input": true,
  8662. "keygen": true,
  8663. "link": true,
  8664. "menuitem": true,
  8665. "meta": true,
  8666. "param": true,
  8667. "source": true,
  8668. "track": true,
  8669. "wbr": true
  8670. };
  8671. },{}],5:[function(require,module,exports){
  8672. /*!
  8673. * Bootlint - an HTML linter for Bootstrap projects
  8674. * https://github.com/twbs/bootlint
  8675. * Copyright (c) 2014-2015 Christopher Rebert
  8676. * Licensed under the MIT License.
  8677. */
  8678. /*eslint-env node */
  8679. var cheerio = require('cheerio');
  8680. var parseUrl = require('url').parse;
  8681. var semver = require('semver');
  8682. var voidElements = require('void-elements');
  8683. var _location = require('./location');
  8684. var LocationIndex = _location.LocationIndex;
  8685. (function (exports) {
  8686. 'use strict';
  8687. var NUM_COLS = 12;
  8688. var COL_REGEX = /\bcol-(xs|sm|md|lg)-(\d{1,2})\b/;
  8689. var COL_REGEX_G = /\bcol-(xs|sm|md|lg)-(\d{1,2})\b/g;
  8690. var COL_CLASSES = [];
  8691. var SCREENS = ['xs', 'sm', 'md', 'lg'];
  8692. SCREENS.forEach(function (screen) {
  8693. for (var n = 1; n <= NUM_COLS; n++) {
  8694. COL_CLASSES.push('.col-' + screen + '-' + n);
  8695. }
  8696. });
  8697. var SCREEN2NUM = {
  8698. 'xs': 0,
  8699. 'sm': 1,
  8700. 'md': 2,
  8701. 'lg': 3
  8702. };
  8703. var NUM2SCREEN = ['xs', 'sm', 'md', 'lg'];
  8704. var IN_NODE_JS = !!(cheerio.load);
  8705. var MIN_JQUERY_VERSION = '1.9.1';// as of Bootstrap v3.3.0
  8706. var CURRENT_BOOTSTRAP_VERSION = '3.3.4';
  8707. var BOOTSTRAP_VERSION_4 = '4.0.0';
  8708. var PLUGINS = [
  8709. 'affix',
  8710. 'alert',
  8711. 'button',
  8712. 'carousel',
  8713. 'collapse',
  8714. 'dropdown',
  8715. 'modal',
  8716. 'popover',
  8717. 'scrollspy',
  8718. 'tab',
  8719. 'tooltip'
  8720. ];
  8721. var BOOTSTRAP_FILES = [
  8722. 'link[rel="stylesheet"][href$="/bootstrap.css"]',
  8723. 'link[rel="stylesheet"][href="bootstrap.css"]',
  8724. 'link[rel="stylesheet"][href$="/bootstrap.min.css"]',
  8725. 'link[rel="stylesheet"][href="bootstrap.min.css"]',
  8726. 'script[src$="/bootstrap.js"]',
  8727. 'script[src="bootstrap.js"]',
  8728. 'script[src$="/bootstrap.min.js"]',
  8729. 'script[src="bootstrap.min.js"]'
  8730. ].join(',');
  8731. function compareNums(a, b) {
  8732. return a - b;
  8733. }
  8734. function isDoctype(node) {
  8735. return node.type === 'directive' && node.name === '!doctype';
  8736. }
  8737. var tagNameOf = IN_NODE_JS ? function (element) {
  8738. return element.name.toUpperCase();
  8739. } : function (element) {
  8740. /* @covignore */
  8741. return element.tagName.toUpperCase();
  8742. };
  8743. function filenameFromUrl(url) {
  8744. var filename = url.replace(/[#?].*$/, ''); // strip querystring & fragment ID
  8745. var lastSlash = filename.lastIndexOf('/');
  8746. if (lastSlash !== -1) {
  8747. filename = filename.slice(lastSlash + 1);
  8748. }
  8749. return filename;
  8750. }
  8751. function withoutClass(classes, klass) {
  8752. return classes.replace(new RegExp('\\b' + klass + '\\b', 'g'), '');
  8753. }
  8754. function columnClassKey(colClass) {
  8755. return SCREEN2NUM[COL_REGEX.exec(colClass)[1]];
  8756. }
  8757. function compareColumnClasses(a, b) {
  8758. return columnClassKey(a) - columnClassKey(b);
  8759. }
  8760. /**
  8761. * Moves any grid column classes to the end of the class string and sorts the grid classes by ascending screen size.
  8762. * @param {string} classes The "class" attribute of a DOM node
  8763. * @returns {string} The processed "class" attribute value
  8764. */
  8765. function sortedColumnClasses(classes) {
  8766. // extract column classes
  8767. var colClasses = [];
  8768. while (true) {
  8769. var match = COL_REGEX.exec(classes);
  8770. if (!match) {
  8771. break;
  8772. }
  8773. var colClass = match[0];
  8774. colClasses.push(colClass);
  8775. classes = withoutClass(classes, colClass);
  8776. }
  8777. colClasses.sort(compareColumnClasses);
  8778. return classes + ' ' + colClasses.join(' ');
  8779. }
  8780. /**
  8781. * @param {string} classes The "class" attribute of a DOM node
  8782. * @returns {Object.<string, integer[]>} Object mapping grid column widths (1 thru 12) to sorted arrays of screen size numbers (see SCREEN2NUM)
  8783. * Widths not used in the classes will not have an entry in the object.
  8784. */
  8785. function width2screensFor(classes) {
  8786. var width = null;
  8787. var width2screens = {};
  8788. while (true) {
  8789. var match = COL_REGEX_G.exec(classes);
  8790. if (!match) {
  8791. break;
  8792. }
  8793. var screen = match[1];
  8794. width = match[2];
  8795. var screens = width2screens[width];
  8796. if (!screens) {
  8797. screens = width2screens[width] = [];
  8798. }
  8799. screens.push(SCREEN2NUM[screen]);
  8800. }
  8801. for (width in width2screens) {
  8802. if (width2screens.hasOwnProperty(width)) {
  8803. width2screens[width].sort(compareNums);
  8804. }
  8805. }
  8806. return width2screens;
  8807. }
  8808. /**
  8809. * Given a sorted array of integers, this finds all contiguous runs where each item is incremented by 1 from the next.
  8810. * For example:
  8811. * [0, 2, 3, 5] has one such run: [2, 3]
  8812. * [0, 2, 3, 4, 6, 8, 9, 11] has two such runs: [2, 3, 4], [8, 9]
  8813. * [0, 2, 4] has no runs.
  8814. * @param {integer[]} list Sorted array of integers
  8815. * @returns {Array.<Array.<integer>>} Array of pairs of start and end values of runs
  8816. */
  8817. function incrementingRunsFrom(list) {
  8818. list = list.concat([Infinity]);// use Infinity to ensure any nontrivial (length >= 2) run ends before the end of the loop
  8819. var runs = [];
  8820. var start = null;
  8821. var prev = null;
  8822. for (var i = 0; i < list.length; i++) {
  8823. var current = list[i];
  8824. if (start === null) {
  8825. // first element starts a trivial run
  8826. start = current;
  8827. }
  8828. else if (prev + 1 !== current) {
  8829. // run ended
  8830. if (start !== prev) {
  8831. // run is nontrivial
  8832. runs.push([start, prev]);
  8833. }
  8834. // start new run
  8835. start = current;
  8836. }
  8837. // else: the run continues
  8838. prev = current;
  8839. }
  8840. return runs;
  8841. }
  8842. /**
  8843. * This function returns the browser window object, or null if this is not running in a browser environment.
  8844. * @returns {(Window|null)}
  8845. */
  8846. function getBrowserWindowObject() {
  8847. var theWindow = null;
  8848. try {
  8849. /*eslint-disable no-undef, block-scoped-var */
  8850. theWindow = window;// jshint ignore:line
  8851. /*eslint-enable no-undef, block-scoped-var */
  8852. }
  8853. catch (e) {
  8854. // deliberately do nothing
  8855. }
  8856. return theWindow;
  8857. }
  8858. function versionsIn(strings) {
  8859. return strings.map(function (str) {
  8860. var match = str.match(/^\d+\.\d+\.\d+$/);
  8861. return match ? match[0] : null;
  8862. }).filter(function (match) {
  8863. return match !== null;
  8864. });
  8865. }
  8866. function versionInLinkedElement($, element) {
  8867. var elem = $(element);
  8868. var urlAttr = (tagNameOf(element) === 'LINK') ? 'href' : 'src';
  8869. var pathSegments = parseUrl(elem.attr(urlAttr)).pathname.split('/');
  8870. var versions = versionsIn(pathSegments);
  8871. if (!versions.length) {
  8872. return null;
  8873. }
  8874. var version = versions[versions.length - 1];
  8875. return version;
  8876. }
  8877. function jqueryPluginVersions(jQuery) {
  8878. /* @covignore */
  8879. return PLUGINS.map(function (pluginName) {
  8880. var plugin = jQuery.fn[pluginName];
  8881. if (!plugin) {
  8882. return undefined;
  8883. }
  8884. var constructor = plugin.Constructor;
  8885. if (!constructor) {
  8886. return undefined;
  8887. }
  8888. return constructor.VERSION;
  8889. }).filter(function (version) {
  8890. return version !== undefined;
  8891. }).sort(semver.compare);
  8892. }
  8893. function bootstrapScriptsIn($) {
  8894. var longhands = $('script[src*="bootstrap.js"]').filter(function (i, script) {
  8895. var url = $(script).attr('src');
  8896. var filename = filenameFromUrl(url);
  8897. return filename === "bootstrap.js";
  8898. });
  8899. var minifieds = $('script[src*="bootstrap.min.js"]').filter(function (i, script) {
  8900. var url = $(script).attr('src');
  8901. var filename = filenameFromUrl(url);
  8902. return filename === "bootstrap.min.js";
  8903. });
  8904. return {
  8905. longhands: longhands,
  8906. minifieds: minifieds
  8907. };
  8908. }
  8909. /**
  8910. * @param {integer} id Unique string ID for this type of lint error. Of the form "E###" (e.g. "E123").
  8911. * @param {string} message Human-readable string describing the error
  8912. * @param {jQuery} elements jQuery or Cheerio collection of referenced DOM elements pointing to all problem locations in the document
  8913. * @class
  8914. */
  8915. function LintError(id, message, elements) {
  8916. this.id = id;
  8917. this.message = message;
  8918. this.elements = elements || cheerio('');
  8919. }
  8920. exports.LintError = LintError;
  8921. /**
  8922. * @param {integer} id Unique string ID for this type of lint warning. Of the form "W###" (e.g. "W123").
  8923. * @param {string} message Human-readable string describing the warning
  8924. * @param {jQuery} elements jQuery or Cheerio collection of referenced DOM elements pointing to all problem locations in the document
  8925. * @class
  8926. */
  8927. function LintWarning(id, message, elements) {
  8928. this.id = id;
  8929. this.message = message;
  8930. this.elements = elements || cheerio('');
  8931. }
  8932. exports.LintWarning = LintWarning;
  8933. var allLinters = {};
  8934. function addLinter(id, linter) {
  8935. if (allLinters[id]) {
  8936. /* @covignore */
  8937. throw new Error("Linter already registered with ID: " + id);
  8938. }
  8939. var Problem = null;
  8940. if (id[0] === 'E') {
  8941. Problem = LintError;
  8942. }
  8943. else if (id[0] === 'W') {
  8944. Problem = LintWarning;
  8945. }
  8946. else {
  8947. /* @covignore */
  8948. throw new Error("Invalid linter ID: " + id);
  8949. }
  8950. function linterWrapper($, reporter) {
  8951. function specializedReporter(message, elements) {
  8952. reporter(new Problem(id, message, elements));
  8953. }
  8954. linter($, specializedReporter);
  8955. }
  8956. linterWrapper.id = id;
  8957. allLinters[id] = linterWrapper;
  8958. }
  8959. addLinter("E001", (function () {
  8960. var MISSING_DOCTYPE = "Document is missing a DOCTYPE declaration";
  8961. var NON_HTML5_DOCTYPE = "Document declares a non-HTML5 DOCTYPE";
  8962. if (IN_NODE_JS) {
  8963. return function lintDoctype($, reporter) {
  8964. var doctype = $(':root')[0];
  8965. while (doctype && !isDoctype(doctype)) {
  8966. doctype = doctype.prev;
  8967. }
  8968. if (!doctype) {
  8969. reporter(MISSING_DOCTYPE);
  8970. return;
  8971. }
  8972. var doctypeId = doctype.data.toLowerCase();
  8973. if (doctypeId !== '!doctype html' && doctypeId !== '!doctype html system "about:legacy-compat"') {
  8974. reporter(NON_HTML5_DOCTYPE);
  8975. }
  8976. };
  8977. }
  8978. else {
  8979. /* @covignore */
  8980. return function lintDoctype($, reporter) {
  8981. /*eslint-disable no-undef, block-scoped-var */
  8982. var doc = window.document;// jshint ignore:line
  8983. /*eslint-enable un-undef, block-scoped-var */
  8984. if (doc.doctype === null) {
  8985. reporter(MISSING_DOCTYPE);
  8986. }
  8987. else if (doc.doctype.publicId) {
  8988. reporter(NON_HTML5_DOCTYPE);
  8989. }
  8990. else if (doc.doctype.systemId && doc.doctype.systemId !== "about:legacy-compat") {
  8991. reporter(NON_HTML5_DOCTYPE);
  8992. }
  8993. };
  8994. }
  8995. })());
  8996. addLinter("W001", function lintMetaCharsetUtf8($, reporter) {
  8997. var meta = $('head>meta[charset]');
  8998. var charset = meta.attr('charset');
  8999. if (!charset) {
  9000. reporter('`<head>` is missing UTF-8 charset `<meta>` tag');
  9001. }
  9002. else if (charset.toLowerCase() !== "utf-8") {
  9003. reporter('charset `<meta>` tag is specifying a legacy, non-UTF-8 charset', meta);
  9004. }
  9005. });
  9006. addLinter("W002", function lintXUaCompatible($, reporter) {
  9007. var meta = $([
  9008. 'head>meta[http-equiv="X-UA-Compatible"][content="IE=edge"]',
  9009. 'head>meta[http-equiv="x-ua-compatible"][content="ie=edge"]'
  9010. ].join(','));
  9011. if (!meta.length) {
  9012. reporter("`<head>` is missing X-UA-Compatible `<meta>` tag that disables old IE compatibility modes");
  9013. }
  9014. });
  9015. addLinter("W003", function lintViewport($, reporter) {
  9016. var meta = $('head>meta[name="viewport"][content]');
  9017. if (!meta.length) {
  9018. reporter("`<head>` is missing viewport `<meta>` tag that enables responsiveness");
  9019. }
  9020. });
  9021. addLinter("E002", function lintBootstrapv2($, reporter) {
  9022. var columnClasses = [];
  9023. for (var n = 1; n <= 12; n++) {
  9024. columnClasses.push('.span' + n);
  9025. }
  9026. var selector = columnClasses.join(',');
  9027. var spanNs = $(selector);
  9028. if (spanNs.length) {
  9029. reporter("Found one or more uses of outdated Bootstrap v2 `.spanN` grid classes", spanNs);
  9030. }
  9031. });
  9032. addLinter("E003", function lintContainers($, reporter) {
  9033. var notAnyColClass = COL_CLASSES.map(function (colClass) {
  9034. return ':not(' + colClass + ')';
  9035. }).join('');
  9036. var selector = '*' + notAnyColClass + '>.row';
  9037. var rowsOutsideColumns = $(selector);
  9038. var rowsOutsideColumnsAndContainers = rowsOutsideColumns.filter(function () {
  9039. var parent = $(this).parent();
  9040. while (parent.length) {
  9041. if (parent.is('.container, .container-fluid')) {
  9042. return false;
  9043. }
  9044. parent = $(parent).parent();
  9045. }
  9046. return true;
  9047. });
  9048. if (rowsOutsideColumnsAndContainers.length) {
  9049. reporter("Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`", rowsOutsideColumnsAndContainers);
  9050. }
  9051. });
  9052. addLinter("E004", function lintNestedContainers($, reporter) {
  9053. var nestedContainers = $('.container, .container-fluid').children('.container, .container-fluid');
  9054. if (nestedContainers.length) {
  9055. reporter("Containers (`.container` and `.container-fluid`) are not nestable", nestedContainers);
  9056. }
  9057. });
  9058. addLinter("E005", function lintRowAndColOnSameElem($, reporter) {
  9059. var selector = COL_CLASSES.map(function (col) {
  9060. return ".row" + col;
  9061. }).join(',');
  9062. var rowCols = $(selector);
  9063. if (rowCols.length) {
  9064. reporter("Found both `.row` and `.col-*-*` used on the same element", rowCols);
  9065. }
  9066. });
  9067. addLinter("W004", function lintRemoteModals($, reporter) {
  9068. var remoteModalTriggers = $('[data-toggle="modal"][data-remote]');
  9069. if (remoteModalTriggers.length) {
  9070. reporter("Found one or more modals using the deprecated `remote` option", remoteModalTriggers);
  9071. }
  9072. });
  9073. addLinter("W005", function lintJquery($, reporter) {
  9074. var OLD_JQUERY = "Found what might be an outdated version of jQuery; Bootstrap requires jQuery v" + MIN_JQUERY_VERSION + " or higher";
  9075. var NO_JQUERY_BUT_BS_JS = "Unable to locate jQuery, which is required for Bootstrap's JavaScript plugins to work";
  9076. var NO_JQUERY_NOR_BS_JS = "Unable to locate jQuery, which is required for Bootstrap's JavaScript plugins to work; however, you might not be using Bootstrap's JavaScript";
  9077. var bsScripts = bootstrapScriptsIn($);
  9078. var hasBsJs = !!(bsScripts.minifieds.length || bsScripts.longhands.length);
  9079. var theWindow = null;
  9080. try {
  9081. /*eslint-disable no-undef, block-scoped-var */
  9082. theWindow = window;// jshint ignore:line
  9083. /*eslint-enable no-undef, block-scoped-var */
  9084. }
  9085. catch (e) {
  9086. // deliberately do nothing
  9087. }
  9088. /* @covignore */
  9089. if (theWindow) {
  9090. // check browser global jQuery
  9091. var globaljQuery = theWindow.$ || theWindow.jQuery;
  9092. if (globaljQuery) {
  9093. var globalVersion = null;
  9094. try {
  9095. globalVersion = globaljQuery.fn.jquery.split(' ')[0];
  9096. }
  9097. catch (e) {
  9098. // skip; not actually jQuery?
  9099. }
  9100. if (globalVersion) {
  9101. // pad out short version numbers (e.g. '1.7')
  9102. while (globalVersion.match(/\./g).length < 2) {
  9103. globalVersion += ".0";
  9104. }
  9105. var upToDate = null;
  9106. try {
  9107. upToDate = semver.gte(globalVersion, MIN_JQUERY_VERSION, true);
  9108. }
  9109. catch (e) {
  9110. // invalid version number
  9111. }
  9112. if (upToDate === false) {
  9113. reporter(OLD_JQUERY);
  9114. }
  9115. if (upToDate !== null) {
  9116. return;
  9117. }
  9118. }
  9119. }
  9120. }
  9121. // check for jQuery <script>s
  9122. var jqueries = $([
  9123. 'script[src*="jquery"]',
  9124. 'script[src*="jQuery"]'
  9125. ].join(','));
  9126. if (!jqueries.length) {
  9127. reporter(hasBsJs ? NO_JQUERY_BUT_BS_JS : NO_JQUERY_NOR_BS_JS);
  9128. return;
  9129. }
  9130. jqueries.each(function () {
  9131. var script = $(this);
  9132. var pathSegments = parseUrl(script.attr('src')).pathname.split('/');
  9133. var filename = pathSegments[pathSegments.length - 1];
  9134. if (!/^j[qQ]uery(\.min)?\.js$/.test(filename)) {
  9135. return;
  9136. }
  9137. var versions = versionsIn(pathSegments);
  9138. if (!versions.length) {
  9139. return;
  9140. }
  9141. var version = versions[versions.length - 1];
  9142. if (!semver.gte(version, MIN_JQUERY_VERSION, true)) {
  9143. reporter(OLD_JQUERY, script);
  9144. }
  9145. });
  9146. });
  9147. addLinter("E006", function lintInputGroupFormControlTypes($, reporter) {
  9148. var selectInputGroups = $('.input-group select');
  9149. if (selectInputGroups.length) {
  9150. reporter("`.input-group` contains a `<select>`; this should be avoided as `<select>`s cannot be fully styled in WebKit browsers", selectInputGroups);
  9151. }
  9152. var textareaInputGroups = $('.input-group textarea');
  9153. if (textareaInputGroups.length) {
  9154. reporter("`.input-group` contains a `<textarea>`; only text-based `<input>`s are permitted in an `.input-group`", textareaInputGroups);
  9155. }
  9156. });
  9157. addLinter("E007", function lintBootstrapJs($, reporter) {
  9158. var scripts = bootstrapScriptsIn($);
  9159. if (scripts.longhands.length && scripts.minifieds.length) {
  9160. reporter("Only one copy of Bootstrap's JS should be included; currently the webpage includes both bootstrap.js and bootstrap.min.js", scripts.longhands.add(scripts.minifieds));
  9161. }
  9162. });
  9163. addLinter("W006", function lintTooltipsOnDisabledElems($, reporter) {
  9164. var selector = [
  9165. '[disabled][data-toggle="tooltip"]',
  9166. '.disabled[data-toggle="tooltip"]',
  9167. '[disabled][data-toggle="popover"]',
  9168. '.disabled[data-toggle="popover"]'
  9169. ].join(',');
  9170. var disabledWithTooltips = $(selector);
  9171. if (disabledWithTooltips.length) {
  9172. reporter(
  9173. "Tooltips and popovers on disabled elements cannot be triggered by user interaction unless the element becomes enabled." +
  9174. " To have tooltips and popovers be triggerable by the user even when their associated element is disabled," +
  9175. " put the disabled element inside a wrapper `<div>` and apply the tooltip or popover to the wrapper `<div>` instead.",
  9176. disabledWithTooltips
  9177. );
  9178. }
  9179. });
  9180. addLinter("W008", function lintTooltipsInBtnGroups($, reporter) {
  9181. var nonBodyContainers = $('.btn-group [data-toggle="tooltip"]:not([data-container="body"]), .btn-group [data-toggle="popover"]:not([data-container="body"])');
  9182. if (nonBodyContainers.length) {
  9183. reporter("Tooltips and popovers within button groups should have their `container` set to 'body'. Found tooltips/popovers that might lack this setting.", nonBodyContainers);
  9184. }
  9185. });
  9186. addLinter("E009", function lintMissingInputGroupSizes($, reporter) {
  9187. var selector = [
  9188. '.input-group:not(.input-group-lg) .btn-lg',
  9189. '.input-group:not(.input-group-lg) .input-lg',
  9190. '.input-group:not(.input-group-sm) .btn-sm',
  9191. '.input-group:not(.input-group-sm) .input-sm'
  9192. ].join(',');
  9193. var badInputGroupSizing = $(selector);
  9194. if (badInputGroupSizing.length) {
  9195. reporter("Button and input sizing within `.input-group`s can cause issues. Instead, use input group sizing classes `.input-group-lg` or `.input-group-sm`", badInputGroupSizing);
  9196. }
  9197. });
  9198. addLinter("E010", function lintMultipleFormControlsInInputGroup($, reporter) {
  9199. var badInputGroups = $('.input-group').filter(function (i, inputGroup) {
  9200. return $(inputGroup).find('.form-control').length > 1;
  9201. });
  9202. if (badInputGroups.length) {
  9203. reporter("Input groups cannot contain multiple `.form-control`s", badInputGroups);
  9204. }
  9205. });
  9206. addLinter("E011", function lintFormGroupMixedWithInputGroup($, reporter) {
  9207. var badMixes = $('.input-group.form-group');
  9208. if (badMixes.length) {
  9209. reporter("`.input-group` and `.form-group` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`", badMixes);
  9210. }
  9211. });
  9212. addLinter("E012", function lintGridClassMixedWithInputGroup($, reporter) {
  9213. var selector = COL_CLASSES.map(function (colClass) {
  9214. return '.input-group' + colClass;
  9215. }).join(',');
  9216. var badMixes = $(selector);
  9217. if (badMixes.length) {
  9218. reporter("`.input-group` and `.col-*-*` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.col-*-*`", badMixes);
  9219. }
  9220. });
  9221. addLinter("E013", function lintRowChildrenAreCols($, reporter) {
  9222. var ALLOWED_CHILDREN = COL_CLASSES.concat(['script', '.clearfix', '.bs-customizer-input']);
  9223. var selector = '.row>*' + ALLOWED_CHILDREN.map(function (colClass) {
  9224. return ':not(' + colClass + ')';
  9225. }).join('');
  9226. var nonColRowChildren = $(selector);
  9227. if (nonColRowChildren.length) {
  9228. reporter("Only columns (`.col-*-*`) may be children of `.row`s", nonColRowChildren);
  9229. }
  9230. });
  9231. addLinter("E014", function lintColParentsAreRowsOrFormGroups($, reporter) {
  9232. var selector = COL_CLASSES.map(function (colClass) {
  9233. return '*:not(.row):not(.form-group)>' + colClass + ':not(col):not(th):not(td)';
  9234. }).join(',');
  9235. var colsOutsideRowsAndFormGroups = $(selector);
  9236. if (colsOutsideRowsAndFormGroups.length) {
  9237. reporter("Columns (`.col-*-*`) can only be children of `.row`s or `.form-group`s", colsOutsideRowsAndFormGroups);
  9238. }
  9239. });
  9240. addLinter("E015", function lintInputGroupsWithMultipleAddOnsPerSide($, reporter) {
  9241. var addOnClasses = ['.input-group-addon', '.input-group-btn'];
  9242. var combos = [];
  9243. addOnClasses.forEach(function (first) {
  9244. addOnClasses.forEach(function (second) {
  9245. combos.push('.input-group>' + first + '+' + second);
  9246. });
  9247. });
  9248. var selector = combos.join(',');
  9249. var multipleAddOns = $(selector);
  9250. if (multipleAddOns.length) {
  9251. reporter("Having multiple add-ons on a single side of an input group is not supported", multipleAddOns);
  9252. }
  9253. });
  9254. addLinter("E016", function lintBtnToggle($, reporter) {
  9255. var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
  9256. if (badBtnToggle.length) {
  9257. reporter("`.btn.dropdown-toggle` must be the last button in a button group.", badBtnToggle);
  9258. }
  9259. });
  9260. addLinter("W007", function lintBtnType($, reporter) {
  9261. var badBtnType = $('button:not([type="submit"], [type="reset"], [type="button"])');
  9262. if (badBtnType.length) {
  9263. reporter("Found one or more `<button>`s missing a `type` attribute.", badBtnType);
  9264. }
  9265. });
  9266. addLinter("E017", function lintBlockCheckboxes($, reporter) {
  9267. var badCheckboxes = $('.checkbox').filter(function (i, div) {
  9268. return $(div).filter(':has(>label>input[type="checkbox"])').length <= 0;
  9269. });
  9270. if (badCheckboxes.length) {
  9271. reporter('Incorrect markup used with the `.checkbox` class. The correct markup structure is .checkbox>label>input[type="checkbox"]', badCheckboxes);
  9272. }
  9273. });
  9274. addLinter("E018", function lintBlockRadios($, reporter) {
  9275. var badRadios = $('.radio').filter(function (i, div) {
  9276. return $(div).filter(':has(>label>input[type="radio"])').length <= 0;
  9277. });
  9278. if (badRadios.length) {
  9279. reporter('Incorrect markup used with the `.radio` class. The correct markup structure is .radio>label>input[type="radio"]', badRadios);
  9280. }
  9281. });
  9282. addLinter("E019", function lintInlineCheckboxes($, reporter) {
  9283. var wrongElems = $('.checkbox-inline:not(label)');
  9284. if (wrongElems.length) {
  9285. reporter("`.checkbox-inline` should only be used on `<label>` elements", wrongElems);
  9286. }
  9287. var badStructures = $('.checkbox-inline').filter(function (i, label) {
  9288. return $(label).children('input[type="checkbox"]').length <= 0;
  9289. });
  9290. if (badStructures.length) {
  9291. reporter('Incorrect markup used with the `.checkbox-inline` class. The correct markup structure is label.checkbox-inline>input[type="checkbox"]', badStructures);
  9292. }
  9293. });
  9294. addLinter("E020", function lintInlineRadios($, reporter) {
  9295. var wrongElems = $('.radio-inline:not(label)');
  9296. if (wrongElems.length) {
  9297. reporter("`.radio-inline` should only be used on `<label>` elements", wrongElems);
  9298. }
  9299. var badStructures = $('.radio-inline').filter(function (i, label) {
  9300. return $(label).children('input[type="radio"]').length <= 0;
  9301. });
  9302. if (badStructures.length) {
  9303. reporter('Incorrect markup used with the `.radio-inline` class. The correct markup structure is label.radio-inline>input[type="radio"]', badStructures);
  9304. }
  9305. });
  9306. addLinter("E021", function lintButtonsCheckedActive($, reporter) {
  9307. var selector = [
  9308. '[data-toggle="buttons"]>label:not(.active)>input[type="checkbox"][checked]',
  9309. '[data-toggle="buttons"]>label.active>input[type="checkbox"]:not([checked])',
  9310. '[data-toggle="buttons"]>label:not(.active)>input[type="radio"][checked]',
  9311. '[data-toggle="buttons"]>label.active>input[type="radio"]:not([checked])'
  9312. ].join(',');
  9313. var mismatchedButtonInputs = $(selector);
  9314. if (mismatchedButtonInputs.length) {
  9315. reporter("`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin", mismatchedButtonInputs);
  9316. }
  9317. });
  9318. addLinter("E022", function lintModalsWithinOtherComponents($, reporter) {
  9319. var selector = [
  9320. '.table .modal',
  9321. '.navbar .modal'
  9322. ].join(',');
  9323. var badNestings = $(selector);
  9324. if (badNestings.length) {
  9325. reporter("Modal markup should not be placed within other components, so as to avoid the component's styles interfering with the modal's appearance or functionality", badNestings);
  9326. }
  9327. });
  9328. addLinter("E023", function lintPanelBodyWithoutPanel($, reporter) {
  9329. var badPanelBody = $('.panel-body').parent(':not(.panel, .panel-collapse)');
  9330. if (badPanelBody.length) {
  9331. reporter("`.panel-body` must have a `.panel` or `.panel-collapse` parent", badPanelBody);
  9332. }
  9333. });
  9334. addLinter("E024", function lintPanelHeadingWithoutPanel($, reporter) {
  9335. var badPanelHeading = $('.panel-heading').parent(':not(.panel)');
  9336. if (badPanelHeading.length) {
  9337. reporter("`.panel-heading` must have a `.panel` parent", badPanelHeading);
  9338. }
  9339. });
  9340. addLinter("E025", function lintPanelFooterWithoutPanel($, reporter) {
  9341. var badPanelFooter = $('.panel-footer').parent(':not(.panel, .panel-collapse)');
  9342. if (badPanelFooter.length) {
  9343. reporter("`.panel-footer` must have a `.panel` or `.panel-collapse` parent", badPanelFooter);
  9344. }
  9345. });
  9346. addLinter("E026", function lintPanelTitleWithoutPanelHeading($, reporter) {
  9347. var badPanelTitle = $('.panel-title').parent(':not(.panel-heading)');
  9348. if (badPanelTitle.length) {
  9349. reporter("`.panel-title` must have a `.panel-heading` parent", badPanelTitle);
  9350. }
  9351. });
  9352. addLinter("E027", function lintTableResponsive($, reporter) {
  9353. var badStructure = $('.table.table-responsive, table.table-responsive');
  9354. if (badStructure.length) {
  9355. reporter("`.table-responsive` is supposed to be used on the table's parent wrapper `<div>`, not on the table itself", badStructure);
  9356. }
  9357. });
  9358. addLinter("E028", function lintFormControlFeedbackWithoutHasFeedback($, reporter) {
  9359. var ancestorsMissingClasses = $('.form-control-feedback').filter(function () {
  9360. return $(this).closest('.form-group.has-feedback').length !== 1;
  9361. });
  9362. if (ancestorsMissingClasses.length) {
  9363. reporter("`.form-control-feedback` must have a `.form-group.has-feedback` ancestor", ancestorsMissingClasses);
  9364. }
  9365. });
  9366. addLinter("E029", function lintRedundantColumnClasses($, reporter) {
  9367. var columns = $(COL_CLASSES.join(','));
  9368. columns.each(function (_index, col) {
  9369. var column = $(col);
  9370. var classes = column.attr('class');
  9371. var simplifiedClasses = classes;
  9372. var width2screens = width2screensFor(classes);
  9373. var isRedundant = false;
  9374. for (var width = 1; width <= NUM_COLS; width++) {
  9375. var screens = width2screens[width];
  9376. if (!screens) {
  9377. continue;
  9378. }
  9379. var runs = incrementingRunsFrom(screens);
  9380. if (!runs.length) {
  9381. continue;
  9382. }
  9383. isRedundant = true;
  9384. for (var i = 0; i < runs.length; i++) {
  9385. var run = runs[i];
  9386. var min = run[0];
  9387. var max = run[1];
  9388. // remove redundant classes
  9389. for (var screenNum = min + 1; screenNum <= max; screenNum++) {
  9390. var colClass = 'col-' + NUM2SCREEN[screenNum] + '-' + width;
  9391. simplifiedClasses = withoutClass(simplifiedClasses, colClass);
  9392. }
  9393. }
  9394. }
  9395. if (!isRedundant) {
  9396. return;
  9397. }
  9398. simplifiedClasses = sortedColumnClasses(simplifiedClasses);
  9399. simplifiedClasses = simplifiedClasses.replace(/ {2,}/g, ' ').trim();
  9400. var oldClass = '`class="' + classes + '"`';
  9401. var newClass = '`class="' + simplifiedClasses + '"`';
  9402. reporter(
  9403. "Since grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes (unless overridden by grid classes targeting larger screens), " +
  9404. oldClass + " is redundant and can be simplified to " + newClass,
  9405. column
  9406. );
  9407. });
  9408. });
  9409. addLinter("E030", function lintSoloGlyphiconClasses($, reporter) {
  9410. var missingGlyphiconClass = $('[class*="glyphicon-"]:not(.glyphicon):not(.glyphicon-class)').filter(function () {
  9411. return /\bglyphicon-([a-zA-Z]+)\b/.test($(this).attr('class'));
  9412. });
  9413. if (missingGlyphiconClass.length) {
  9414. reporter("Found elements with a `.glyphicon-*` class that were missing the additional required `.glyphicon` class.", missingGlyphiconClass);
  9415. }
  9416. });
  9417. addLinter("E031", function lintGlyphiconOnNonEmptyElement($, reporter) {
  9418. var glyphiconNotEmpty = $('.glyphicon:not(:empty)');
  9419. if (glyphiconNotEmpty.length) {
  9420. reporter("Glyphicon classes must only be used on elements that contain no text content and have no child elements.", glyphiconNotEmpty);
  9421. }
  9422. });
  9423. addLinter("E032", function lintModalStructure($, reporter) {
  9424. var elements;
  9425. elements = $('.modal-dialog').parent(':not(.modal)');
  9426. if (elements.length) {
  9427. reporter("`.modal-dialog` must be a child of `.modal`", elements);
  9428. }
  9429. elements = $('.modal-content').parent(':not(.modal-dialog)');
  9430. if (elements.length) {
  9431. reporter("`.modal-content` must be a child of `.modal-dialog`", elements);
  9432. }
  9433. elements = $('.modal-header').parent(':not(.modal-content)');
  9434. if (elements.length) {
  9435. reporter("`.modal-header` must be a child of `.modal-content`", elements);
  9436. }
  9437. elements = $('.modal-body').parent(':not(.modal-content)');
  9438. if (elements.length) {
  9439. reporter("`.modal-body` must be a child of `.modal-content`", elements);
  9440. }
  9441. elements = $('.modal-footer').parent(':not(.modal-content)');
  9442. if (elements.length) {
  9443. reporter("`.modal-footer` must be a child of `.modal-content`", elements);
  9444. }
  9445. elements = $('.modal-title').parent(':not(.modal-header)');
  9446. if (elements.length) {
  9447. reporter("`.modal-title` must be a child of `.modal-header`", elements);
  9448. }
  9449. });
  9450. addLinter("E033", function lintAlertMissingDismissible($, reporter) {
  9451. var alertsMissingDismissible = $('.alert:not(.alert-dismissible):has([data-dismiss="alert"])');
  9452. if (alertsMissingDismissible.length) {
  9453. reporter('`.alert` with dismiss button must have class `.alert-dismissible`', alertsMissingDismissible);
  9454. }
  9455. });
  9456. addLinter("E034", function lintAlertDismissStructure($, reporter) {
  9457. var nonFirstChildCloses = $('.alert>.close:not(:first-child)');
  9458. var closesPrecededByText = $('.alert>.close').filter(function () {
  9459. var firstNode = $(this).parent().contents().eq(0);
  9460. var firstNodeIsText = IN_NODE_JS ? firstNode[0].type === 'text' : firstNode[0].nodeType === 3;
  9461. return !!(firstNodeIsText && firstNode.text().trim());
  9462. });
  9463. var problematicCloses = nonFirstChildCloses.add(closesPrecededByText);
  9464. if (problematicCloses.length) {
  9465. reporter('`.close` button for `.alert` must be the first element in the `.alert`', problematicCloses);
  9466. }
  9467. });
  9468. addLinter("E035", function lintFormGroupWithFormClass($, reporter) {
  9469. var badFormGroups = $('.form-group.form-inline, .form-group.form-horizontal');
  9470. if (badFormGroups.length) {
  9471. reporter('Neither `.form-inline` nor `.form-horizontal` should be used directly on a `.form-group`. Instead, nest the `.form-group` within the `.form-inline` or `.form-horizontal`', badFormGroups);
  9472. }
  9473. });
  9474. addLinter("E036", function lintMultipleInputGroupButtons($, reporter) {
  9475. $('.input-group-btn').each(function () {
  9476. ['.btn:not(.dropdown-toggle)', '.dropdown-menu'].forEach(function (selector) {
  9477. var elements = $(this).children(selector);
  9478. if (elements.length > 1) {
  9479. reporter('Having multiple `' + selector.split(':')[0] + '`s inside of a single `.input-group-btn` is not supported', elements.slice(1));
  9480. }
  9481. }, this);
  9482. });
  9483. });
  9484. addLinter("E037", function lintColZeros($, reporter) {
  9485. var selector = SCREENS.map(function (screen) {
  9486. return ".col-" + screen + "-0";
  9487. }).join(',');
  9488. var elements = $(selector);
  9489. if (elements.length) {
  9490. reporter("Column widths must be positive integers (and <= 12 by default). Found usage(s) of invalid nonexistent `.col-*-0` classes.", elements);
  9491. }
  9492. });
  9493. addLinter("E038", function lintMediaPulls($, reporter) {
  9494. var mediaPullsOutsideMedia = $('.media-left, .media-right').filter(function () {
  9495. return !($(this).parent().closest('.media').length);
  9496. });
  9497. if (mediaPullsOutsideMedia.length) {
  9498. reporter('`.media-left` and `.media-right` should not be used outside of `.media` objects.', mediaPullsOutsideMedia);
  9499. }
  9500. });
  9501. addLinter("E039", function lintNavbarPulls($, reporter) {
  9502. var navbarPullsOutsideNavbars = $('.navbar-left, .navbar-right').filter(function () {
  9503. return !($(this).parent().closest('.navbar').length);
  9504. });
  9505. if (navbarPullsOutsideNavbars.length) {
  9506. reporter('`.navbar-left` and `.navbar-right` should not be used outside of navbars.', navbarPullsOutsideNavbars);
  9507. }
  9508. });
  9509. addLinter("E040", function lintModalHide($, reporter) {
  9510. var modalsWithHide = $('.modal.hide');
  9511. if (modalsWithHide.length) {
  9512. reporter('`.hide` should not be used on `.modal` in Bootstrap v3.', modalsWithHide);
  9513. }
  9514. });
  9515. addLinter("E041", function lintCarouselStructure($, reporter) {
  9516. var carouselsWithWrongInners = $('.carousel').filter(function () {
  9517. return $(this).children('.carousel-inner').length !== 1;
  9518. });
  9519. if (carouselsWithWrongInners.length) {
  9520. reporter('`.carousel` must have exactly one `.carousel-inner` child.', carouselsWithWrongInners);
  9521. }
  9522. var innersWithWrongActiveItems = $('.carousel-inner').filter(function () {
  9523. return $(this).children('.item.active').length !== 1;
  9524. });
  9525. if (innersWithWrongActiveItems.length) {
  9526. reporter('`.carousel-inner` must have exactly one `.item.active` child.', innersWithWrongActiveItems);
  9527. }
  9528. });
  9529. addLinter("W009", function lintEmptySpacerCols($, reporter) {
  9530. var selector = COL_CLASSES.map(function (colClass) {
  9531. return colClass + ':not(:last-child)';
  9532. }).join(',');
  9533. var columns = $(selector);
  9534. columns.each(function (_index, col) {
  9535. var column = $(col);
  9536. var isVoidElement = voidElements[col.tagName.toLowerCase()];
  9537. // can't just use :empty because :empty excludes nodes with all-whitespace text content
  9538. var hasText = !!column.text().trim().length;
  9539. var hasChildren = !!column.children(':first-child').length;
  9540. if (hasChildren || hasText || isVoidElement) {
  9541. return;
  9542. }
  9543. var colClasses = column.attr('class').split(/\s+/g).filter(function (klass) {
  9544. return COL_REGEX.test(klass);
  9545. });
  9546. colClasses = sortedColumnClasses(colClasses.join(' ')).trim();
  9547. var colRegex = new RegExp('\\b(col-)(' + SCREENS.join('|') + ')(-\\d+)\\b', 'g');
  9548. var offsetClasses = colClasses.replace(colRegex, '$1$2-offset$3');
  9549. reporter("Using empty spacer columns isn't necessary with Bootstrap's grid. So instead of having an empty grid column with " + '`class="' + colClasses + '"` , just add `class="' + offsetClasses + '"` to the next grid column.', column);
  9550. });
  9551. });
  9552. addLinter("W010", function lintMediaPulls($, reporter) {
  9553. var mediaPulls = $('.media>.pull-left, .media>.pull-right');
  9554. if (mediaPulls.length) {
  9555. reporter('Using `.pull-left` or `.pull-right` as part of the media object component is deprecated as of Bootstrap v3.3.0. Use `.media-left` or `.media-right` instead.', mediaPulls);
  9556. }
  9557. });
  9558. addLinter("W012", function lintNavbarContainers($, reporter) {
  9559. var navBars = $('.navbar');
  9560. var containers = [
  9561. '.container',
  9562. '.container-fluid'
  9563. ].join(',');
  9564. navBars.each(function () {
  9565. var navBar = $(this);
  9566. var hasContainerChildren = !!navBar.children(containers).length;
  9567. if (!hasContainerChildren) {
  9568. reporter('`.container` or `.container-fluid` should be the first child inside of a `.navbar`', navBar);
  9569. }
  9570. });
  9571. });
  9572. addLinter("W013", function lintOutdatedBootstrap($, reporter) {
  9573. var OUTDATED_BOOTSTRAP = "Bootstrap version might be outdated. Latest version is at least " + CURRENT_BOOTSTRAP_VERSION + " ; saw what appears to be usage of Bootstrap ";
  9574. var theWindow = getBrowserWindowObject();
  9575. var globaljQuery = theWindow && (theWindow.$ || theWindow.jQuery);
  9576. /* @covignore */
  9577. if (globaljQuery) {
  9578. var versions = jqueryPluginVersions(globaljQuery);
  9579. if (versions.length) {
  9580. var minVersion = versions[0];
  9581. if (semver.lt(minVersion, CURRENT_BOOTSTRAP_VERSION, true)) {
  9582. reporter(OUTDATED_BOOTSTRAP + minVersion);
  9583. return;
  9584. }
  9585. }
  9586. }
  9587. // check for Bootstrap <link>s and <script>s
  9588. var bootstraps = $(BOOTSTRAP_FILES);
  9589. bootstraps.each(function () {
  9590. var version = versionInLinkedElement($, this);
  9591. if (version === null) {
  9592. return;
  9593. }
  9594. if (semver.lt(version, CURRENT_BOOTSTRAP_VERSION, true)) {
  9595. reporter(OUTDATED_BOOTSTRAP + version, $(this));
  9596. }
  9597. });
  9598. });
  9599. addLinter("W014", function lintCarouselControls($, reporter) {
  9600. var controls = $('.carousel-indicators > li, .carousel-control');
  9601. controls.each(function (_index, cont) {
  9602. var control = $(cont);
  9603. var target = control.attr('href') || control.attr('data-target');
  9604. var carousel = $(target);
  9605. if (!carousel.length || carousel.is(':not(.carousel)')) {
  9606. reporter('Carousel controls and indicators should use `href` or `data-target` to reference an element with class `.carousel`.', control);
  9607. }
  9608. });
  9609. });
  9610. addLinter("W015", function lintNewBootstrap($, reporter) {
  9611. var FUTURE_VERSION_ERROR = "Detected what appears to be Bootstrap v4 or later. This version of Bootlint only supports Bootstrap v3.";
  9612. var theWindow = getBrowserWindowObject();
  9613. var globaljQuery = theWindow && (theWindow.$ || theWindow.jQuery);
  9614. /* @covignore */
  9615. if (globaljQuery) {
  9616. var versions = jqueryPluginVersions(globaljQuery);
  9617. if (versions.length) {
  9618. var minVersion = versions[0];
  9619. if (semver.gte(minVersion, BOOTSTRAP_VERSION_4, true)) {
  9620. reporter(FUTURE_VERSION_ERROR);
  9621. return;
  9622. }
  9623. }
  9624. }
  9625. // check for Bootstrap <link>s and <script>s
  9626. var bootstraps = $(BOOTSTRAP_FILES);
  9627. bootstraps.each(function () {
  9628. var version = versionInLinkedElement($, this);
  9629. if (version === null) {
  9630. return;
  9631. }
  9632. if (semver.gte(version, BOOTSTRAP_VERSION_4, true)) {
  9633. reporter(FUTURE_VERSION_ERROR, $(this));
  9634. }
  9635. });
  9636. });
  9637. exports._lint = function ($, reporter, disabledIdList, html) {
  9638. var locationIndex = IN_NODE_JS ? new LocationIndex(html) : null;
  9639. var reporterWrapper = IN_NODE_JS ? function (problem) {
  9640. if (problem.elements) {
  9641. problem.elements = problem.elements.each(function (i, element) {
  9642. if (element.startIndex !== undefined) {
  9643. var location = locationIndex.locationOf(element.startIndex);
  9644. if (location) {
  9645. element.startLocation = location;
  9646. }
  9647. }
  9648. });
  9649. }
  9650. reporter(problem);
  9651. } : reporter;
  9652. var disabledIdSet = {};
  9653. disabledIdList.forEach(function (disabledId) {
  9654. disabledIdSet[disabledId] = true;
  9655. });
  9656. Object.keys(allLinters).sort().forEach(function (linterId) {
  9657. if (!disabledIdSet[linterId]) {
  9658. allLinters[linterId]($, reporterWrapper);
  9659. }
  9660. });
  9661. };
  9662. /**
  9663. * @callback reporter
  9664. * @param {LintWarning|LintError} problem A lint problem
  9665. * @returns {undefined} Any return value is ignored.
  9666. */
  9667. if (IN_NODE_JS) {
  9668. // cheerio; Node.js
  9669. /**
  9670. * Lints the given HTML.
  9671. * @param {string} html The HTML to lint
  9672. * @param {reporter} reporter Function to call with each lint problem
  9673. * @param {string[]} disabledIds Array of string IDs of linters to disable
  9674. * @returns {undefined} Nothing
  9675. */
  9676. exports.lintHtml = function (html, reporter, disabledIds) {
  9677. var $ = cheerio.load(html, {withStartIndices: true});
  9678. this._lint($, reporter, disabledIds, html);
  9679. };
  9680. }
  9681. else {
  9682. // jQuery; in-browser
  9683. /* @covignore */
  9684. (function () {
  9685. var $ = cheerio;
  9686. /**
  9687. * Lints the HTML of the current document.
  9688. * @param {reporter} reporter Function to call with each lint problem
  9689. * @param {string[]} disabledIds Array of string IDs of linters to disable
  9690. * @returns {undefined} Nothing
  9691. */
  9692. exports.lintCurrentDocument = function (reporter, disabledIds) {
  9693. this._lint($, reporter, disabledIds);
  9694. };
  9695. /**
  9696. * Lints the HTML of the current document.
  9697. * If there are any lint warnings, one general notification message will be window.alert()-ed to the user.
  9698. * Each warning will be output individually using console.warn().
  9699. * @param {string[]} disabledIds Array of string IDs of linters to disable
  9700. * @param {object} [alertOpts] Options object to configure alert()ing
  9701. * @param {boolean} [alertOpts.hasProblems=true] Show one alert() when the first lint problem is found?
  9702. * @param {boolean} [alertOpts.problemFree=true] Show one alert() at the end of linting if the page has no lint problems?
  9703. * @returns {undefined} Nothing
  9704. */
  9705. exports.showLintReportForCurrentDocument = function (disabledIds, alertOpts) {
  9706. alertOpts = alertOpts || {};
  9707. var alertOnFirstProblem = alertOpts.hasProblems || alertOpts.hasProblems === undefined;
  9708. var alertIfNoProblems = alertOpts.problemFree || alertOpts.problemFree === undefined;
  9709. var seenLint = false;
  9710. var errorCount = 0;
  9711. var reporter = function (lint) {
  9712. var background = "background: #" + (lint.id[0] === "W" ? "f0ad4e" : "d9534f") + "; color: #ffffff;";
  9713. if (!seenLint) {
  9714. if (alertOnFirstProblem) {
  9715. /*eslint-disable no-alert, no-undef, block-scoped-var */
  9716. window.alert("bootlint found errors in this document! See the JavaScript console for details.");// jshint ignore:line
  9717. /*eslint-enable no-alert, no-undef, block-scoped-var */
  9718. }
  9719. seenLint = true;
  9720. }
  9721. if (!lint.elements.length) {
  9722. console.warn("bootlint: %c " + lint.id + " ", background, lint.message);
  9723. }
  9724. else {
  9725. console.warn("bootlint: %c " + lint.id + " ", background, lint.message + '\n', lint.elements);
  9726. }
  9727. errorCount++;
  9728. };
  9729. this.lintCurrentDocument(reporter, disabledIds);
  9730. if (errorCount > 0) {
  9731. console.info("bootlint: For details, look up the lint problem IDs in the Bootlint wiki: https://github.com/twbs/bootlint/wiki");
  9732. }
  9733. else if (alertIfNoProblems) {
  9734. /*eslint-disable no-alert, no-undef, block-scoped-var */
  9735. window.alert("bootlint found no errors in this document.");// jshint ignore:line
  9736. /*eslint-enable no-alert, no-undef, block-scoped-var */
  9737. }
  9738. };
  9739. /*eslint-disable no-undef, block-scoped-var */
  9740. window.bootlint = exports;// jshint ignore:line
  9741. /*eslint-enable no-undef, block-scoped-var */
  9742. })();
  9743. }
  9744. })(typeof exports === 'object' && exports || this);
  9745. },{"./location":1,"cheerio":2,"semver":3,"url":6,"void-elements":4}],6:[function(require,module,exports){
  9746. /*eslint-env node, browser */
  9747. /* jshint browser: true */
  9748. /**
  9749. * Simple lightweight shim of Node.js's `url.parse()`
  9750. * ( http://nodejs.org/docs/latest/api/url.html )
  9751. * for use within browsers.
  9752. */
  9753. (function () {
  9754. 'use strict';
  9755. // Only properties common to both browsers and Node.js are supported.
  9756. // For what browsers support, see https://developer.mozilla.org/en-US/docs/Web/API/URLUtils
  9757. var URL_PROPERTIES = [
  9758. 'hash',
  9759. 'host',
  9760. 'hostname',
  9761. 'href',
  9762. 'pathname',
  9763. 'port',
  9764. 'protocol',
  9765. 'search'
  9766. ];
  9767. /**
  9768. * @param {string} urlStr URL to parse
  9769. * @returns {object} Object with fields representing the various parts of the parsed URL.
  9770. */
  9771. function parse(urlStr) {
  9772. var anchor = document.createElement('a');
  9773. anchor.href = urlStr;
  9774. var urlObj = {};
  9775. URL_PROPERTIES.forEach(function (property) {
  9776. urlObj[property] = anchor[property];
  9777. });
  9778. return urlObj;
  9779. }
  9780. exports.parse = parse;
  9781. })();
  9782. },{}]},{},[5]);