jquery-basis.js 160 KB

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