jquery-1.10.2.js 312 KB

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