jquery.js 261 KB

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