lightbox-plus-jquery.js 257 KB

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