daa341eb448907083f19de362d85fe8f39986f5c.svn-base 231 KB

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