jquery-1.4.4-uncompressed.js 179 KB

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