jquery.js 212 KB

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