jquery-2.2.2.js 253 KB

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