jquery-2.2.2.js 254 KB

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