jquery.js 233 KB

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