assets.js 254 KB

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