jquery.js 260 KB

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