jquery.js 176 KB

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