jquery.js 207 KB

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