jquery-1.8.2.js 354 KB

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