jquery.js 269 KB

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