jquery.js 321 KB

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