select2.full.js 381 KB

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