jquery-1.5.1.js 212 KB

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