Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

yui.js 268KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477
  1. /*
  2. Copyright (c) 2010, Yahoo! Inc. All rights reserved.
  3. Code licensed under the BSD License:
  4. http://developer.yahoo.com/yui/license.html
  5. version: 3.4.0
  6. build: nightly
  7. */
  8. /**
  9. * The YUI module contains the components required for building the YUI seed
  10. * file. This includes the script loading mechanism, a simple queue, and
  11. * the core utilities for the library.
  12. * @module yui
  13. * @submodule yui-base
  14. */
  15. if (typeof YUI != 'undefined') {
  16. YUI._YUI = YUI;
  17. }
  18. /**
  19. The YUI global namespace object. If YUI is already defined, the
  20. existing YUI object will not be overwritten so that defined
  21. namespaces are preserved. It is the constructor for the object
  22. the end user interacts with. As indicated below, each instance
  23. has full custom event support, but only if the event system
  24. is available. This is a self-instantiable factory function. You
  25. can invoke it directly like this:
  26. YUI().use('*', function(Y) {
  27. // ready
  28. });
  29. But it also works like this:
  30. var Y = YUI();
  31. @class YUI
  32. @constructor
  33. @global
  34. @uses EventTarget
  35. @param o* {Object} 0..n optional configuration objects. these values
  36. are store in Y.config. See <a href="config.html">Config</a> for the list of supported
  37. properties.
  38. */
  39. /*global YUI*/
  40. /*global YUI_config*/
  41. var YUI = function() {
  42. var i = 0,
  43. Y = this,
  44. args = arguments,
  45. l = args.length,
  46. instanceOf = function(o, type) {
  47. return (o && o.hasOwnProperty && (o instanceof type));
  48. },
  49. gconf = (typeof YUI_config !== 'undefined') && YUI_config;
  50. if (!(instanceOf(Y, YUI))) {
  51. Y = new YUI();
  52. } else {
  53. // set up the core environment
  54. Y._init();
  55. /**
  56. YUI.GlobalConfig is a master configuration that might span
  57. multiple contexts in a non-browser environment. It is applied
  58. first to all instances in all contexts.
  59. @property GlobalConfig
  60. @type {Object}
  61. @global
  62. @static
  63. @example
  64. YUI.GlobalConfig = {
  65. filter: 'debug'
  66. };
  67. YUI().use('node', function(Y) {
  68. //debug files used here
  69. });
  70. YUI({
  71. filter: 'min'
  72. }).use('node', function(Y) {
  73. //min files used here
  74. });
  75. */
  76. if (YUI.GlobalConfig) {
  77. Y.applyConfig(YUI.GlobalConfig);
  78. }
  79. /**
  80. YUI_config is a page-level config. It is applied to all
  81. instances created on the page. This is applied after
  82. YUI.GlobalConfig, and before the instance level configuration
  83. objects.
  84. @global
  85. @property YUI_config
  86. @type {Object}
  87. @example
  88. //Single global var to include before YUI seed file
  89. YUI_config = {
  90. filter: 'debug'
  91. };
  92. YUI().use('node', function(Y) {
  93. //debug files used here
  94. });
  95. YUI({
  96. filter: 'min'
  97. }).use('node', function(Y) {
  98. //min files used here
  99. });
  100. */
  101. if (gconf) {
  102. Y.applyConfig(gconf);
  103. }
  104. // bind the specified additional modules for this instance
  105. if (!l) {
  106. Y._setup();
  107. }
  108. }
  109. if (l) {
  110. // Each instance can accept one or more configuration objects.
  111. // These are applied after YUI.GlobalConfig and YUI_Config,
  112. // overriding values set in those config files if there is a '
  113. // matching property.
  114. for (; i < l; i++) {
  115. Y.applyConfig(args[i]);
  116. }
  117. Y._setup();
  118. }
  119. Y.instanceOf = instanceOf;
  120. return Y;
  121. };
  122. (function() {
  123. var proto, prop,
  124. VERSION = '3.4.0',
  125. PERIOD = '.',
  126. BASE = 'http://yui.yahooapis.com/',
  127. DOC_LABEL = 'yui3-js-enabled',
  128. NOOP = function() {},
  129. SLICE = Array.prototype.slice,
  130. APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
  131. 'io.xdrResponse': 1, // can call. this should
  132. 'SWF.eventHandler': 1 }, // be done at build time
  133. hasWin = (typeof window != 'undefined'),
  134. win = (hasWin) ? window : null,
  135. doc = (hasWin) ? win.document : null,
  136. docEl = doc && doc.documentElement,
  137. docClass = docEl && docEl.className,
  138. instances = {},
  139. time = new Date().getTime(),
  140. add = function(el, type, fn, capture) {
  141. if (el && el.addEventListener) {
  142. el.addEventListener(type, fn, capture);
  143. } else if (el && el.attachEvent) {
  144. el.attachEvent('on' + type, fn);
  145. }
  146. },
  147. remove = function(el, type, fn, capture) {
  148. if (el && el.removeEventListener) {
  149. // this can throw an uncaught exception in FF
  150. try {
  151. el.removeEventListener(type, fn, capture);
  152. } catch (ex) {}
  153. } else if (el && el.detachEvent) {
  154. el.detachEvent('on' + type, fn);
  155. }
  156. },
  157. handleLoad = function() {
  158. YUI.Env.windowLoaded = true;
  159. YUI.Env.DOMReady = true;
  160. if (hasWin) {
  161. remove(window, 'load', handleLoad);
  162. }
  163. },
  164. getLoader = function(Y, o) {
  165. var loader = Y.Env._loader;
  166. if (loader) {
  167. //loader._config(Y.config);
  168. loader.ignoreRegistered = false;
  169. loader.onEnd = null;
  170. loader.data = null;
  171. loader.required = [];
  172. loader.loadType = null;
  173. } else {
  174. loader = new Y.Loader(Y.config);
  175. Y.Env._loader = loader;
  176. }
  177. YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, [ 'loader-base', 'loader-rollup', 'loader-yui3' ]));
  178. return loader;
  179. },
  180. clobber = function(r, s) {
  181. for (var i in s) {
  182. if (s.hasOwnProperty(i)) {
  183. r[i] = s[i];
  184. }
  185. }
  186. },
  187. ALREADY_DONE = { success: true };
  188. // Stamp the documentElement (HTML) with a class of "yui-loaded" to
  189. // enable styles that need to key off of JS being enabled.
  190. if (docEl && docClass.indexOf(DOC_LABEL) == -1) {
  191. if (docClass) {
  192. docClass += ' ';
  193. }
  194. docClass += DOC_LABEL;
  195. docEl.className = docClass;
  196. }
  197. if (VERSION.indexOf('@') > -1) {
  198. VERSION = '3.3.0'; // dev time hack for cdn test
  199. }
  200. proto = {
  201. /**
  202. * Applies a new configuration object to the YUI instance config.
  203. * This will merge new group/module definitions, and will also
  204. * update the loader cache if necessary. Updating Y.config directly
  205. * will not update the cache.
  206. * @method applyConfig
  207. * @param {Object} o the configuration object.
  208. * @since 3.2.0
  209. */
  210. applyConfig: function(o) {
  211. o = o || NOOP;
  212. var attr,
  213. name,
  214. // detail,
  215. config = this.config,
  216. mods = config.modules,
  217. groups = config.groups,
  218. rls = config.rls,
  219. loader = this.Env._loader;
  220. for (name in o) {
  221. if (o.hasOwnProperty(name)) {
  222. attr = o[name];
  223. if (mods && name == 'modules') {
  224. clobber(mods, attr);
  225. } else if (groups && name == 'groups') {
  226. clobber(groups, attr);
  227. } else if (rls && name == 'rls') {
  228. clobber(rls, attr);
  229. } else if (name == 'win') {
  230. config[name] = attr.contentWindow || attr;
  231. config.doc = config[name].document;
  232. } else if (name == '_yuid') {
  233. // preserve the guid
  234. } else {
  235. config[name] = attr;
  236. }
  237. }
  238. }
  239. if (loader) {
  240. loader._config(o);
  241. }
  242. },
  243. /**
  244. * Old way to apply a config to the instance (calls `applyConfig` under the hood)
  245. * @private
  246. * @method _config
  247. * @param {Object} o The config to apply
  248. */
  249. _config: function(o) {
  250. this.applyConfig(o);
  251. },
  252. /**
  253. * Initialize this YUI instance
  254. * @private
  255. * @method _init
  256. */
  257. _init: function() {
  258. var filter,
  259. Y = this,
  260. G_ENV = YUI.Env,
  261. Env = Y.Env,
  262. prop;
  263. /**
  264. * The version number of the YUI instance.
  265. * @property version
  266. * @type string
  267. */
  268. Y.version = VERSION;
  269. if (!Env) {
  270. Y.Env = {
  271. core: ['get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3'],
  272. mods: {}, // flat module map
  273. versions: {}, // version module map
  274. base: BASE,
  275. cdn: BASE + VERSION + '/build/',
  276. // bootstrapped: false,
  277. _idx: 0,
  278. _used: {},
  279. _attached: {},
  280. _missed: [],
  281. _yidx: 0,
  282. _uidx: 0,
  283. _guidp: 'y',
  284. _loaded: {},
  285. // serviced: {},
  286. // Regex in English:
  287. // I'll start at the \b(simpleyui).
  288. // 1. Look in the test string for "simpleyui" or "yui" or
  289. // "yui-base" or "yui-rls" or "yui-foobar" that comes after a word break. That is, it
  290. // can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string.
  291. // 2. After #1 must come a forward slash followed by the string matched in #1, so
  292. // "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants".
  293. // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
  294. // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
  295. // 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js"
  296. // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
  297. // then capture the junk between the LAST "&" and the string in 1-4. So
  298. // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-rls/yui-rls.js"
  299. // will capture "3.3.0/build/"
  300. //
  301. // Regex Exploded:
  302. // (?:\? Find a ?
  303. // (?:[^&]*&) followed by 0..n characters followed by an &
  304. // * in fact, find as many sets of characters followed by a & as you can
  305. // ([^&]*) capture the stuff after the last & in \1
  306. // )? but it's ok if all this ?junk&more_junk stuff isn't even there
  307. // \b(simpleyui| after a word break find either the string "simpleyui" or
  308. // yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters
  309. // ) and store the simpleyui or yui-* string in \2
  310. // \/\2 then comes a / followed by the simpleyui or yui-* string in \2
  311. // (?:-(min|debug))? optionally followed by "-min" or "-debug"
  312. // .js and ending in ".js"
  313. _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
  314. parseBasePath: function(src, pattern) {
  315. var match = src.match(pattern),
  316. path, filter;
  317. if (match) {
  318. path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
  319. // this is to set up the path to the loader. The file
  320. // filter for loader should match the yui include.
  321. filter = match[3];
  322. // extract correct path for mixed combo urls
  323. // http://yuilibrary.com/projects/yui3/ticket/2528423
  324. if (match[1]) {
  325. path += '?' + match[1];
  326. }
  327. path = {
  328. filter: filter,
  329. path: path
  330. }
  331. }
  332. return path;
  333. },
  334. getBase: G_ENV && G_ENV.getBase ||
  335. function(pattern) {
  336. var nodes = (doc && doc.getElementsByTagName('script')) || [],
  337. path = Env.cdn, parsed,
  338. i, len, src;
  339. for (i = 0, len = nodes.length; i < len; ++i) {
  340. src = nodes[i].src;
  341. if (src) {
  342. parsed = Y.Env.parseBasePath(src, pattern);
  343. if (parsed) {
  344. filter = parsed.filter;
  345. path = parsed.path;
  346. break;
  347. }
  348. }
  349. }
  350. // use CDN default
  351. return path;
  352. }
  353. };
  354. Env = Y.Env;
  355. Env._loaded[VERSION] = {};
  356. if (G_ENV && Y !== YUI) {
  357. Env._yidx = ++G_ENV._yidx;
  358. Env._guidp = ('yui_' + VERSION + '_' +
  359. Env._yidx + '_' + time).replace(/\./g, '_');
  360. } else if (YUI._YUI) {
  361. G_ENV = YUI._YUI.Env;
  362. Env._yidx += G_ENV._yidx;
  363. Env._uidx += G_ENV._uidx;
  364. for (prop in G_ENV) {
  365. if (!(prop in Env)) {
  366. Env[prop] = G_ENV[prop];
  367. }
  368. }
  369. delete YUI._YUI;
  370. }
  371. Y.id = Y.stamp(Y);
  372. instances[Y.id] = Y;
  373. }
  374. Y.constructor = YUI;
  375. // configuration defaults
  376. Y.config = Y.config || {
  377. win: win,
  378. doc: doc,
  379. debug: true,
  380. useBrowserConsole: true,
  381. throwFail: true,
  382. bootstrap: true,
  383. cacheUse: true,
  384. fetchCSS: true,
  385. use_rls: false,
  386. rls_timeout: 2000
  387. };
  388. if (YUI.Env.rls_disabled) {
  389. Y.config.use_rls = false;
  390. }
  391. Y.config.lang = Y.config.lang || 'en-US';
  392. Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE);
  393. if (!filter || (!('mindebug').indexOf(filter))) {
  394. filter = 'min';
  395. }
  396. filter = (filter) ? '-' + filter : filter;
  397. Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
  398. },
  399. /**
  400. * Finishes the instance setup. Attaches whatever modules were defined
  401. * when the yui modules was registered.
  402. * @method _setup
  403. * @private
  404. */
  405. _setup: function(o) {
  406. var i, Y = this,
  407. core = [],
  408. mods = YUI.Env.mods,
  409. //extras = Y.config.core || ['get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3'];
  410. extras = Y.config.core || [].concat(YUI.Env.core); //Clone it..
  411. for (i = 0; i < extras.length; i++) {
  412. if (mods[extras[i]]) {
  413. core.push(extras[i]);
  414. }
  415. }
  416. Y._attach(['yui-base']);
  417. Y._attach(core);
  418. if (Y.Loader) {
  419. getLoader(Y);
  420. }
  421. },
  422. /**
  423. * Executes a method on a YUI instance with
  424. * the specified id if the specified method is whitelisted.
  425. * @method applyTo
  426. * @param id {String} the YUI instance id.
  427. * @param method {String} the name of the method to exectute.
  428. * Ex: 'Object.keys'.
  429. * @param args {Array} the arguments to apply to the method.
  430. * @return {Object} the return value from the applied method or null.
  431. */
  432. applyTo: function(id, method, args) {
  433. if (!(method in APPLY_TO_AUTH)) {
  434. this.log(method + ': applyTo not allowed', 'warn', 'yui');
  435. return null;
  436. }
  437. var instance = instances[id], nest, m, i;
  438. if (instance) {
  439. nest = method.split('.');
  440. m = instance;
  441. for (i = 0; i < nest.length; i = i + 1) {
  442. m = m[nest[i]];
  443. if (!m) {
  444. this.log('applyTo not found: ' + method, 'warn', 'yui');
  445. }
  446. }
  447. return m.apply(instance, args);
  448. }
  449. return null;
  450. },
  451. /**
  452. Registers a module with the YUI global. The easiest way to create a
  453. first-class YUI module is to use the YUI component build tool.
  454. http://yuilibrary.com/projects/builder
  455. The build system will produce the `YUI.add` wrapper for you module, along
  456. with any configuration info required for the module.
  457. @method add
  458. @param name {String} module name.
  459. @param fn {Function} entry point into the module that is used to bind module to the YUI instance.
  460. @param {YUI} fn.Y The YUI instance this module is executed in.
  461. @param {String} fn.name The name of the module
  462. @param version {String} version string.
  463. @param details {Object} optional config data:
  464. @param details.requires {Array} features that must be present before this module can be attached.
  465. @param details.optional {Array} optional features that should be present if loadOptional
  466. is defined. Note: modules are not often loaded this way in YUI 3,
  467. but this field is still useful to inform the user that certain
  468. features in the component will require additional dependencies.
  469. @param details.use {Array} features that are included within this module which need to
  470. be attached automatically when this module is attached. This
  471. supports the YUI 3 rollup system -- a module with submodules
  472. defined will need to have the submodules listed in the 'use'
  473. config. The YUI component build tool does this for you.
  474. @return {YUI} the YUI instance.
  475. @example
  476. YUI.add('davglass', function(Y, name) {
  477. Y.davglass = function() {
  478. alert('Dav was here!');
  479. };
  480. }, '3.4.0', { requires: ['yui-base', 'harley-davidson', 'mt-dew'] });
  481. */
  482. add: function(name, fn, version, details) {
  483. details = details || {};
  484. var env = YUI.Env,
  485. mod = {
  486. name: name,
  487. fn: fn,
  488. version: version,
  489. details: details
  490. },
  491. loader,
  492. i, versions = env.versions;
  493. env.mods[name] = mod;
  494. versions[version] = versions[version] || {};
  495. versions[version][name] = mod;
  496. for (i in instances) {
  497. if (instances.hasOwnProperty(i)) {
  498. loader = instances[i].Env._loader;
  499. if (loader) {
  500. if (!loader.moduleInfo[name]) {
  501. loader.addModule(details, name);
  502. }
  503. }
  504. }
  505. }
  506. return this;
  507. },
  508. /**
  509. * Executes the function associated with each required
  510. * module, binding the module to the YUI instance.
  511. * @param {Array} r The array of modules to attach
  512. * @param {Boolean} [moot=false] Don't throw a warning if the module is not attached
  513. * @method _attach
  514. * @private
  515. */
  516. _attach: function(r, moot) {
  517. var i, name, mod, details, req, use, after,
  518. mods = YUI.Env.mods,
  519. aliases = YUI.Env.aliases,
  520. Y = this, j,
  521. loader = Y.Env._loader,
  522. done = Y.Env._attached,
  523. len = r.length, loader,
  524. c = [];
  525. //Check for conditional modules (in a second+ instance) and add their requirements
  526. //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass
  527. for (i = 0; i < len; i++) {
  528. name = r[i];
  529. mod = mods[name];
  530. c.push(name);
  531. if (loader && loader.conditions[name]) {
  532. Y.Object.each(loader.conditions[name], function(def) {
  533. var go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y)));
  534. if (go) {
  535. c.push(def.name);
  536. }
  537. });
  538. }
  539. }
  540. r = c;
  541. len = r.length;
  542. for (i = 0; i < len; i++) {
  543. if (!done[r[i]]) {
  544. name = r[i];
  545. mod = mods[name];
  546. if (aliases && aliases[name]) {
  547. Y._attach(aliases[name]);
  548. continue;
  549. }
  550. if (!mod) {
  551. if (loader && loader.moduleInfo[name]) {
  552. mod = loader.moduleInfo[name];
  553. moot = true;
  554. }
  555. //if (!loader || !loader.moduleInfo[name]) {
  556. //if ((!loader || !loader.moduleInfo[name]) && !moot) {
  557. if (!moot) {
  558. if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) {
  559. Y.Env._missed.push(name);
  560. Y.Env._missed = Y.Array.dedupe(Y.Env._missed);
  561. Y.message('NOT loaded: ' + name, 'warn', 'yui');
  562. }
  563. }
  564. } else {
  565. done[name] = true;
  566. //Don't like this, but in case a mod was asked for once, then we fetch it
  567. //We need to remove it from the missed list ^davglass
  568. for (j = 0; j < Y.Env._missed.length; j++) {
  569. if (Y.Env._missed[j] === name) {
  570. Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
  571. Y.Env._missed.splice(j, 1);
  572. }
  573. }
  574. details = mod.details;
  575. req = details.requires;
  576. use = details.use;
  577. after = details.after;
  578. if (req) {
  579. for (j = 0; j < req.length; j++) {
  580. if (!done[req[j]]) {
  581. if (!Y._attach(req)) {
  582. return false;
  583. }
  584. break;
  585. }
  586. }
  587. }
  588. if (after) {
  589. for (j = 0; j < after.length; j++) {
  590. if (!done[after[j]]) {
  591. if (!Y._attach(after, true)) {
  592. return false;
  593. }
  594. break;
  595. }
  596. }
  597. }
  598. if (mod.fn) {
  599. try {
  600. mod.fn(Y, name);
  601. } catch (e) {
  602. Y.error('Attach error: ' + name, e, name);
  603. return false;
  604. }
  605. }
  606. if (use) {
  607. for (j = 0; j < use.length; j++) {
  608. if (!done[use[j]]) {
  609. if (!Y._attach(use)) {
  610. return false;
  611. }
  612. break;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. }
  619. return true;
  620. },
  621. /**
  622. * Attaches one or more modules to the YUI instance. When this
  623. * is executed, the requirements are analyzed, and one of
  624. * several things can happen:
  625. *
  626. * * All requirements are available on the page -- The modules
  627. * are attached to the instance. If supplied, the use callback
  628. * is executed synchronously.
  629. *
  630. * * Modules are missing, the Get utility is not available OR
  631. * the 'bootstrap' config is false -- A warning is issued about
  632. * the missing modules and all available modules are attached.
  633. *
  634. * * Modules are missing, the Loader is not available but the Get
  635. * utility is and boostrap is not false -- The loader is bootstrapped
  636. * before doing the following....
  637. *
  638. * * Modules are missing and the Loader is available -- The loader
  639. * expands the dependency tree and fetches missing modules. When
  640. * the loader is finshed the callback supplied to use is executed
  641. * asynchronously.
  642. *
  643. * @method use
  644. * @param modules* {String} 1-n modules to bind (uses arguments array).
  645. * @param *callback {Function} callback function executed when
  646. * the instance has the required functionality. If included, it
  647. * must be the last parameter.
  648. *
  649. * @example
  650. * // loads and attaches dd and its dependencies
  651. * YUI().use('dd', function(Y) {});
  652. *
  653. * // loads and attaches dd and node as well as all of their dependencies (since 3.4.0)
  654. * YUI().use(['dd', 'node'], function(Y) {});
  655. *
  656. * // attaches all modules that are available on the page
  657. * YUI().use('*', function(Y) {});
  658. *
  659. * // intrinsic YUI gallery support (since 3.1.0)
  660. * YUI().use('gallery-yql', function(Y) {});
  661. *
  662. * // intrinsic YUI 2in3 support (since 3.1.0)
  663. * YUI().use('yui2-datatable', function(Y) {});
  664. *
  665. * @return {YUI} the YUI instance.
  666. */
  667. use: function() {
  668. var args = SLICE.call(arguments, 0),
  669. callback = args[args.length - 1],
  670. Y = this,
  671. i = 0,
  672. name,
  673. Env = Y.Env,
  674. provisioned = true;
  675. // The last argument supplied to use can be a load complete callback
  676. if (Y.Lang.isFunction(callback)) {
  677. args.pop();
  678. } else {
  679. callback = null;
  680. }
  681. if (Y.Lang.isArray(args[0])) {
  682. args = args[0];
  683. }
  684. if (Y.config.cacheUse) {
  685. while ((name = args[i++])) {
  686. if (!Env._attached[name]) {
  687. provisioned = false;
  688. break;
  689. }
  690. }
  691. if (provisioned) {
  692. if (args.length) {
  693. }
  694. Y._notify(callback, ALREADY_DONE, args);
  695. return Y;
  696. }
  697. }
  698. if (Y._loading) {
  699. Y._useQueue = Y._useQueue || new Y.Queue();
  700. Y._useQueue.add([args, callback]);
  701. } else {
  702. Y._use(args, function(Y, response) {
  703. Y._notify(callback, response, args);
  704. });
  705. }
  706. return Y;
  707. },
  708. /**
  709. * Notify handler from Loader for attachment/load errors
  710. * @method _notify
  711. * @param callback {Function} The callback to pass to the `Y.config.loadErrorFn`
  712. * @param response {Object} The response returned from Loader
  713. * @param args {Array} The aruments passed from Loader
  714. * @private
  715. */
  716. _notify: function(callback, response, args) {
  717. if (!response.success && this.config.loadErrorFn) {
  718. this.config.loadErrorFn.call(this, this, callback, response, args);
  719. } else if (callback) {
  720. try {
  721. callback(this, response);
  722. } catch (e) {
  723. this.error('use callback error', e, args);
  724. }
  725. }
  726. },
  727. /**
  728. * This private method is called from the `use` method queue. To ensure that only one set of loading
  729. * logic is performed at a time.
  730. * @method _use
  731. * @private
  732. * @param args* {String} 1-n modules to bind (uses arguments array).
  733. * @param *callback {Function} callback function executed when
  734. * the instance has the required functionality. If included, it
  735. * must be the last parameter.
  736. */
  737. _use: function(args, callback) {
  738. if (!this.Array) {
  739. this._attach(['yui-base']);
  740. }
  741. var len, loader, handleBoot, handleRLS,
  742. Y = this,
  743. G_ENV = YUI.Env,
  744. mods = G_ENV.mods,
  745. Env = Y.Env,
  746. used = Env._used,
  747. queue = G_ENV._loaderQueue,
  748. firstArg = args[0],
  749. YArray = Y.Array,
  750. config = Y.config,
  751. boot = config.bootstrap,
  752. missing = [],
  753. r = [],
  754. ret = true,
  755. fetchCSS = config.fetchCSS,
  756. process = function(names, skip) {
  757. if (!names.length) {
  758. return;
  759. }
  760. YArray.each(names, function(name) {
  761. // add this module to full list of things to attach
  762. if (!skip) {
  763. r.push(name);
  764. }
  765. // only attach a module once
  766. if (used[name]) {
  767. return;
  768. }
  769. var m = mods[name], req, use;
  770. if (m) {
  771. used[name] = true;
  772. req = m.details.requires;
  773. use = m.details.use;
  774. } else {
  775. // CSS files don't register themselves, see if it has
  776. // been loaded
  777. if (!G_ENV._loaded[VERSION][name]) {
  778. missing.push(name);
  779. } else {
  780. used[name] = true; // probably css
  781. }
  782. }
  783. // make sure requirements are attached
  784. if (req && req.length) {
  785. process(req);
  786. }
  787. // make sure we grab the submodule dependencies too
  788. if (use && use.length) {
  789. process(use, 1);
  790. }
  791. });
  792. },
  793. handleLoader = function(fromLoader) {
  794. var response = fromLoader || {
  795. success: true,
  796. msg: 'not dynamic'
  797. },
  798. redo, origMissing,
  799. ret = true,
  800. data = response.data;
  801. Y._loading = false;
  802. if (data) {
  803. origMissing = missing;
  804. missing = [];
  805. r = [];
  806. process(data);
  807. redo = missing.length;
  808. if (redo) {
  809. if (missing.sort().join() ==
  810. origMissing.sort().join()) {
  811. redo = false;
  812. }
  813. }
  814. }
  815. if (redo && data) {
  816. Y._loading = false;
  817. Y._use(args, function() {
  818. if (Y._attach(data)) {
  819. Y._notify(callback, response, data);
  820. }
  821. });
  822. } else {
  823. if (data) {
  824. ret = Y._attach(data);
  825. }
  826. if (ret) {
  827. Y._notify(callback, response, args);
  828. }
  829. }
  830. if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
  831. Y._use.apply(Y, Y._useQueue.next());
  832. }
  833. };
  834. // YUI().use('*'); // bind everything available
  835. if (firstArg === '*') {
  836. ret = Y._attach(Y.Object.keys(mods));
  837. if (ret) {
  838. handleLoader();
  839. }
  840. return Y;
  841. }
  842. // use loader to expand dependencies and sort the
  843. // requirements if it is available.
  844. if (boot && Y.Loader && args.length) {
  845. loader = getLoader(Y);
  846. loader.require(args);
  847. loader.ignoreRegistered = true;
  848. loader.calculate(null, (fetchCSS) ? null : 'js');
  849. args = loader.sorted;
  850. }
  851. // process each requirement and any additional requirements
  852. // the module metadata specifies
  853. process(args);
  854. len = missing.length;
  855. if (len) {
  856. missing = Y.Object.keys(YArray.hash(missing));
  857. len = missing.length;
  858. }
  859. // dynamic load
  860. if (boot && len && Y.Loader) {
  861. Y._loading = true;
  862. loader = getLoader(Y);
  863. loader.onEnd = handleLoader;
  864. loader.context = Y;
  865. loader.data = args;
  866. loader.ignoreRegistered = false;
  867. loader.require(args);
  868. loader.insert(null, (fetchCSS) ? null : 'js');
  869. // loader.partial(missing, (fetchCSS) ? null : 'js');
  870. } else if (len && Y.config.use_rls && !YUI.Env.rls_enabled) {
  871. G_ENV._rls_queue = G_ENV._rls_queue || new Y.Queue();
  872. // server side loader service
  873. handleRLS = function(instance, argz) {
  874. var rls_end = function(o) {
  875. handleLoader(o);
  876. instance.rls_advance();
  877. },
  878. rls_url = instance._rls(argz);
  879. if (rls_url) {
  880. instance.rls_oncomplete(function(o) {
  881. rls_end(o);
  882. });
  883. instance.Get.script(rls_url, {
  884. data: argz,
  885. timeout: instance.config.rls_timeout,
  886. onFailure: instance.rls_handleFailure,
  887. onTimeout: instance.rls_handleTimeout
  888. });
  889. } else {
  890. rls_end({
  891. success: true,
  892. data: argz
  893. });
  894. }
  895. };
  896. G_ENV._rls_queue.add(function() {
  897. G_ENV._rls_in_progress = true;
  898. Y.rls_callback = callback;
  899. Y.rls_locals(Y, args, handleRLS);
  900. });
  901. if (!G_ENV._rls_in_progress && G_ENV._rls_queue.size()) {
  902. G_ENV._rls_queue.next()();
  903. }
  904. } else if (boot && len && Y.Get && !Env.bootstrapped) {
  905. Y._loading = true;
  906. handleBoot = function() {
  907. Y._loading = false;
  908. queue.running = false;
  909. Env.bootstrapped = true;
  910. G_ENV._bootstrapping = false;
  911. if (Y._attach(['loader'])) {
  912. Y._use(args, callback);
  913. }
  914. };
  915. if (G_ENV._bootstrapping) {
  916. queue.add(handleBoot);
  917. } else {
  918. G_ENV._bootstrapping = true;
  919. Y.Get.script(config.base + config.loaderPath, {
  920. onEnd: handleBoot
  921. });
  922. }
  923. } else {
  924. ret = Y._attach(args);
  925. if (ret) {
  926. handleLoader();
  927. }
  928. }
  929. return Y;
  930. },
  931. /**
  932. Adds a namespace object onto the YUI global if called statically.
  933. // creates YUI.your.namespace.here as nested objects
  934. YUI.namespace("your.namespace.here");
  935. If called as a method on a YUI <em>instance</em>, it creates the
  936. namespace on the instance.
  937. // creates Y.property.package
  938. Y.namespace("property.package");
  939. Dots in the input string cause `namespace` to create nested objects for
  940. each token. If any part of the requested namespace already exists, the
  941. current object will be left in place. This allows multiple calls to
  942. `namespace` to preserve existing namespaced properties.
  943. If the first token in the namespace string is "YAHOO", the token is
  944. discarded.
  945. Be careful with namespace tokens. Reserved words may work in some browsers
  946. and not others. For instance, the following will fail in some browsers
  947. because the supported version of JavaScript reserves the word "long":
  948. Y.namespace("really.long.nested.namespace");
  949. @method namespace
  950. @param {String} namespace* namespaces to create.
  951. @return {Object} A reference to the last namespace object created.
  952. **/
  953. namespace: function() {
  954. var a = arguments, o = this, i = 0, j, d, arg;
  955. for (; i < a.length; i++) {
  956. // d = ('' + a[i]).split('.');
  957. arg = a[i];
  958. if (arg.indexOf(PERIOD)) {
  959. d = arg.split(PERIOD);
  960. for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
  961. o[d[j]] = o[d[j]] || {};
  962. o = o[d[j]];
  963. }
  964. } else {
  965. o[arg] = o[arg] || {};
  966. }
  967. }
  968. return o;
  969. },
  970. // this is replaced if the log module is included
  971. log: NOOP,
  972. message: NOOP,
  973. // this is replaced if the dump module is included
  974. dump: function (o) { return ''+o; },
  975. /**
  976. * Report an error. The reporting mechanism is controled by
  977. * the `throwFail` configuration attribute. If throwFail is
  978. * not specified, the message is written to the Logger, otherwise
  979. * a JS error is thrown
  980. * @method error
  981. * @param msg {String} the error message.
  982. * @param e {Error|String} Optional JS error that was caught, or an error string.
  983. * @param data Optional additional info
  984. * and `throwFail` is specified, this error will be re-thrown.
  985. * @return {YUI} this YUI instance.
  986. */
  987. error: function(msg, e, data) {
  988. var Y = this, ret;
  989. if (Y.config.errorFn) {
  990. ret = Y.config.errorFn.apply(Y, arguments);
  991. }
  992. if (Y.config.throwFail && !ret) {
  993. throw (e || new Error(msg));
  994. } else {
  995. Y.message(msg, 'error'); // don't scrub this one
  996. }
  997. return Y;
  998. },
  999. /**
  1000. * Generate an id that is unique among all YUI instances
  1001. * @method guid
  1002. * @param pre {String} optional guid prefix.
  1003. * @return {String} the guid.
  1004. */
  1005. guid: function(pre) {
  1006. var id = this.Env._guidp + '_' + (++this.Env._uidx);
  1007. return (pre) ? (pre + id) : id;
  1008. },
  1009. /**
  1010. * Returns a `guid` associated with an object. If the object
  1011. * does not have one, a new one is created unless `readOnly`
  1012. * is specified.
  1013. * @method stamp
  1014. * @param o {Object} The object to stamp.
  1015. * @param readOnly {Boolean} if `true`, a valid guid will only
  1016. * be returned if the object has one assigned to it.
  1017. * @return {String} The object's guid or null.
  1018. */
  1019. stamp: function(o, readOnly) {
  1020. var uid;
  1021. if (!o) {
  1022. return o;
  1023. }
  1024. // IE generates its own unique ID for dom nodes
  1025. // The uniqueID property of a document node returns a new ID
  1026. if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
  1027. uid = o.uniqueID;
  1028. } else {
  1029. uid = (typeof o === 'string') ? o : o._yuid;
  1030. }
  1031. if (!uid) {
  1032. uid = this.guid();
  1033. if (!readOnly) {
  1034. try {
  1035. o._yuid = uid;
  1036. } catch (e) {
  1037. uid = null;
  1038. }
  1039. }
  1040. }
  1041. return uid;
  1042. },
  1043. /**
  1044. * Destroys the YUI instance
  1045. * @method destroy
  1046. * @since 3.3.0
  1047. */
  1048. destroy: function() {
  1049. var Y = this;
  1050. if (Y.Event) {
  1051. Y.Event._unload();
  1052. }
  1053. delete instances[Y.id];
  1054. delete Y.Env;
  1055. delete Y.config;
  1056. }
  1057. /**
  1058. * instanceof check for objects that works around
  1059. * memory leak in IE when the item tested is
  1060. * window/document
  1061. * @method instanceOf
  1062. * @since 3.3.0
  1063. */
  1064. };
  1065. YUI.prototype = proto;
  1066. // inheritance utilities are not available yet
  1067. for (prop in proto) {
  1068. if (proto.hasOwnProperty(prop)) {
  1069. YUI[prop] = proto[prop];
  1070. }
  1071. }
  1072. // set up the environment
  1073. YUI._init();
  1074. if (hasWin) {
  1075. // add a window load event at load time so we can capture
  1076. // the case where it fires before dynamic loading is
  1077. // complete.
  1078. add(window, 'load', handleLoad);
  1079. } else {
  1080. handleLoad();
  1081. }
  1082. YUI.Env.add = add;
  1083. YUI.Env.remove = remove;
  1084. /*global exports*/
  1085. // Support the CommonJS method for exporting our single global
  1086. if (typeof exports == 'object') {
  1087. exports.YUI = YUI;
  1088. }
  1089. }());
  1090. /**
  1091. * The config object contains all of the configuration options for
  1092. * the `YUI` instance. This object is supplied by the implementer
  1093. * when instantiating a `YUI` instance. Some properties have default
  1094. * values if they are not supplied by the implementer. This should
  1095. * not be updated directly because some values are cached. Use
  1096. * `applyConfig()` to update the config object on a YUI instance that
  1097. * has already been configured.
  1098. *
  1099. * @class config
  1100. * @static
  1101. */
  1102. /**
  1103. * Allows the YUI seed file to fetch the loader component and library
  1104. * metadata to dynamically load additional dependencies.
  1105. *
  1106. * @property bootstrap
  1107. * @type boolean
  1108. * @default true
  1109. */
  1110. /**
  1111. * Log to the browser console if debug is on and the browser has a
  1112. * supported console.
  1113. *
  1114. * @property useBrowserConsole
  1115. * @type boolean
  1116. * @default true
  1117. */
  1118. /**
  1119. * A hash of log sources that should be logged. If specified, only
  1120. * log messages from these sources will be logged.
  1121. *
  1122. * @property logInclude
  1123. * @type object
  1124. */
  1125. /**
  1126. * A hash of log sources that should be not be logged. If specified,
  1127. * all sources are logged if not on this list.
  1128. *
  1129. * @property logExclude
  1130. * @type object
  1131. */
  1132. /**
  1133. * Set to true if the yui seed file was dynamically loaded in
  1134. * order to bootstrap components relying on the window load event
  1135. * and the `domready` custom event.
  1136. *
  1137. * @property injected
  1138. * @type boolean
  1139. * @default false
  1140. */
  1141. /**
  1142. * If `throwFail` is set, `Y.error` will generate or re-throw a JS Error.
  1143. * Otherwise the failure is logged.
  1144. *
  1145. * @property throwFail
  1146. * @type boolean
  1147. * @default true
  1148. */
  1149. /**
  1150. * The window/frame that this instance should operate in.
  1151. *
  1152. * @property win
  1153. * @type Window
  1154. * @default the window hosting YUI
  1155. */
  1156. /**
  1157. * The document associated with the 'win' configuration.
  1158. *
  1159. * @property doc
  1160. * @type Document
  1161. * @default the document hosting YUI
  1162. */
  1163. /**
  1164. * A list of modules that defines the YUI core (overrides the default).
  1165. *
  1166. * @property core
  1167. * @type string[]
  1168. */
  1169. /**
  1170. * A list of languages in order of preference. This list is matched against
  1171. * the list of available languages in modules that the YUI instance uses to
  1172. * determine the best possible localization of language sensitive modules.
  1173. * Languages are represented using BCP 47 language tags, such as "en-GB" for
  1174. * English as used in the United Kingdom, or "zh-Hans-CN" for simplified
  1175. * Chinese as used in China. The list can be provided as a comma-separated
  1176. * list or as an array.
  1177. *
  1178. * @property lang
  1179. * @type string|string[]
  1180. */
  1181. /**
  1182. * The default date format
  1183. * @property dateFormat
  1184. * @type string
  1185. * @deprecated use configuration in `DataType.Date.format()` instead.
  1186. */
  1187. /**
  1188. * The default locale
  1189. * @property locale
  1190. * @type string
  1191. * @deprecated use `config.lang` instead.
  1192. */
  1193. /**
  1194. * The default interval when polling in milliseconds.
  1195. * @property pollInterval
  1196. * @type int
  1197. * @default 20
  1198. */
  1199. /**
  1200. * The number of dynamic nodes to insert by default before
  1201. * automatically removing them. This applies to script nodes
  1202. * because removing the node will not make the evaluated script
  1203. * unavailable. Dynamic CSS is not auto purged, because removing
  1204. * a linked style sheet will also remove the style definitions.
  1205. * @property purgethreshold
  1206. * @type int
  1207. * @default 20
  1208. */
  1209. /**
  1210. * The default interval when polling in milliseconds.
  1211. * @property windowResizeDelay
  1212. * @type int
  1213. * @default 40
  1214. */
  1215. /**
  1216. * Base directory for dynamic loading
  1217. * @property base
  1218. * @type string
  1219. */
  1220. /*
  1221. * The secure base dir (not implemented)
  1222. * For dynamic loading.
  1223. * @property secureBase
  1224. * @type string
  1225. */
  1226. /**
  1227. * The YUI combo service base dir. Ex: `http://yui.yahooapis.com/combo?`
  1228. * For dynamic loading.
  1229. * @property comboBase
  1230. * @type string
  1231. */
  1232. /**
  1233. * The root path to prepend to module path for the combo service.
  1234. * Ex: 3.0.0b1/build/
  1235. * For dynamic loading.
  1236. * @property root
  1237. * @type string
  1238. */
  1239. /**
  1240. * A filter to apply to result urls. This filter will modify the default
  1241. * path for all modules. The default path for the YUI library is the
  1242. * minified version of the files (e.g., event-min.js). The filter property
  1243. * can be a predefined filter or a custom filter. The valid predefined
  1244. * filters are:
  1245. * <dl>
  1246. * <dt>DEBUG</dt>
  1247. * <dd>Selects the debug versions of the library (e.g., event-debug.js).
  1248. * This option will automatically include the Logger widget</dd>
  1249. * <dt>RAW</dt>
  1250. * <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
  1251. * </dl>
  1252. * You can also define a custom filter, which must be an object literal
  1253. * containing a search expression and a replace string:
  1254. *
  1255. * myFilter: {
  1256. * 'searchExp': "-min\\.js",
  1257. * 'replaceStr': "-debug.js"
  1258. * }
  1259. *
  1260. * For dynamic loading.
  1261. *
  1262. * @property filter
  1263. * @type string|object
  1264. */
  1265. /**
  1266. * The `skin` config let's you configure application level skin
  1267. * customizations. It contains the following attributes which
  1268. * can be specified to override the defaults:
  1269. *
  1270. * // The default skin, which is automatically applied if not
  1271. * // overriden by a component-specific skin definition.
  1272. * // Change this in to apply a different skin globally
  1273. * defaultSkin: 'sam',
  1274. *
  1275. * // This is combined with the loader base property to get
  1276. * // the default root directory for a skin.
  1277. * base: 'assets/skins/',
  1278. *
  1279. * // Any component-specific overrides can be specified here,
  1280. * // making it possible to load different skins for different
  1281. * // components. It is possible to load more than one skin
  1282. * // for a given component as well.
  1283. * overrides: {
  1284. * slider: ['capsule', 'round']
  1285. * }
  1286. *
  1287. * For dynamic loading.
  1288. *
  1289. * @property skin
  1290. */
  1291. /**
  1292. * Hash of per-component filter specification. If specified for a given
  1293. * component, this overrides the filter config.
  1294. *
  1295. * For dynamic loading.
  1296. *
  1297. * @property filters
  1298. */
  1299. /**
  1300. * Use the YUI combo service to reduce the number of http connections
  1301. * required to load your dependencies. Turning this off will
  1302. * disable combo handling for YUI and all module groups configured
  1303. * with a combo service.
  1304. *
  1305. * For dynamic loading.
  1306. *
  1307. * @property combine
  1308. * @type boolean
  1309. * @default true if 'base' is not supplied, false if it is.
  1310. */
  1311. /**
  1312. * A list of modules that should never be dynamically loaded
  1313. *
  1314. * @property ignore
  1315. * @type string[]
  1316. */
  1317. /**
  1318. * A list of modules that should always be loaded when required, even if already
  1319. * present on the page.
  1320. *
  1321. * @property force
  1322. * @type string[]
  1323. */
  1324. /**
  1325. * Node or id for a node that should be used as the insertion point for new
  1326. * nodes. For dynamic loading.
  1327. *
  1328. * @property insertBefore
  1329. * @type string
  1330. */
  1331. /**
  1332. * Object literal containing attributes to add to dynamically loaded script
  1333. * nodes.
  1334. * @property jsAttributes
  1335. * @type string
  1336. */
  1337. /**
  1338. * Object literal containing attributes to add to dynamically loaded link
  1339. * nodes.
  1340. * @property cssAttributes
  1341. * @type string
  1342. */
  1343. /**
  1344. * Number of milliseconds before a timeout occurs when dynamically
  1345. * loading nodes. If not set, there is no timeout.
  1346. * @property timeout
  1347. * @type int
  1348. */
  1349. /**
  1350. * Callback for the 'CSSComplete' event. When dynamically loading YUI
  1351. * components with CSS, this property fires when the CSS is finished
  1352. * loading but script loading is still ongoing. This provides an
  1353. * opportunity to enhance the presentation of a loading page a little
  1354. * bit before the entire loading process is done.
  1355. *
  1356. * @property onCSS
  1357. * @type function
  1358. */
  1359. /**
  1360. * A hash of module definitions to add to the list of YUI components.
  1361. * These components can then be dynamically loaded side by side with
  1362. * YUI via the `use()` method. This is a hash, the key is the module
  1363. * name, and the value is an object literal specifying the metdata
  1364. * for the module. See `Loader.addModule` for the supported module
  1365. * metadata fields. Also see groups, which provides a way to
  1366. * configure the base and combo spec for a set of modules.
  1367. *
  1368. * modules: {
  1369. * mymod1: {
  1370. * requires: ['node'],
  1371. * fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
  1372. * },
  1373. * mymod2: {
  1374. * requires: ['mymod1'],
  1375. * fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
  1376. * }
  1377. * }
  1378. *
  1379. * @property modules
  1380. * @type object
  1381. */
  1382. /**
  1383. * A hash of module group definitions. It for each group you
  1384. * can specify a list of modules and the base path and
  1385. * combo spec to use when dynamically loading the modules.
  1386. *
  1387. * groups: {
  1388. * yui2: {
  1389. * // specify whether or not this group has a combo service
  1390. * combine: true,
  1391. *
  1392. * // the base path for non-combo paths
  1393. * base: 'http://yui.yahooapis.com/2.8.0r4/build/',
  1394. *
  1395. * // the path to the combo service
  1396. * comboBase: 'http://yui.yahooapis.com/combo?',
  1397. *
  1398. * // a fragment to prepend to the path attribute when
  1399. * // when building combo urls
  1400. * root: '2.8.0r4/build/',
  1401. *
  1402. * // the module definitions
  1403. * modules: {
  1404. * yui2_yde: {
  1405. * path: "yahoo-dom-event/yahoo-dom-event.js"
  1406. * },
  1407. * yui2_anim: {
  1408. * path: "animation/animation.js",
  1409. * requires: ['yui2_yde']
  1410. * }
  1411. * }
  1412. * }
  1413. * }
  1414. *
  1415. * @property groups
  1416. * @type object
  1417. */
  1418. /**
  1419. * The loader 'path' attribute to the loader itself. This is combined
  1420. * with the 'base' attribute to dynamically load the loader component
  1421. * when boostrapping with the get utility alone.
  1422. *
  1423. * @property loaderPath
  1424. * @type string
  1425. * @default loader/loader-min.js
  1426. */
  1427. /**
  1428. * Specifies whether or not YUI().use(...) will attempt to load CSS
  1429. * resources at all. Any truthy value will cause CSS dependencies
  1430. * to load when fetching script. The special value 'force' will
  1431. * cause CSS dependencies to be loaded even if no script is needed.
  1432. *
  1433. * @property fetchCSS
  1434. * @type boolean|string
  1435. * @default true
  1436. */
  1437. /**
  1438. * The default gallery version to build gallery module urls
  1439. * @property gallery
  1440. * @type string
  1441. * @since 3.1.0
  1442. */
  1443. /**
  1444. * The default YUI 2 version to build yui2 module urls. This is for
  1445. * intrinsic YUI 2 support via the 2in3 project. Also see the '2in3'
  1446. * config for pulling different revisions of the wrapped YUI 2
  1447. * modules.
  1448. * @since 3.1.0
  1449. * @property yui2
  1450. * @type string
  1451. * @default 2.8.1
  1452. */
  1453. /**
  1454. * The 2in3 project is a deployment of the various versions of YUI 2
  1455. * deployed as first-class YUI 3 modules. Eventually, the wrapper
  1456. * for the modules will change (but the underlying YUI 2 code will
  1457. * be the same), and you can select a particular version of
  1458. * the wrapper modules via this config.
  1459. * @since 3.1.0
  1460. * @property 2in3
  1461. * @type string
  1462. * @default 1
  1463. */
  1464. /**
  1465. * Alternative console log function for use in environments without
  1466. * a supported native console. The function is executed in the
  1467. * YUI instance context.
  1468. * @since 3.1.0
  1469. * @property logFn
  1470. * @type Function
  1471. */
  1472. /**
  1473. * A callback to execute when Y.error is called. It receives the
  1474. * error message and an javascript error object if Y.error was
  1475. * executed because a javascript error was caught. The function
  1476. * is executed in the YUI instance context.
  1477. *
  1478. * @since 3.2.0
  1479. * @property errorFn
  1480. * @type Function
  1481. */
  1482. /**
  1483. * A callback to execute when the loader fails to load one or
  1484. * more resource. This could be because of a script load
  1485. * failure. It can also fail if a javascript module fails
  1486. * to register itself, but only when the 'requireRegistration'
  1487. * is true. If this function is defined, the use() callback will
  1488. * only be called when the loader succeeds, otherwise it always
  1489. * executes unless there was a javascript error when attaching
  1490. * a module.
  1491. *
  1492. * @since 3.3.0
  1493. * @property loadErrorFn
  1494. * @type Function
  1495. */
  1496. /**
  1497. * When set to true, the YUI loader will expect that all modules
  1498. * it is responsible for loading will be first-class YUI modules
  1499. * that register themselves with the YUI global. If this is
  1500. * set to true, loader will fail if the module registration fails
  1501. * to happen after the script is loaded.
  1502. *
  1503. * @since 3.3.0
  1504. * @property requireRegistration
  1505. * @type boolean
  1506. * @default false
  1507. */
  1508. /**
  1509. * Cache serviced use() requests.
  1510. * @since 3.3.0
  1511. * @property cacheUse
  1512. * @type boolean
  1513. * @default true
  1514. * @deprecated no longer used
  1515. */
  1516. /**
  1517. * The parameter defaults for the remote loader service. **Requires the rls seed file.** The properties that are supported:
  1518. *
  1519. * * `m`: comma separated list of module requirements. This
  1520. * must be the param name even for custom implemetations.
  1521. * * `v`: the version of YUI to load. Defaults to the version
  1522. * of YUI that is being used.
  1523. * * `gv`: the version of the gallery to load (see the gallery config)
  1524. * * `env`: comma separated list of modules already on the page.
  1525. * this must be the param name even for custom implemetations.
  1526. * * `lang`: the languages supported on the page (see the lang config)
  1527. * * `'2in3v'`: the version of the 2in3 wrapper to use (see the 2in3 config).
  1528. * * `'2v'`: the version of yui2 to use in the yui 2in3 wrappers
  1529. * * `filt`: a filter def to apply to the urls (see the filter config).
  1530. * * `filts`: a list of custom filters to apply per module
  1531. * * `tests`: this is a map of conditional module test function id keys
  1532. * with the values of 1 if the test passes, 0 if not. This must be
  1533. * the name of the querystring param in custom templates.
  1534. *
  1535. * @since 3.2.0
  1536. * @property rls
  1537. * @type {Object}
  1538. */
  1539. /**
  1540. * The base path to the remote loader service. **Requires the rls seed file.**
  1541. *
  1542. * @since 3.2.0
  1543. * @property rls_base
  1544. * @type {String}
  1545. */
  1546. /**
  1547. * The template to use for building the querystring portion
  1548. * of the remote loader service url. The default is determined
  1549. * by the rls config -- each property that has a value will be
  1550. * represented. **Requires the rls seed file.**
  1551. *
  1552. * @since 3.2.0
  1553. * @property rls_tmpl
  1554. * @type {String}
  1555. * @example
  1556. * m={m}&v={v}&env={env}&lang={lang}&filt={filt}&tests={tests}
  1557. *
  1558. */
  1559. /**
  1560. * Configure the instance to use a remote loader service instead of
  1561. * the client loader. **Requires the rls seed file.**
  1562. *
  1563. * @since 3.2.0
  1564. * @property use_rls
  1565. * @type {Boolean}
  1566. */
  1567. YUI.add('yui-base', function(Y) {
  1568. /*
  1569. * YUI stub
  1570. * @module yui
  1571. * @submodule yui-base
  1572. */
  1573. /**
  1574. * The YUI module contains the components required for building the YUI
  1575. * seed file. This includes the script loading mechanism, a simple queue,
  1576. * and the core utilities for the library.
  1577. * @module yui
  1578. * @submodule yui-base
  1579. */
  1580. /**
  1581. * Provides core language utilites and extensions used throughout YUI.
  1582. *
  1583. * @class Lang
  1584. * @static
  1585. */
  1586. var L = Y.Lang || (Y.Lang = {}),
  1587. STRING_PROTO = String.prototype,
  1588. TOSTRING = Object.prototype.toString,
  1589. TYPES = {
  1590. 'undefined' : 'undefined',
  1591. 'number' : 'number',
  1592. 'boolean' : 'boolean',
  1593. 'string' : 'string',
  1594. '[object Function]': 'function',
  1595. '[object RegExp]' : 'regexp',
  1596. '[object Array]' : 'array',
  1597. '[object Date]' : 'date',
  1598. '[object Error]' : 'error'
  1599. },
  1600. SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
  1601. TRIMREGEX = /^\s+|\s+$/g,
  1602. // If either MooTools or Prototype is on the page, then there's a chance that we
  1603. // can't trust "native" language features to actually be native. When this is
  1604. // the case, we take the safe route and fall back to our own non-native
  1605. // implementation.
  1606. win = Y.config.win,
  1607. unsafeNatives = win && !!(win.MooTools || win.Prototype);
  1608. /**
  1609. * Determines whether or not the provided item is an array.
  1610. *
  1611. * Returns `false` for array-like collections such as the function `arguments`
  1612. * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to
  1613. * test for an array-like collection.
  1614. *
  1615. * @method isArray
  1616. * @param o The object to test.
  1617. * @return {boolean} true if o is an array.
  1618. * @static
  1619. */
  1620. L.isArray = (!unsafeNatives && Array.isArray) || function (o) {
  1621. return L.type(o) === 'array';
  1622. };
  1623. /**
  1624. * Determines whether or not the provided item is a boolean.
  1625. * @method isBoolean
  1626. * @static
  1627. * @param o The object to test.
  1628. * @return {boolean} true if o is a boolean.
  1629. */
  1630. L.isBoolean = function(o) {
  1631. return typeof o === 'boolean';
  1632. };
  1633. /**
  1634. * <p>
  1635. * Determines whether or not the provided item is a function.
  1636. * Note: Internet Explorer thinks certain functions are objects:
  1637. * </p>
  1638. *
  1639. * <pre>
  1640. * var obj = document.createElement("object");
  1641. * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
  1642. * &nbsp;
  1643. * var input = document.createElement("input"); // append to body
  1644. * Y.Lang.isFunction(input.focus) // reports false in IE
  1645. * </pre>
  1646. *
  1647. * <p>
  1648. * You will have to implement additional tests if these functions
  1649. * matter to you.
  1650. * </p>
  1651. *
  1652. * @method isFunction
  1653. * @static
  1654. * @param o The object to test.
  1655. * @return {boolean} true if o is a function.
  1656. */
  1657. L.isFunction = function(o) {
  1658. return L.type(o) === 'function';
  1659. };
  1660. /**
  1661. * Determines whether or not the supplied item is a date instance.
  1662. * @method isDate
  1663. * @static
  1664. * @param o The object to test.
  1665. * @return {boolean} true if o is a date.
  1666. */
  1667. L.isDate = function(o) {
  1668. return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o);
  1669. };
  1670. /**
  1671. * Determines whether or not the provided item is null.
  1672. * @method isNull
  1673. * @static
  1674. * @param o The object to test.
  1675. * @return {boolean} true if o is null.
  1676. */
  1677. L.isNull = function(o) {
  1678. return o === null;
  1679. };
  1680. /**
  1681. * Determines whether or not the provided item is a legal number.
  1682. * @method isNumber
  1683. * @static
  1684. * @param o The object to test.
  1685. * @return {boolean} true if o is a number.
  1686. */
  1687. L.isNumber = function(o) {
  1688. return typeof o === 'number' && isFinite(o);
  1689. };
  1690. /**
  1691. * Determines whether or not the provided item is of type object
  1692. * or function. Note that arrays are also objects, so
  1693. * <code>Y.Lang.isObject([]) === true</code>.
  1694. * @method isObject
  1695. * @static
  1696. * @param o The object to test.
  1697. * @param failfn {boolean} fail if the input is a function.
  1698. * @return {boolean} true if o is an object.
  1699. * @see isPlainObject
  1700. */
  1701. L.isObject = function(o, failfn) {
  1702. var t = typeof o;
  1703. return (o && (t === 'object' ||
  1704. (!failfn && (t === 'function' || L.isFunction(o))))) || false;
  1705. };
  1706. /**
  1707. * Determines whether or not the provided item is a string.
  1708. * @method isString
  1709. * @static
  1710. * @param o The object to test.
  1711. * @return {boolean} true if o is a string.
  1712. */
  1713. L.isString = function(o) {
  1714. return typeof o === 'string';
  1715. };
  1716. /**
  1717. * Determines whether or not the provided item is undefined.
  1718. * @method isUndefined
  1719. * @static
  1720. * @param o The object to test.
  1721. * @return {boolean} true if o is undefined.
  1722. */
  1723. L.isUndefined = function(o) {
  1724. return typeof o === 'undefined';
  1725. };
  1726. /**
  1727. * Returns a string without any leading or trailing whitespace. If
  1728. * the input is not a string, the input will be returned untouched.
  1729. * @method trim
  1730. * @static
  1731. * @param s {string} the string to trim.
  1732. * @return {string} the trimmed string.
  1733. */
  1734. L.trim = STRING_PROTO.trim ? function(s) {
  1735. return s && s.trim ? s.trim() : s;
  1736. } : function (s) {
  1737. try {
  1738. return s.replace(TRIMREGEX, '');
  1739. } catch (e) {
  1740. return s;
  1741. }
  1742. };
  1743. /**
  1744. * Returns a string without any leading whitespace.
  1745. * @method trimLeft
  1746. * @static
  1747. * @param s {string} the string to trim.
  1748. * @return {string} the trimmed string.
  1749. */
  1750. L.trimLeft = STRING_PROTO.trimLeft ? function (s) {
  1751. return s.trimLeft();
  1752. } : function (s) {
  1753. return s.replace(/^\s+/, '');
  1754. };
  1755. /**
  1756. * Returns a string without any trailing whitespace.
  1757. * @method trimRight
  1758. * @static
  1759. * @param s {string} the string to trim.
  1760. * @return {string} the trimmed string.
  1761. */
  1762. L.trimRight = STRING_PROTO.trimRight ? function (s) {
  1763. return s.trimRight();
  1764. } : function (s) {
  1765. return s.replace(/\s+$/, '');
  1766. };
  1767. /**
  1768. * A convenience method for detecting a legitimate non-null value.
  1769. * Returns false for null/undefined/NaN, true for other values,
  1770. * including 0/false/''
  1771. * @method isValue
  1772. * @static
  1773. * @param o The item to test.
  1774. * @return {boolean} true if it is not null/undefined/NaN || false.
  1775. */
  1776. L.isValue = function(o) {
  1777. var t = L.type(o);
  1778. switch (t) {
  1779. case 'number':
  1780. return isFinite(o);
  1781. case 'null': // fallthru
  1782. case 'undefined':
  1783. return false;
  1784. default:
  1785. return !!t;
  1786. }
  1787. };
  1788. /**
  1789. * <p>
  1790. * Returns a string representing the type of the item passed in.
  1791. * </p>
  1792. *
  1793. * <p>
  1794. * Known issues:
  1795. * </p>
  1796. *
  1797. * <ul>
  1798. * <li>
  1799. * <code>typeof HTMLElementCollection</code> returns function in Safari, but
  1800. * <code>Y.type()</code> reports object, which could be a good thing --
  1801. * but it actually caused the logic in <code>Y.Lang.isObject</code> to fail.
  1802. * </li>
  1803. * </ul>
  1804. *
  1805. * @method type
  1806. * @param o the item to test.
  1807. * @return {string} the detected type.
  1808. * @static
  1809. */
  1810. L.type = function(o) {
  1811. return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null');
  1812. };
  1813. /**
  1814. * Lightweight version of <code>Y.substitute</code>. Uses the same template
  1815. * structure as <code>Y.substitute</code>, but doesn't support recursion,
  1816. * auto-object coersion, or formats.
  1817. * @method sub
  1818. * @param {string} s String to be modified.
  1819. * @param {object} o Object containing replacement values.
  1820. * @return {string} the substitute result.
  1821. * @static
  1822. * @since 3.2.0
  1823. */
  1824. L.sub = function(s, o) {
  1825. return s.replace ? s.replace(SUBREGEX, function (match, key) {
  1826. return L.isUndefined(o[key]) ? match : o[key];
  1827. }) : s;
  1828. };
  1829. /**
  1830. * Returns the current time in milliseconds.
  1831. *
  1832. * @method now
  1833. * @return {Number} Current time in milliseconds.
  1834. * @static
  1835. * @since 3.3.0
  1836. */
  1837. L.now = Date.now || function () {
  1838. return new Date().getTime();
  1839. };
  1840. /**
  1841. @module yui
  1842. @submodule yui-base
  1843. */
  1844. var Lang = Y.Lang,
  1845. Native = Array.prototype,
  1846. hasOwn = Object.prototype.hasOwnProperty;
  1847. /**
  1848. Provides utility methods for working with arrays. Additional array helpers can
  1849. be found in the `collection` and `array-extras` modules.
  1850. `Y.Array(thing)` returns a native array created from _thing_. Depending on
  1851. _thing_'s type, one of the following will happen:
  1852. * Arrays are returned unmodified unless a non-zero _startIndex_ is
  1853. specified.
  1854. * Array-like collections (see `Array.test()`) are converted to arrays.
  1855. * For everything else, a new array is created with _thing_ as the sole
  1856. item.
  1857. Note: elements that are also collections, such as `<form>` and `<select>`
  1858. elements, are not automatically converted to arrays. To force a conversion,
  1859. pass `true` as the value of the _force_ parameter.
  1860. @class Array
  1861. @constructor
  1862. @param {Any} thing The thing to arrayify.
  1863. @param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like
  1864. collection, a subset of items starting at the specified index will be
  1865. returned.
  1866. @param {Boolean} [force=false] If `true`, _thing_ will be treated as an
  1867. array-like collection no matter what.
  1868. @return {Array} A native array created from _thing_, according to the rules
  1869. described above.
  1870. **/
  1871. function YArray(thing, startIndex, force) {
  1872. var len, result;
  1873. startIndex || (startIndex = 0);
  1874. if (force || YArray.test(thing)) {
  1875. // IE throws when trying to slice HTMLElement collections.
  1876. try {
  1877. return Native.slice.call(thing, startIndex);
  1878. } catch (ex) {
  1879. result = [];
  1880. for (len = thing.length; startIndex < len; ++startIndex) {
  1881. result.push(thing[startIndex]);
  1882. }
  1883. return result;
  1884. }
  1885. }
  1886. return [thing];
  1887. }
  1888. Y.Array = YArray;
  1889. /**
  1890. Dedupes an array of strings, returning an array that's guaranteed to contain
  1891. only one copy of a given string.
  1892. This method differs from `Array.unique()` in that it's optimized for use only
  1893. with strings, whereas `unique` may be used with other types (but is slower).
  1894. Using `dedupe()` with non-string values may result in unexpected behavior.
  1895. @method dedupe
  1896. @param {String[]} array Array of strings to dedupe.
  1897. @return {Array} Deduped copy of _array_.
  1898. @static
  1899. @since 3.4.0
  1900. **/
  1901. YArray.dedupe = function (array) {
  1902. var hash = {},
  1903. results = [],
  1904. i, item, len;
  1905. for (i = 0, len = array.length; i < len; ++i) {
  1906. item = array[i];
  1907. if (!hasOwn.call(hash, item)) {
  1908. hash[item] = 1;
  1909. results.push(item);
  1910. }
  1911. }
  1912. return results;
  1913. };
  1914. /**
  1915. Executes the supplied function on each item in the array. This method wraps
  1916. the native ES5 `Array.forEach()` method if available.
  1917. @method each
  1918. @param {Array} array Array to iterate.
  1919. @param {Function} fn Function to execute on each item in the array. The function
  1920. will receive the following arguments:
  1921. @param {Any} fn.item Current array item.
  1922. @param {Number} fn.index Current array index.
  1923. @param {Array} fn.array Array being iterated.
  1924. @param {Object} [thisObj] `this` object to use when calling _fn_.
  1925. @return {YUI} The YUI instance.
  1926. @static
  1927. **/
  1928. YArray.each = YArray.forEach = Native.forEach ? function (array, fn, thisObj) {
  1929. Native.forEach.call(array || [], fn, thisObj || Y);
  1930. return Y;
  1931. } : function (array, fn, thisObj) {
  1932. for (var i = 0, len = (array && array.length) || 0; i < len; ++i) {
  1933. if (i in array) {
  1934. fn.call(thisObj || Y, array[i], i, array);
  1935. }
  1936. }
  1937. return Y;
  1938. };
  1939. /**
  1940. Alias for `each()`.
  1941. @method forEach
  1942. @static
  1943. **/
  1944. /**
  1945. Returns an object using the first array as keys and the second as values. If
  1946. the second array is not provided, or if it doesn't contain the same number of
  1947. values as the first array, then `true` will be used in place of the missing
  1948. values.
  1949. @example
  1950. Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']);
  1951. // => {a: 'foo', b: 'bar', c: true}
  1952. @method hash
  1953. @param {String[]} keys Array of strings to use as keys.
  1954. @param {Array} [values] Array to use as values.
  1955. @return {Object} Hash using the first array as keys and the second as values.
  1956. @static
  1957. **/
  1958. YArray.hash = function (keys, values) {
  1959. var hash = {},
  1960. vlen = (values && values.length) || 0,
  1961. i, len;
  1962. for (i = 0, len = keys.length; i < len; ++i) {
  1963. if (i in keys) {
  1964. hash[keys[i]] = vlen > i && i in values ? values[i] : true;
  1965. }
  1966. }
  1967. return hash;
  1968. };
  1969. /**
  1970. Returns the index of the first item in the array that's equal (using a strict
  1971. equality check) to the specified _value_, or `-1` if the value isn't found.
  1972. This method wraps the native ES5 `Array.indexOf()` method if available.
  1973. @method indexOf
  1974. @param {Array} array Array to search.
  1975. @param {Any} value Value to search for.
  1976. @return {Number} Index of the item strictly equal to _value_, or `-1` if not
  1977. found.
  1978. @static
  1979. **/
  1980. YArray.indexOf = Native.indexOf ? function (array, value) {
  1981. // TODO: support fromIndex
  1982. return Native.indexOf.call(array, value);
  1983. } : function (array, value) {
  1984. for (var i = 0, len = array.length; i < len; ++i) {
  1985. if (i in array && array[i] === value) {
  1986. return i;
  1987. }
  1988. }
  1989. return -1;
  1990. };
  1991. /**
  1992. Numeric sort convenience function.
  1993. The native `Array.prototype.sort()` function converts values to strings and
  1994. sorts them in lexicographic order, which is unsuitable for sorting numeric
  1995. values. Provide `Array.numericSort` as a custom sort function when you want
  1996. to sort values in numeric order.
  1997. @example
  1998. [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort);
  1999. // => [4, 8, 15, 16, 23, 42]
  2000. @method numericSort
  2001. @param {Number} a First value to compare.
  2002. @param {Number} b Second value to compare.
  2003. @return {Number} Difference between _a_ and _b_.
  2004. @static
  2005. **/
  2006. YArray.numericSort = function (a, b) {
  2007. return a - b;
  2008. };
  2009. /**
  2010. Executes the supplied function on each item in the array. Returning a truthy
  2011. value from the function will stop the processing of remaining items.
  2012. @method some
  2013. @param {Array} array Array to iterate over.
  2014. @param {Function} fn Function to execute on each item. The function will receive
  2015. the following arguments:
  2016. @param {Any} fn.value Current array item.
  2017. @param {Number} fn.index Current array index.
  2018. @param {Array} fn.array Array being iterated over.
  2019. @param {Object} [thisObj] `this` object to use when calling _fn_.
  2020. @return {Boolean} `true` if the function returns a truthy value on any of the
  2021. items in the array; `false` otherwise.
  2022. @static
  2023. **/
  2024. YArray.some = Native.some ? function (array, fn, thisObj) {
  2025. return Native.some.call(array, fn, thisObj);
  2026. } : function (array, fn, thisObj) {
  2027. for (var i = 0, len = array.length; i < len; ++i) {
  2028. if (i in array && fn.call(thisObj, array[i], i, array)) {
  2029. return true;
  2030. }
  2031. }
  2032. return false;
  2033. };
  2034. /**
  2035. Evaluates _obj_ to determine if it's an array, an array-like collection, or
  2036. something else. This is useful when working with the function `arguments`
  2037. collection and `HTMLElement` collections.
  2038. Note: This implementation doesn't consider elements that are also
  2039. collections, such as `<form>` and `<select>`, to be array-like.
  2040. @method test
  2041. @param {Object} obj Object to test.
  2042. @return {Number} A number indicating the results of the test:
  2043. * 0: Neither an array nor an array-like collection.
  2044. * 1: Real array.
  2045. * 2: Array-like collection.
  2046. @static
  2047. **/
  2048. YArray.test = function (obj) {
  2049. var result = 0;
  2050. if (Lang.isArray(obj)) {
  2051. result = 1;
  2052. } else if (Lang.isObject(obj)) {
  2053. try {
  2054. // indexed, but no tagName (element) or alert (window),
  2055. // or functions without apply/call (Safari
  2056. // HTMLElementCollection bug).
  2057. if ('length' in obj && !obj.tagName && !obj.alert && !obj.apply) {
  2058. result = 2;
  2059. }
  2060. } catch (ex) {}
  2061. }
  2062. return result;
  2063. };
  2064. /**
  2065. * The YUI module contains the components required for building the YUI
  2066. * seed file. This includes the script loading mechanism, a simple queue,
  2067. * and the core utilities for the library.
  2068. * @module yui
  2069. * @submodule yui-base
  2070. */
  2071. /**
  2072. * A simple FIFO queue. Items are added to the Queue with add(1..n items) and
  2073. * removed using next().
  2074. *
  2075. * @class Queue
  2076. * @constructor
  2077. * @param {MIXED} item* 0..n items to seed the queue.
  2078. */
  2079. function Queue() {
  2080. this._init();
  2081. this.add.apply(this, arguments);
  2082. }
  2083. Queue.prototype = {
  2084. /**
  2085. * Initialize the queue
  2086. *
  2087. * @method _init
  2088. * @protected
  2089. */
  2090. _init: function() {
  2091. /**
  2092. * The collection of enqueued items
  2093. *
  2094. * @property _q
  2095. * @type Array
  2096. * @protected
  2097. */
  2098. this._q = [];
  2099. },
  2100. /**
  2101. * Get the next item in the queue. FIFO support
  2102. *
  2103. * @method next
  2104. * @return {MIXED} the next item in the queue.
  2105. */
  2106. next: function() {
  2107. return this._q.shift();
  2108. },
  2109. /**
  2110. * Get the last in the queue. LIFO support.
  2111. *
  2112. * @method last
  2113. * @return {MIXED} the last item in the queue.
  2114. */
  2115. last: function() {
  2116. return this._q.pop();
  2117. },
  2118. /**
  2119. * Add 0..n items to the end of the queue.
  2120. *
  2121. * @method add
  2122. * @param {MIXED} item* 0..n items.
  2123. * @return {object} this queue.
  2124. */
  2125. add: function() {
  2126. this._q.push.apply(this._q, arguments);
  2127. return this;
  2128. },
  2129. /**
  2130. * Returns the current number of queued items.
  2131. *
  2132. * @method size
  2133. * @return {Number} The size.
  2134. */
  2135. size: function() {
  2136. return this._q.length;
  2137. }
  2138. };
  2139. Y.Queue = Queue;
  2140. YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue();
  2141. /**
  2142. The YUI module contains the components required for building the YUI seed file.
  2143. This includes the script loading mechanism, a simple queue, and the core
  2144. utilities for the library.
  2145. @module yui
  2146. @submodule yui-base
  2147. **/
  2148. var CACHED_DELIMITER = '__',
  2149. hasOwn = Object.prototype.hasOwnProperty,
  2150. isObject = Y.Lang.isObject;
  2151. /**
  2152. Returns a wrapper for a function which caches the return value of that function,
  2153. keyed off of the combined string representation of the argument values provided
  2154. when the wrapper is called.
  2155. Calling this function again with the same arguments will return the cached value
  2156. rather than executing the wrapped function.
  2157. Note that since the cache is keyed off of the string representation of arguments
  2158. passed to the wrapper function, arguments that aren't strings and don't provide
  2159. a meaningful `toString()` method may result in unexpected caching behavior. For
  2160. example, the objects `{}` and `{foo: 'bar'}` would both be converted to the
  2161. string `[object Object]` when used as a cache key.
  2162. @method cached
  2163. @param {Function} source The function to memoize.
  2164. @param {Object} [cache={}] Object in which to store cached values. You may seed
  2165. this object with pre-existing cached values if desired.
  2166. @param {any} [refetch] If supplied, this value is compared with the cached value
  2167. using a `==` comparison. If the values are equal, the wrapped function is
  2168. executed again even though a cached value exists.
  2169. @return {Function} Wrapped function.
  2170. @for YUI
  2171. **/
  2172. Y.cached = function (source, cache, refetch) {
  2173. cache || (cache = {});
  2174. return function (arg) {
  2175. var key = arguments.length > 1 ?
  2176. Array.prototype.join.call(arguments, CACHED_DELIMITER) :
  2177. String(arg);
  2178. if (!(key in cache) || (refetch && cache[key] == refetch)) {
  2179. cache[key] = source.apply(source, arguments);
  2180. }
  2181. return cache[key];
  2182. };
  2183. };
  2184. /**
  2185. Returns a new object containing all of the properties of all the supplied
  2186. objects. The properties from later objects will overwrite those in earlier
  2187. objects.
  2188. Passing in a single object will create a shallow copy of it. For a deep copy,
  2189. use `clone()`.
  2190. @method merge
  2191. @param {Object} objects* One or more objects to merge.
  2192. @return {Object} A new merged object.
  2193. **/
  2194. Y.merge = function () {
  2195. var args = arguments,
  2196. i = 0,
  2197. len = args.length,
  2198. result = {};
  2199. for (; i < len; ++i) {
  2200. Y.mix(result, args[i], true);
  2201. }
  2202. return result;
  2203. };
  2204. /**
  2205. Mixes _supplier_'s properties into _receiver_.
  2206. Properties on _receiver_ or _receiver_'s prototype will not be overwritten or
  2207. shadowed unless the _overwrite_ parameter is `true`, and will not be merged
  2208. unless the _merge_ parameter is `true`.
  2209. In the default mode (0), only properties the supplier owns are copied (prototype
  2210. properties are not copied). The following copying modes are available:
  2211. * `0`: _Default_. Object to object.
  2212. * `1`: Prototype to prototype.
  2213. * `2`: Prototype to prototype and object to object.
  2214. * `3`: Prototype to object.
  2215. * `4`: Object to prototype.
  2216. @method mix
  2217. @param {Function|Object} receiver The object or function to receive the mixed
  2218. properties.
  2219. @param {Function|Object} supplier The object or function supplying the
  2220. properties to be mixed.
  2221. @param {Boolean} [overwrite=false] If `true`, properties that already exist
  2222. on the receiver will be overwritten with properties from the supplier.
  2223. @param {String[]} [whitelist] An array of property names to copy. If
  2224. specified, only the whitelisted properties will be copied, and all others
  2225. will be ignored.
  2226. @param {Number} [mode=0] Mix mode to use. See above for available modes.
  2227. @param {Boolean} [merge=false] If `true`, objects and arrays that already
  2228. exist on the receiver will have the corresponding object/array from the
  2229. supplier merged into them, rather than being skipped or overwritten. When
  2230. both _overwrite_ and _merge_ are `true`, _merge_ takes precedence.
  2231. @return {Function|Object|YUI} The receiver, or the YUI instance if the
  2232. specified receiver is falsy.
  2233. **/
  2234. Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) {
  2235. var alwaysOverwrite, exists, from, i, key, len, to;
  2236. // If no supplier is given, we return the receiver. If no receiver is given,
  2237. // we return Y. Returning Y doesn't make much sense to me, but it's
  2238. // grandfathered in for backcompat reasons.
  2239. if (!receiver || !supplier) {
  2240. return receiver || Y;
  2241. }
  2242. if (mode) {
  2243. // In mode 2 (prototype to prototype and object to object), we recurse
  2244. // once To Do the proto to proto mix. The object to object mix will be
  2245. // handled later on.
  2246. if (mode === 2) {
  2247. Y.mix(receiver.prototype, supplier.prototype, overwrite,
  2248. whitelist, 0, merge);
  2249. }
  2250. // Depending on which mode is specified, we may be copying from or to
  2251. // the prototypes of the supplier and receiver.
  2252. from = mode === 1 || mode === 3 ? supplier.prototype : supplier;
  2253. to = mode === 1 || mode === 4 ? receiver.prototype : receiver;
  2254. // If either the supplier or receiver doesn't actually have a
  2255. // prototype property, then we could end up with an undefined `from`
  2256. // or `to`. If that happens, we abort and return the receiver.
  2257. if (!from || !to) {
  2258. return receiver;
  2259. }
  2260. } else {
  2261. from = supplier;
  2262. to = receiver;
  2263. }
  2264. // If `overwrite` is truthy and `merge` is falsy, then we can skip a
  2265. // property existence check on each iteration and save some time.
  2266. alwaysOverwrite = overwrite && !merge;
  2267. if (whitelist) {
  2268. for (i = 0, len = whitelist.length; i < len; ++i) {
  2269. key = whitelist[i];
  2270. // We call `Object.prototype.hasOwnProperty` instead of calling
  2271. // `hasOwnProperty` on the object itself, since the object's
  2272. // `hasOwnProperty` method may have been overridden or removed.
  2273. // Also, some native objects don't implement a `hasOwnProperty`
  2274. // method.
  2275. if (!hasOwn.call(from, key)) {
  2276. continue;
  2277. }
  2278. // The `key in to` check here is (sadly) intentional for backwards
  2279. // compatibility reasons. It prevents undesired shadowing of
  2280. // prototype members on `to`.
  2281. exists = alwaysOverwrite ? false : key in to;
  2282. if (merge && exists && isObject(to[key], true)
  2283. && isObject(from[key], true)) {
  2284. // If we're in merge mode, and the key is present on both
  2285. // objects, and the value on both objects is either an object or
  2286. // an array (but not a function), then we recurse to merge the
  2287. // `from` value into the `to` value instead of overwriting it.
  2288. //
  2289. // Note: It's intentional that the whitelist isn't passed to the
  2290. // recursive call here. This is legacy behavior that lots of
  2291. // code still depends on.
  2292. Y.mix(to[key], from[key], overwrite, null, 0, merge);
  2293. } else if (overwrite || !exists) {
  2294. // We're not in merge mode, so we'll only copy the `from` value
  2295. // to the `to` value if we're in overwrite mode or if the
  2296. // current key doesn't exist on the `to` object.
  2297. to[key] = from[key];
  2298. }
  2299. }
  2300. } else {
  2301. for (key in from) {
  2302. // The code duplication here is for runtime performance reasons.
  2303. // Combining whitelist and non-whitelist operations into a single
  2304. // loop or breaking the shared logic out into a function both result
  2305. // in worse performance, and Y.mix is critical enough that the byte
  2306. // tradeoff is worth it.
  2307. if (!hasOwn.call(from, key)) {
  2308. continue;
  2309. }
  2310. // The `key in to` check here is (sadly) intentional for backwards
  2311. // compatibility reasons. It prevents undesired shadowing of
  2312. // prototype members on `to`.
  2313. exists = alwaysOverwrite ? false : key in to;
  2314. if (merge && exists && isObject(to[key], true)
  2315. && isObject(from[key], true)) {
  2316. Y.mix(to[key], from[key], overwrite, null, 0, merge);
  2317. } else if (overwrite || !exists) {
  2318. to[key] = from[key];
  2319. }
  2320. }
  2321. // If this is an IE browser with the JScript enumeration bug, force
  2322. // enumeration of the buggy properties by making a recursive call with
  2323. // the buggy properties as the whitelist.
  2324. if (Y.Object._hasEnumBug) {
  2325. Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge);
  2326. }
  2327. }
  2328. return receiver;
  2329. };
  2330. /**
  2331. * The YUI module contains the components required for building the YUI
  2332. * seed file. This includes the script loading mechanism, a simple queue,
  2333. * and the core utilities for the library.
  2334. * @module yui
  2335. * @submodule yui-base
  2336. */
  2337. /**
  2338. * Adds utilities to the YUI instance for working with objects.
  2339. *
  2340. * @class Object
  2341. */
  2342. var hasOwn = Object.prototype.hasOwnProperty,
  2343. // If either MooTools or Prototype is on the page, then there's a chance that we
  2344. // can't trust "native" language features to actually be native. When this is
  2345. // the case, we take the safe route and fall back to our own non-native
  2346. // implementations.
  2347. win = Y.config.win,
  2348. unsafeNatives = win && !!(win.MooTools || win.Prototype),
  2349. UNDEFINED, // <-- Note the comma. We're still declaring vars.
  2350. /**
  2351. * Returns a new object that uses _obj_ as its prototype. This method wraps the
  2352. * native ES5 `Object.create()` method if available, but doesn't currently
  2353. * pass through `Object.create()`'s second argument (properties) in order to
  2354. * ensure compatibility with older browsers.
  2355. *
  2356. * @method ()
  2357. * @param {Object} obj Prototype object.
  2358. * @return {Object} New object using _obj_ as its prototype.
  2359. * @static
  2360. */
  2361. O = Y.Object = (!unsafeNatives && Object.create) ? function (obj) {
  2362. // We currently wrap the native Object.create instead of simply aliasing it
  2363. // to ensure consistency with our fallback shim, which currently doesn't
  2364. // support Object.create()'s second argument (properties). Once we have a
  2365. // safe fallback for the properties arg, we can stop wrapping
  2366. // Object.create().
  2367. return Object.create(obj);
  2368. } : (function () {
  2369. // Reusable constructor function for the Object.create() shim.
  2370. function F() {}
  2371. // The actual shim.
  2372. return function (obj) {
  2373. F.prototype = obj;
  2374. return new F();
  2375. };
  2376. }()),
  2377. /**
  2378. * Property names that IE doesn't enumerate in for..in loops, even when they
  2379. * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to
  2380. * manually enumerate these properties.
  2381. *
  2382. * @property _forceEnum
  2383. * @type String[]
  2384. * @protected
  2385. * @static
  2386. */
  2387. forceEnum = O._forceEnum = [
  2388. 'hasOwnProperty',
  2389. 'isPrototypeOf',
  2390. 'propertyIsEnumerable',
  2391. 'toString',
  2392. 'toLocaleString',
  2393. 'valueOf'
  2394. ],
  2395. /**
  2396. * `true` if this browser has the JScript enumeration bug that prevents
  2397. * enumeration of the properties named in the `_forceEnum` array, `false`
  2398. * otherwise.
  2399. *
  2400. * See:
  2401. * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
  2402. * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation>
  2403. *
  2404. * @property _hasEnumBug
  2405. * @type Boolean
  2406. * @protected
  2407. * @static
  2408. */
  2409. hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'),
  2410. /**
  2411. * `true` if this browser incorrectly considers the `prototype` property of
  2412. * functions to be enumerable. Currently known to affect Opera 11.50.
  2413. *
  2414. * @property _hasProtoEnumBug
  2415. * @type Boolean
  2416. * @protected
  2417. * @static
  2418. */
  2419. hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
  2420. /**
  2421. * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or
  2422. * exists only on _obj_'s prototype. This is essentially a safer version of
  2423. * `obj.hasOwnProperty()`.
  2424. *
  2425. * @method owns
  2426. * @param {Object} obj Object to test.
  2427. * @param {String} key Property name to look for.
  2428. * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
  2429. * @static
  2430. */
  2431. owns = O.owns = function (obj, key) {
  2432. return !!obj && hasOwn.call(obj, key);
  2433. }; // <-- End of var declarations.
  2434. /**
  2435. * Alias for `owns()`.
  2436. *
  2437. * @method hasKey
  2438. * @param {Object} obj Object to test.
  2439. * @param {String} key Property name to look for.
  2440. * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
  2441. * @static
  2442. */
  2443. O.hasKey = owns;
  2444. /**
  2445. * Returns an array containing the object's enumerable keys. Does not include
  2446. * prototype keys or non-enumerable keys.
  2447. *
  2448. * Note that keys are returned in enumeration order (that is, in the same order
  2449. * that they would be enumerated by a `for-in` loop), which may not be the same
  2450. * as the order in which they were defined.
  2451. *
  2452. * This method is an alias for the native ES5 `Object.keys()` method if
  2453. * available.
  2454. *
  2455. * @example
  2456. *
  2457. * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'});
  2458. * // => ['a', 'b', 'c']
  2459. *
  2460. * @method keys
  2461. * @param {Object} obj An object.
  2462. * @return {String[]} Array of keys.
  2463. * @static
  2464. */
  2465. O.keys = (!unsafeNatives && Object.keys) || function (obj) {
  2466. if (!Y.Lang.isObject(obj)) {
  2467. throw new TypeError('Object.keys called on a non-object');
  2468. }
  2469. var keys = [],
  2470. i, key, len;
  2471. if (hasProtoEnumBug && typeof obj === 'function') {
  2472. for (key in obj) {
  2473. if (owns(obj, key) && key !== 'prototype') {
  2474. keys.push(key);
  2475. }
  2476. }
  2477. } else {
  2478. for (key in obj) {
  2479. if (owns(obj, key)) {
  2480. keys.push(key);
  2481. }
  2482. }
  2483. }
  2484. if (hasEnumBug) {
  2485. for (i = 0, len = forceEnum.length; i < len; ++i) {
  2486. key = forceEnum[i];
  2487. if (owns(obj, key)) {
  2488. keys.push(key);
  2489. }
  2490. }
  2491. }
  2492. return keys;
  2493. };
  2494. /**
  2495. * Returns an array containing the values of the object's enumerable keys.
  2496. *
  2497. * Note that values are returned in enumeration order (that is, in the same
  2498. * order that they would be enumerated by a `for-in` loop), which may not be the
  2499. * same as the order in which they were defined.
  2500. *
  2501. * @example
  2502. *
  2503. * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'});
  2504. * // => ['foo', 'bar', 'baz']
  2505. *
  2506. * @method values
  2507. * @param {Object} obj An object.
  2508. * @return {Array} Array of values.
  2509. * @static
  2510. */
  2511. O.values = function (obj) {
  2512. var keys = O.keys(obj),
  2513. i = 0,
  2514. len = keys.length,
  2515. values = [];
  2516. for (; i < len; ++i) {
  2517. values.push(obj[keys[i]]);
  2518. }
  2519. return values;
  2520. };
  2521. /**
  2522. * Returns the number of enumerable keys owned by an object.
  2523. *
  2524. * @method size
  2525. * @param {Object} obj An object.
  2526. * @return {Number} The object's size.
  2527. * @static
  2528. */
  2529. O.size = function (obj) {
  2530. try {
  2531. return O.keys(obj).length;
  2532. } catch (ex) {
  2533. return 0; // Legacy behavior for non-objects.
  2534. }
  2535. };
  2536. /**
  2537. * Returns `true` if the object owns an enumerable property with the specified
  2538. * value.
  2539. *
  2540. * @method hasValue
  2541. * @param {Object} obj An object.
  2542. * @param {any} value The value to search for.
  2543. * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise.
  2544. * @static
  2545. */
  2546. O.hasValue = function (obj, value) {
  2547. return Y.Array.indexOf(O.values(obj), value) > -1;
  2548. };
  2549. /**
  2550. * Executes a function on each enumerable property in _obj_. The function
  2551. * receives the value, the key, and the object itself as parameters (in that
  2552. * order).
  2553. *
  2554. * By default, only properties owned by _obj_ are enumerated. To include
  2555. * prototype properties, set the _proto_ parameter to `true`.
  2556. *
  2557. * @method each
  2558. * @param {Object} obj Object to enumerate.
  2559. * @param {Function} fn Function to execute on each enumerable property.
  2560. * @param {mixed} fn.value Value of the current property.
  2561. * @param {String} fn.key Key of the current property.
  2562. * @param {Object} fn.obj Object being enumerated.
  2563. * @param {Object} [thisObj] `this` object to use when calling _fn_.
  2564. * @param {Boolean} [proto=false] Include prototype properties.
  2565. * @return {YUI} the YUI instance.
  2566. * @chainable
  2567. * @static
  2568. */
  2569. O.each = function (obj, fn, thisObj, proto) {
  2570. var key;
  2571. for (key in obj) {
  2572. if (proto || owns(obj, key)) {
  2573. fn.call(thisObj || Y, obj[key], key, obj);
  2574. }
  2575. }
  2576. return Y;
  2577. };
  2578. /**
  2579. * Executes a function on each enumerable property in _obj_, but halts if the
  2580. * function returns a truthy value. The function receives the value, the key,
  2581. * and the object itself as paramters (in that order).
  2582. *
  2583. * By default, only properties owned by _obj_ are enumerated. To include
  2584. * prototype properties, set the _proto_ parameter to `true`.
  2585. *
  2586. * @method some
  2587. * @param {Object} obj Object to enumerate.
  2588. * @param {Function} fn Function to execute on each enumerable property.
  2589. * @param {mixed} fn.value Value of the current property.
  2590. * @param {String} fn.key Key of the current property.
  2591. * @param {Object} fn.obj Object being enumerated.
  2592. * @param {Object} [thisObj] `this` object to use when calling _fn_.
  2593. * @param {Boolean} [proto=false] Include prototype properties.
  2594. * @return {Boolean} `true` if any execution of _fn_ returns a truthy value,
  2595. * `false` otherwise.
  2596. * @static
  2597. */
  2598. O.some = function (obj, fn, thisObj, proto) {
  2599. var key;
  2600. for (key in obj) {
  2601. if (proto || owns(obj, key)) {
  2602. if (fn.call(thisObj || Y, obj[key], key, obj)) {
  2603. return true;
  2604. }
  2605. }
  2606. }
  2607. return false;
  2608. };
  2609. /**
  2610. * Retrieves the sub value at the provided path,
  2611. * from the value object provided.
  2612. *
  2613. * @method getValue
  2614. * @static
  2615. * @param o The object from which to extract the property value.
  2616. * @param path {Array} A path array, specifying the object traversal path
  2617. * from which to obtain the sub value.
  2618. * @return {Any} The value stored in the path, undefined if not found,
  2619. * undefined if the source is not an object. Returns the source object
  2620. * if an empty path is provided.
  2621. */
  2622. O.getValue = function(o, path) {
  2623. if (!Y.Lang.isObject(o)) {
  2624. return UNDEFINED;
  2625. }
  2626. var i,
  2627. p = Y.Array(path),
  2628. l = p.length;
  2629. for (i = 0; o !== UNDEFINED && i < l; i++) {
  2630. o = o[p[i]];
  2631. }
  2632. return o;
  2633. };
  2634. /**
  2635. * Sets the sub-attribute value at the provided path on the
  2636. * value object. Returns the modified value object, or
  2637. * undefined if the path is invalid.
  2638. *
  2639. * @method setValue
  2640. * @static
  2641. * @param o The object on which to set the sub value.
  2642. * @param path {Array} A path array, specifying the object traversal path
  2643. * at which to set the sub value.
  2644. * @param val {Any} The new value for the sub-attribute.
  2645. * @return {Object} The modified object, with the new sub value set, or
  2646. * undefined, if the path was invalid.
  2647. */
  2648. O.setValue = function(o, path, val) {
  2649. var i,
  2650. p = Y.Array(path),
  2651. leafIdx = p.length - 1,
  2652. ref = o;
  2653. if (leafIdx >= 0) {
  2654. for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) {
  2655. ref = ref[p[i]];
  2656. }
  2657. if (ref !== UNDEFINED) {
  2658. ref[p[i]] = val;
  2659. } else {
  2660. return UNDEFINED;
  2661. }
  2662. }
  2663. return o;
  2664. };
  2665. /**
  2666. * Returns `true` if the object has no enumerable properties of its own.
  2667. *
  2668. * @method isEmpty
  2669. * @param {Object} obj An object.
  2670. * @return {Boolean} `true` if the object is empty.
  2671. * @static
  2672. * @since 3.2.0
  2673. */
  2674. O.isEmpty = function (obj) {
  2675. return !O.keys(obj).length;
  2676. };
  2677. /**
  2678. * The YUI module contains the components required for building the YUI seed
  2679. * file. This includes the script loading mechanism, a simple queue, and the
  2680. * core utilities for the library.
  2681. * @module yui
  2682. * @submodule yui-base
  2683. */
  2684. /**
  2685. * YUI user agent detection.
  2686. * Do not fork for a browser if it can be avoided. Use feature detection when
  2687. * you can. Use the user agent as a last resort. For all fields listed
  2688. * as @type float, UA stores a version number for the browser engine,
  2689. * 0 otherwise. This value may or may not map to the version number of
  2690. * the browser using the engine. The value is presented as a float so
  2691. * that it can easily be used for boolean evaluation as well as for
  2692. * looking for a particular range of versions. Because of this,
  2693. * some of the granularity of the version info may be lost. The fields that
  2694. * are @type string default to null. The API docs list the values that
  2695. * these fields can have.
  2696. * @class UA
  2697. * @static
  2698. */
  2699. /**
  2700. * Static method on `YUI.Env` for parsing a UA string. Called at instantiation
  2701. * to populate `Y.UA`.
  2702. *
  2703. * @static
  2704. * @method parseUA
  2705. * @param {String} [subUA=navigator.userAgent] UA string to parse
  2706. * @returns {Object} The Y.UA object
  2707. */
  2708. YUI.Env.parseUA = function(subUA) {
  2709. var numberify = function(s) {
  2710. var c = 0;
  2711. return parseFloat(s.replace(/\./g, function() {
  2712. return (c++ == 1) ? '' : '.';
  2713. }));
  2714. },
  2715. win = Y.config.win,
  2716. nav = win && win.navigator,
  2717. o = {
  2718. /**
  2719. * Internet Explorer version number or 0. Example: 6
  2720. * @property ie
  2721. * @type float
  2722. * @static
  2723. */
  2724. ie: 0,
  2725. /**
  2726. * Opera version number or 0. Example: 9.2
  2727. * @property opera
  2728. * @type float
  2729. * @static
  2730. */
  2731. opera: 0,
  2732. /**
  2733. * Gecko engine revision number. Will evaluate to 1 if Gecko
  2734. * is detected but the revision could not be found. Other browsers
  2735. * will be 0. Example: 1.8
  2736. * <pre>
  2737. * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
  2738. * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
  2739. * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
  2740. * Firefox 3.0 <-- 1.9
  2741. * Firefox 3.5 <-- 1.91
  2742. * </pre>
  2743. * @property gecko
  2744. * @type float
  2745. * @static
  2746. */
  2747. gecko: 0,
  2748. /**
  2749. * AppleWebKit version. KHTML browsers that are not WebKit browsers
  2750. * will evaluate to 1, other browsers 0. Example: 418.9
  2751. * <pre>
  2752. * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
  2753. * latest available for Mac OSX 10.3.
  2754. * Safari 2.0.2: 416 <-- hasOwnProperty introduced
  2755. * Safari 2.0.4: 418 <-- preventDefault fixed
  2756. * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
  2757. * different versions of webkit
  2758. * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
  2759. * updated, but not updated
  2760. * to the latest patch.
  2761. * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
  2762. * SVG and many major issues fixed).
  2763. * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
  2764. * update from 2.x via the 10.4.11 OS patch.
  2765. * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
  2766. * yahoo.com user agent hack removed.
  2767. * </pre>
  2768. * http://en.wikipedia.org/wiki/Safari_version_history
  2769. * @property webkit
  2770. * @type float
  2771. * @static
  2772. */
  2773. webkit: 0,
  2774. /**
  2775. * Safari will be detected as webkit, but this property will also
  2776. * be populated with the Safari version number
  2777. * @property safari
  2778. * @type float
  2779. * @static
  2780. */
  2781. safari: 0,
  2782. /**
  2783. * Chrome will be detected as webkit, but this property will also
  2784. * be populated with the Chrome version number
  2785. * @property chrome
  2786. * @type float
  2787. * @static
  2788. */
  2789. chrome: 0,
  2790. /**
  2791. * The mobile property will be set to a string containing any relevant
  2792. * user agent information when a modern mobile browser is detected.
  2793. * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
  2794. * devices with the WebKit-based browser, and Opera Mini.
  2795. * @property mobile
  2796. * @type string
  2797. * @default null
  2798. * @static
  2799. */
  2800. mobile: null,
  2801. /**
  2802. * Adobe AIR version number or 0. Only populated if webkit is detected.
  2803. * Example: 1.0
  2804. * @property air
  2805. * @type float
  2806. */
  2807. air: 0,
  2808. /**
  2809. * Detects Apple iPad's OS version
  2810. * @property ipad
  2811. * @type float
  2812. * @static
  2813. */
  2814. ipad: 0,
  2815. /**
  2816. * Detects Apple iPhone's OS version
  2817. * @property iphone
  2818. * @type float
  2819. * @static
  2820. */
  2821. iphone: 0,
  2822. /**
  2823. * Detects Apples iPod's OS version
  2824. * @property ipod
  2825. * @type float
  2826. * @static
  2827. */
  2828. ipod: 0,
  2829. /**
  2830. * General truthy check for iPad, iPhone or iPod
  2831. * @property ios
  2832. * @type float
  2833. * @default null
  2834. * @static
  2835. */
  2836. ios: null,
  2837. /**
  2838. * Detects Googles Android OS version
  2839. * @property android
  2840. * @type float
  2841. * @static
  2842. */
  2843. android: 0,
  2844. /**
  2845. * Detects Palms WebOS version
  2846. * @property webos
  2847. * @type float
  2848. * @static
  2849. */
  2850. webos: 0,
  2851. /**
  2852. * Google Caja version number or 0.
  2853. * @property caja
  2854. * @type float
  2855. */
  2856. caja: nav && nav.cajaVersion,
  2857. /**
  2858. * Set to true if the page appears to be in SSL
  2859. * @property secure
  2860. * @type boolean
  2861. * @static
  2862. */
  2863. secure: false,
  2864. /**
  2865. * The operating system. Currently only detecting windows or macintosh
  2866. * @property os
  2867. * @type string
  2868. * @default null
  2869. * @static
  2870. */
  2871. os: null
  2872. },
  2873. ua = subUA || nav && nav.userAgent,
  2874. loc = win && win.location,
  2875. href = loc && loc.href,
  2876. m;
  2877. /**
  2878. * The User Agent string that was parsed
  2879. * @property userAgent
  2880. * @type String
  2881. * @static
  2882. */
  2883. o.userAgent = ua;
  2884. o.secure = href && (href.toLowerCase().indexOf('https') === 0);
  2885. if (ua) {
  2886. if ((/windows|win32/i).test(ua)) {
  2887. o.os = 'windows';
  2888. } else if ((/macintosh/i).test(ua)) {
  2889. o.os = 'macintosh';
  2890. } else if ((/rhino/i).test(ua)) {
  2891. o.os = 'rhino';
  2892. }
  2893. // Modern KHTML browsers should qualify as Safari X-Grade
  2894. if ((/KHTML/).test(ua)) {
  2895. o.webkit = 1;
  2896. }
  2897. // Modern WebKit browsers are at least X-Grade
  2898. m = ua.match(/AppleWebKit\/([^\s]*)/);
  2899. if (m && m[1]) {
  2900. o.webkit = numberify(m[1]);
  2901. o.safari = o.webkit;
  2902. // Mobile browser check
  2903. if (/ Mobile\//.test(ua)) {
  2904. o.mobile = 'Apple'; // iPhone or iPod Touch
  2905. m = ua.match(/OS ([^\s]*)/);
  2906. if (m && m[1]) {
  2907. m = numberify(m[1].replace('_', '.'));
  2908. }
  2909. o.ios = m;
  2910. o.ipad = o.ipod = o.iphone = 0;
  2911. m = ua.match(/iPad|iPod|iPhone/);
  2912. if (m && m[0]) {
  2913. o[m[0].toLowerCase()] = o.ios;
  2914. }
  2915. } else {
  2916. m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/);
  2917. if (m) {
  2918. // Nokia N-series, webOS, ex: NokiaN95
  2919. o.mobile = m[0];
  2920. }
  2921. if (/webOS/.test(ua)) {
  2922. o.mobile = 'WebOS';
  2923. m = ua.match(/webOS\/([^\s]*);/);
  2924. if (m && m[1]) {
  2925. o.webos = numberify(m[1]);
  2926. }
  2927. }
  2928. if (/ Android/.test(ua)) {
  2929. if (/Mobile/.test(ua)) {
  2930. o.mobile = 'Android';
  2931. }
  2932. m = ua.match(/Android ([^\s]*);/);
  2933. if (m && m[1]) {
  2934. o.android = numberify(m[1]);
  2935. }
  2936. }
  2937. }
  2938. m = ua.match(/Chrome\/([^\s]*)/);
  2939. if (m && m[1]) {
  2940. o.chrome = numberify(m[1]); // Chrome
  2941. o.safari = 0; //Reset safari back to 0
  2942. } else {
  2943. m = ua.match(/AdobeAIR\/([^\s]*)/);
  2944. if (m) {
  2945. o.air = m[0]; // Adobe AIR 1.0 or better
  2946. }
  2947. }
  2948. }
  2949. if (!o.webkit) { // not webkit
  2950. // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
  2951. m = ua.match(/Opera[\s\/]([^\s]*)/);
  2952. if (m && m[1]) {
  2953. o.opera = numberify(m[1]);
  2954. m = ua.match(/Version\/([^\s]*)/);
  2955. if (m && m[1]) {
  2956. o.opera = numberify(m[1]); // opera 10+
  2957. }
  2958. m = ua.match(/Opera Mini[^;]*/);
  2959. if (m) {
  2960. o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
  2961. }
  2962. } else { // not opera or webkit
  2963. m = ua.match(/MSIE\s([^;]*)/);
  2964. if (m && m[1]) {
  2965. o.ie = numberify(m[1]);
  2966. } else { // not opera, webkit, or ie
  2967. m = ua.match(/Gecko\/([^\s]*)/);
  2968. if (m) {
  2969. o.gecko = 1; // Gecko detected, look for revision
  2970. m = ua.match(/rv:([^\s\)]*)/);
  2971. if (m && m[1]) {
  2972. o.gecko = numberify(m[1]);
  2973. }
  2974. }
  2975. }
  2976. }
  2977. }
  2978. }
  2979. //It was a parsed UA, do not assign the global value.
  2980. if (!subUA) {
  2981. YUI.Env.UA = o;
  2982. }
  2983. return o;
  2984. };
  2985. Y.UA = YUI.Env.UA || YUI.Env.parseUA();
  2986. YUI.Env.aliases = {
  2987. "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],
  2988. "app": ["controller","model","model-list","view"],
  2989. "attribute": ["attribute-base","attribute-complex"],
  2990. "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],
  2991. "base": ["base-base","base-pluginhost","base-build"],
  2992. "cache": ["cache-base","cache-offline","cache-plugin"],
  2993. "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"],
  2994. "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],
  2995. "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],
  2996. "datatable": ["datatable-base","datatable-datasource","datatable-sort","datatable-scroll"],
  2997. "datatype": ["datatype-number","datatype-date","datatype-xml"],
  2998. "datatype-date": ["datatype-date-parse","datatype-date-format"],
  2999. "datatype-number": ["datatype-number-parse","datatype-number-format"],
  3000. "datatype-xml": ["datatype-xml-parse","datatype-xml-format"],
  3001. "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
  3002. "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"],
  3003. "editor": ["frame","selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],
  3004. "event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside"],
  3005. "event-custom": ["event-custom-base","event-custom-complex"],
  3006. "event-gestures": ["event-flick","event-move"],
  3007. "highlight": ["highlight-base","highlight-accentfold"],
  3008. "history": ["history-base","history-hash","history-hash-ie","history-html5"],
  3009. "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"],
  3010. "json": ["json-parse","json-stringify"],
  3011. "loader": ["loader-base","loader-rollup","loader-yui3"],
  3012. "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"],
  3013. "pluginhost": ["pluginhost-base","pluginhost-config"],
  3014. "querystring": ["querystring-parse","querystring-stringify"],
  3015. "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"],
  3016. "resize": ["resize-base","resize-proxy","resize-constrain"],
  3017. "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"],
  3018. "text": ["text-accentfold","text-wordbreak"],
  3019. "widget": ["widget-base","widget-htmlparser","widget-uievents","widget-skin"]
  3020. };
  3021. }, '3.4.0' );
  3022. YUI.add('get', function(Y) {
  3023. /**
  3024. * Provides a mechanism to fetch remote resources and
  3025. * insert them into a document.
  3026. * @module yui
  3027. * @submodule get
  3028. */
  3029. /**
  3030. * Fetches and inserts one or more script or link nodes into the document
  3031. * @class Get
  3032. * @static
  3033. */
  3034. var ua = Y.UA,
  3035. L = Y.Lang,
  3036. TYPE_JS = 'text/javascript',
  3037. TYPE_CSS = 'text/css',
  3038. STYLESHEET = 'stylesheet',
  3039. SCRIPT = 'script',
  3040. AUTOPURGE = 'autopurge',
  3041. UTF8 = 'utf-8',
  3042. LINK = 'link',
  3043. ASYNC = 'async',
  3044. ALL = true,
  3045. // FireFox does not support the onload event for link nodes, so
  3046. // there is no way to make the css requests synchronous. This means
  3047. // that the css rules in multiple files could be applied out of order
  3048. // in this browser if a later request returns before an earlier one.
  3049. // Safari too.
  3050. ONLOAD_SUPPORTED = {
  3051. script: ALL,
  3052. css: !(ua.webkit || ua.gecko)
  3053. },
  3054. /**
  3055. * hash of queues to manage multiple requests
  3056. * @property queues
  3057. * @private
  3058. */
  3059. queues = {},
  3060. /**
  3061. * queue index used to generate transaction ids
  3062. * @property qidx
  3063. * @type int
  3064. * @private
  3065. */
  3066. qidx = 0,
  3067. /**
  3068. * interal property used to prevent multiple simultaneous purge
  3069. * processes
  3070. * @property purging
  3071. * @type boolean
  3072. * @private
  3073. */
  3074. purging,
  3075. /**
  3076. * Clear timeout state
  3077. *
  3078. * @method _clearTimeout
  3079. * @param {Object} q Queue data
  3080. * @private
  3081. */
  3082. _clearTimeout = function(q) {
  3083. var timer = q.timer;
  3084. if (timer) {
  3085. clearTimeout(timer);
  3086. q.timer = null;
  3087. }
  3088. },
  3089. /**
  3090. * Generates an HTML element, this is not appended to a document
  3091. * @method _node
  3092. * @param {string} type the type of element.
  3093. * @param {Object} attr the fixed set of attribute for the type.
  3094. * @param {Object} custAttrs optional Any custom attributes provided by the user.
  3095. * @param {Window} win optional window to create the element in.
  3096. * @return {HTMLElement} the generated node.
  3097. * @private
  3098. */
  3099. _node = function(type, attr, custAttrs, win) {
  3100. var w = win || Y.config.win,
  3101. d = w.document,
  3102. n = d.createElement(type),
  3103. i;
  3104. if (custAttrs) {
  3105. Y.mix(attr, custAttrs);
  3106. }
  3107. for (i in attr) {
  3108. if (attr[i] && attr.hasOwnProperty(i)) {
  3109. n.setAttribute(i, attr[i]);
  3110. }
  3111. }
  3112. return n;
  3113. },
  3114. /**
  3115. * Generates a link node
  3116. * @method _linkNode
  3117. * @param {string} url the url for the css file.
  3118. * @param {Window} win optional window to create the node in.
  3119. * @param {object} attributes optional attributes collection to apply to the
  3120. * new node.
  3121. * @return {HTMLElement} the generated node.
  3122. * @private
  3123. */
  3124. _linkNode = function(url, win, attributes) {
  3125. return _node(LINK, {
  3126. id: Y.guid(),
  3127. type: TYPE_CSS,
  3128. rel: STYLESHEET,
  3129. href: url
  3130. }, attributes, win);
  3131. },
  3132. /**
  3133. * Generates a script node
  3134. * @method _scriptNode
  3135. * @param {string} url the url for the script file.
  3136. * @param {Window} win optional window to create the node in.
  3137. * @param {object} attributes optional attributes collection to apply to the
  3138. * new node.
  3139. * @return {HTMLElement} the generated node.
  3140. * @private
  3141. */
  3142. _scriptNode = function(url, win, attributes) {
  3143. return _node(SCRIPT, {
  3144. id: Y.guid(),
  3145. type: TYPE_JS,
  3146. src: url
  3147. }, attributes, win);
  3148. },
  3149. /**
  3150. * Returns the data payload for callback functions.
  3151. * @method _returnData
  3152. * @param {object} q the queue.
  3153. * @param {string} msg the result message.
  3154. * @param {string} result the status message from the request.
  3155. * @return {object} the state data from the request.
  3156. * @private
  3157. */
  3158. _returnData = function(q, msg, result) {
  3159. return {
  3160. tId: q.tId,
  3161. win: q.win,
  3162. data: q.data,
  3163. nodes: q.nodes,
  3164. msg: msg,
  3165. statusText: result,
  3166. purge: function() {
  3167. _purge(this.tId);
  3168. }
  3169. };
  3170. },
  3171. /**
  3172. * The transaction is finished
  3173. * @method _end
  3174. * @param {string} id the id of the request.
  3175. * @param {string} msg the result message.
  3176. * @param {string} result the status message from the request.
  3177. * @private
  3178. */
  3179. _end = function(id, msg, result) {
  3180. var q = queues[id],
  3181. onEnd = q && q.onEnd;
  3182. q.finished = true;
  3183. if (onEnd) {
  3184. onEnd.call(q.context, _returnData(q, msg, result));
  3185. }
  3186. },
  3187. /**
  3188. * The request failed, execute fail handler with whatever
  3189. * was accomplished. There isn't a failure case at the
  3190. * moment unless you count aborted transactions
  3191. * @method _fail
  3192. * @param {string} id the id of the request
  3193. * @private
  3194. */
  3195. _fail = function(id, msg) {
  3196. var q = queues[id],
  3197. onFailure = q.onFailure;
  3198. _clearTimeout(q);
  3199. if (onFailure) {
  3200. onFailure.call(q.context, _returnData(q, msg));
  3201. }
  3202. _end(id, msg, 'failure');
  3203. },
  3204. /**
  3205. * Abort the transaction
  3206. *
  3207. * @method _abort
  3208. * @param {Object} id
  3209. * @private
  3210. */
  3211. _abort = function(id) {
  3212. _fail(id, 'transaction ' + id + ' was aborted');
  3213. },
  3214. /**
  3215. * The request is complete, so executing the requester's callback
  3216. * @method _complete
  3217. * @param {string} id the id of the request.
  3218. * @private
  3219. */
  3220. _complete = function(id) {
  3221. var q = queues[id],
  3222. onSuccess = q.onSuccess;
  3223. _clearTimeout(q);
  3224. if (q.aborted) {
  3225. _abort(id);
  3226. } else {
  3227. if (onSuccess) {
  3228. onSuccess.call(q.context, _returnData(q));
  3229. }
  3230. // 3.3.0 had undefined msg for this path.
  3231. _end(id, undefined, 'OK');
  3232. }
  3233. },
  3234. /**
  3235. * Get node reference, from string
  3236. *
  3237. * @method _getNodeRef
  3238. * @param {String|HTMLElement} nId The node id to find. If an HTMLElement is passed in, it will be returned.
  3239. * @param {String} tId Queue id, used to determine document for queue
  3240. * @private
  3241. */
  3242. _getNodeRef = function(nId, tId) {
  3243. var q = queues[tId],
  3244. n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
  3245. if (!n) {
  3246. _fail(tId, 'target node not found: ' + nId);
  3247. }
  3248. return n;
  3249. },
  3250. /**
  3251. * Removes the nodes for the specified queue
  3252. * @method _purge
  3253. * @param {string} tId the transaction id.
  3254. * @private
  3255. */
  3256. _purge = function(tId) {
  3257. var nodes, doc, parent, sibling, node, attr, insertBefore,
  3258. i, l,
  3259. q = queues[tId];
  3260. if (q) {
  3261. nodes = q.nodes;
  3262. l = nodes.length;
  3263. // TODO: Why is node.parentNode undefined? Which forces us To Do this...
  3264. /*
  3265. doc = q.win.document;
  3266. parent = doc.getElementsByTagName('head')[0];
  3267. insertBefore = q.insertBefore || doc.getElementsByTagName('base')[0];
  3268. if (insertBefore) {
  3269. sibling = _getNodeRef(insertBefore, tId);
  3270. if (sibling) {
  3271. parent = sibling.parentNode;
  3272. }
  3273. }
  3274. */
  3275. for (i = 0; i < l; i++) {
  3276. node = nodes[i];
  3277. parent = node.parentNode;
  3278. if (node.clearAttributes) {
  3279. node.clearAttributes();
  3280. } else {
  3281. // This destroys parentNode ref, so we hold onto it above first.
  3282. for (attr in node) {
  3283. if (node.hasOwnProperty(attr)) {
  3284. delete node[attr];
  3285. }
  3286. }
  3287. }
  3288. parent.removeChild(node);
  3289. }
  3290. }
  3291. q.nodes = [];
  3292. },
  3293. /**
  3294. * Progress callback
  3295. *
  3296. * @method _progress
  3297. * @param {string} id The id of the request.
  3298. * @param {string} The url which just completed.
  3299. * @private
  3300. */
  3301. _progress = function(id, url) {
  3302. var q = queues[id],
  3303. onProgress = q.onProgress,
  3304. o;
  3305. if (onProgress) {
  3306. o = _returnData(q);
  3307. o.url = url;
  3308. onProgress.call(q.context, o);
  3309. }
  3310. },
  3311. /**
  3312. * Timeout detected
  3313. * @method _timeout
  3314. * @param {string} id the id of the request.
  3315. * @private
  3316. */
  3317. _timeout = function(id) {
  3318. var q = queues[id],
  3319. onTimeout = q.onTimeout;
  3320. if (onTimeout) {
  3321. onTimeout.call(q.context, _returnData(q));
  3322. }
  3323. _end(id, 'timeout', 'timeout');
  3324. },
  3325. /**
  3326. * onload callback
  3327. * @method _loaded
  3328. * @param {string} id the id of the request.
  3329. * @return {string} the result.
  3330. * @private
  3331. */
  3332. _loaded = function(id, url) {
  3333. var q = queues[id],
  3334. sync = (q && !q.async);
  3335. if (!q) {
  3336. return;
  3337. }
  3338. if (sync) {
  3339. _clearTimeout(q);
  3340. }
  3341. _progress(id, url);
  3342. // TODO: Cleaning up flow to have a consistent end point
  3343. // !q.finished check is for the async case,
  3344. // where scripts may still be loading when we've
  3345. // already aborted. Ideally there should be a single path
  3346. // for this.
  3347. if (!q.finished) {
  3348. if (q.aborted) {
  3349. _abort(id);
  3350. } else {
  3351. if ((--q.remaining) === 0) {
  3352. _complete(id);
  3353. } else if (sync) {
  3354. _next(id);
  3355. }
  3356. }
  3357. }
  3358. },
  3359. /**
  3360. * Detects when a node has been loaded. In the case of
  3361. * script nodes, this does not guarantee that contained
  3362. * script is ready to use.
  3363. * @method _trackLoad
  3364. * @param {string} type the type of node to track.
  3365. * @param {HTMLElement} n the node to track.
  3366. * @param {string} id the id of the request.
  3367. * @param {string} url the url that is being loaded.
  3368. * @private
  3369. */
  3370. _trackLoad = function(type, n, id, url) {
  3371. // TODO: Can we massage this to use ONLOAD_SUPPORTED[type]?
  3372. // IE supports the readystatechange event for script and css nodes
  3373. // Opera only for script nodes. Opera support onload for script
  3374. // nodes, but this doesn't fire when there is a load failure.
  3375. // The onreadystatechange appears to be a better way to respond
  3376. // to both success and failure.
  3377. if (ua.ie) {
  3378. n.onreadystatechange = function() {
  3379. var rs = this.readyState;
  3380. if ('loaded' === rs || 'complete' === rs) {
  3381. n.onreadystatechange = null;
  3382. _loaded(id, url);
  3383. }
  3384. };
  3385. } else if (ua.webkit) {
  3386. // webkit prior to 3.x is no longer supported
  3387. if (type === SCRIPT) {
  3388. // Safari 3.x supports the load event for script nodes (DOM2)
  3389. n.addEventListener('load', function() {
  3390. _loaded(id, url);
  3391. }, false);
  3392. }
  3393. } else {
  3394. // FireFox and Opera support onload (but not DOM2 in FF) handlers for
  3395. // script nodes. Opera, but not FF, supports the onload event for link nodes.
  3396. n.onload = function() {
  3397. _loaded(id, url);
  3398. };
  3399. n.onerror = function(e) {
  3400. _fail(id, e + ': ' + url);
  3401. };
  3402. }
  3403. },
  3404. _insertInDoc = function(node, id, win) {
  3405. // Add it to the head or insert it before 'insertBefore'.
  3406. // Work around IE bug if there is a base tag.
  3407. var q = queues[id],
  3408. doc = win.document,
  3409. insertBefore = q.insertBefore || doc.getElementsByTagName('base')[0],
  3410. sibling;
  3411. if (insertBefore) {
  3412. sibling = _getNodeRef(insertBefore, id);
  3413. if (sibling) {
  3414. sibling.parentNode.insertBefore(node, sibling);
  3415. }
  3416. } else {
  3417. // 3.3.0 assumed head is always around.
  3418. doc.getElementsByTagName('head')[0].appendChild(node);
  3419. }
  3420. },
  3421. /**
  3422. * Loads the next item for a given request
  3423. * @method _next
  3424. * @param {string} id the id of the request.
  3425. * @return {string} the result.
  3426. * @private
  3427. */
  3428. _next = function(id) {
  3429. // Assigning out here for readability
  3430. var q = queues[id],
  3431. type = q.type,
  3432. attrs = q.attributes,
  3433. win = q.win,
  3434. timeout = q.timeout,
  3435. node,
  3436. url;
  3437. if (q.url.length > 0) {
  3438. url = q.url.shift();
  3439. // !q.timer ensures that this only happens once for async
  3440. if (timeout && !q.timer) {
  3441. q.timer = setTimeout(function() {
  3442. _timeout(id);
  3443. }, timeout);
  3444. }
  3445. if (type === SCRIPT) {
  3446. node = _scriptNode(url, win, attrs);
  3447. } else {
  3448. node = _linkNode(url, win, attrs);
  3449. }
  3450. // add the node to the queue so we can return it in the callback
  3451. q.nodes.push(node);
  3452. _trackLoad(type, node, id, url);
  3453. _insertInDoc(node, id, win);
  3454. if (!ONLOAD_SUPPORTED[type]) {
  3455. _loaded(id, url);
  3456. }
  3457. if (q.async) {
  3458. // For sync, the _next call is chained in _loaded
  3459. _next(id);
  3460. }
  3461. }
  3462. },
  3463. /**
  3464. * Removes processed queues and corresponding nodes
  3465. * @method _autoPurge
  3466. * @private
  3467. */
  3468. _autoPurge = function() {
  3469. if (purging) {
  3470. return;
  3471. }
  3472. purging = true;
  3473. var i, q;
  3474. for (i in queues) {
  3475. if (queues.hasOwnProperty(i)) {
  3476. q = queues[i];
  3477. if (q.autopurge && q.finished) {
  3478. _purge(q.tId);
  3479. delete queues[i];
  3480. }
  3481. }
  3482. }
  3483. purging = false;
  3484. },
  3485. /**
  3486. * Saves the state for the request and begins loading
  3487. * the requested urls
  3488. * @method queue
  3489. * @param {string} type the type of node to insert.
  3490. * @param {string} url the url to load.
  3491. * @param {object} opts the hash of options for this request.
  3492. * @return {object} transaction object.
  3493. * @private
  3494. */
  3495. _queue = function(type, url, opts) {
  3496. opts = opts || {};
  3497. var id = 'q' + (qidx++),
  3498. thresh = opts.purgethreshold || Y.Get.PURGE_THRESH,
  3499. q;
  3500. if (qidx % thresh === 0) {
  3501. _autoPurge();
  3502. }
  3503. // Merge to protect opts (grandfathered in).
  3504. q = queues[id] = Y.merge(opts);
  3505. // Avoid mix, merge overhead. Known set of props.
  3506. q.tId = id;
  3507. q.type = type;
  3508. q.url = url;
  3509. q.finished = false;
  3510. q.nodes = [];
  3511. q.win = q.win || Y.config.win;
  3512. q.context = q.context || q;
  3513. q.autopurge = (AUTOPURGE in q) ? q.autopurge : (type === SCRIPT) ? true : false;
  3514. q.attributes = q.attributes || {};
  3515. q.attributes.charset = opts.charset || q.attributes.charset || UTF8;
  3516. if (ASYNC in q && type === SCRIPT) {
  3517. q.attributes.async = q.async;
  3518. }
  3519. q.url = (L.isString(q.url)) ? [q.url] : q.url;
  3520. // TODO: Do we really need to account for this developer error?
  3521. // If the url is undefined, this is probably a trailing comma problem in IE.
  3522. if (!q.url[0]) {
  3523. q.url.shift();
  3524. }
  3525. q.remaining = q.url.length;
  3526. _next(id);
  3527. return {
  3528. tId: id
  3529. };
  3530. };
  3531. Y.Get = {
  3532. /**
  3533. * The number of request required before an automatic purge.
  3534. * Can be configured via the 'purgethreshold' config
  3535. * @property PURGE_THRESH
  3536. * @static
  3537. * @type int
  3538. * @default 20
  3539. * @private
  3540. */
  3541. PURGE_THRESH: 20,
  3542. /**
  3543. * Abort a transaction
  3544. * @method abort
  3545. * @static
  3546. * @param {string|object} o Either the tId or the object returned from
  3547. * script() or css().
  3548. */
  3549. abort : function(o) {
  3550. var id = (L.isString(o)) ? o : o.tId,
  3551. q = queues[id];
  3552. if (q) {
  3553. q.aborted = true;
  3554. }
  3555. },
  3556. /**
  3557. * Fetches and inserts one or more script nodes into the head
  3558. * of the current document or the document in a specified window.
  3559. *
  3560. * @method script
  3561. * @static
  3562. * @param {string|string[]} url the url or urls to the script(s).
  3563. * @param {object} opts Options:
  3564. * <dl>
  3565. * <dt>onSuccess</dt>
  3566. * <dd>
  3567. * callback to execute when the script(s) are finished loading
  3568. * The callback receives an object back with the following
  3569. * data:
  3570. * <dl>
  3571. * <dt>win</dt>
  3572. * <dd>the window the script(s) were inserted into</dd>
  3573. * <dt>data</dt>
  3574. * <dd>the data object passed in when the request was made</dd>
  3575. * <dt>nodes</dt>
  3576. * <dd>An array containing references to the nodes that were
  3577. * inserted</dd>
  3578. * <dt>purge</dt>
  3579. * <dd>A function that, when executed, will remove the nodes
  3580. * that were inserted</dd>
  3581. * <dt>
  3582. * </dl>
  3583. * </dd>
  3584. * <dt>onTimeout</dt>
  3585. * <dd>
  3586. * callback to execute when a timeout occurs.
  3587. * The callback receives an object back with the following
  3588. * data:
  3589. * <dl>
  3590. * <dt>win</dt>
  3591. * <dd>the window the script(s) were inserted into</dd>
  3592. * <dt>data</dt>
  3593. * <dd>the data object passed in when the request was made</dd>
  3594. * <dt>nodes</dt>
  3595. * <dd>An array containing references to the nodes that were
  3596. * inserted</dd>
  3597. * <dt>purge</dt>
  3598. * <dd>A function that, when executed, will remove the nodes
  3599. * that were inserted</dd>
  3600. * <dt>
  3601. * </dl>
  3602. * </dd>
  3603. * <dt>onEnd</dt>
  3604. * <dd>a function that executes when the transaction finishes,
  3605. * regardless of the exit path</dd>
  3606. * <dt>onFailure</dt>
  3607. * <dd>
  3608. * callback to execute when the script load operation fails
  3609. * The callback receives an object back with the following
  3610. * data:
  3611. * <dl>
  3612. * <dt>win</dt>
  3613. * <dd>the window the script(s) were inserted into</dd>
  3614. * <dt>data</dt>
  3615. * <dd>the data object passed in when the request was made</dd>
  3616. * <dt>nodes</dt>
  3617. * <dd>An array containing references to the nodes that were
  3618. * inserted successfully</dd>
  3619. * <dt>purge</dt>
  3620. * <dd>A function that, when executed, will remove any nodes
  3621. * that were inserted</dd>
  3622. * <dt>
  3623. * </dl>
  3624. * </dd>
  3625. * <dt>onProgress</dt>
  3626. * <dd>callback to execute when each individual file is done loading
  3627. * (useful when passing in an array of js files). Receives the same
  3628. * payload as onSuccess, with the addition of a <code>url</code>
  3629. * property, which identifies the file which was loaded.</dd>
  3630. * <dt>async</dt>
  3631. * <dd>
  3632. * <p>When passing in an array of JS files, setting this flag to true
  3633. * will insert them into the document in parallel, as opposed to the
  3634. * default behavior, which is to chain load them serially. It will also
  3635. * set the async attribute on the script node to true.</p>
  3636. * <p>Setting async:true
  3637. * will lead to optimal file download performance allowing the browser to
  3638. * download multiple scripts in parallel, and execute them as soon as they
  3639. * are available.</p>
  3640. * <p>Note that async:true does not guarantee execution order of the
  3641. * scripts being downloaded. They are executed in whichever order they
  3642. * are received.</p>
  3643. * </dd>
  3644. * <dt>context</dt>
  3645. * <dd>the execution context for the callbacks</dd>
  3646. * <dt>win</dt>
  3647. * <dd>a window other than the one the utility occupies</dd>
  3648. * <dt>autopurge</dt>
  3649. * <dd>
  3650. * setting to true will let the utilities cleanup routine purge
  3651. * the script once loaded
  3652. * </dd>
  3653. * <dt>purgethreshold</dt>
  3654. * <dd>
  3655. * The number of transaction before autopurge should be initiated
  3656. * </dd>
  3657. * <dt>data</dt>
  3658. * <dd>
  3659. * data that is supplied to the callback when the script(s) are
  3660. * loaded.
  3661. * </dd>
  3662. * <dt>insertBefore</dt>
  3663. * <dd>node or node id that will become the new node's nextSibling.
  3664. * If this is not specified, nodes will be inserted before a base
  3665. * tag should it exist. Otherwise, the nodes will be appended to the
  3666. * end of the document head.</dd>
  3667. * </dl>
  3668. * <dt>charset</dt>
  3669. * <dd>Node charset, default utf-8 (deprecated, use the attributes
  3670. * config)</dd>
  3671. * <dt>attributes</dt>
  3672. * <dd>An object literal containing additional attributes to add to
  3673. * the link tags</dd>
  3674. * <dt>timeout</dt>
  3675. * <dd>Number of milliseconds to wait before aborting and firing
  3676. * the timeout event</dd>
  3677. * <pre>
  3678. * &nbsp; Y.Get.script(
  3679. * &nbsp; ["http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js",
  3680. * &nbsp; "http://yui.yahooapis.com/2.5.2/build/event/event-min.js"],
  3681. * &nbsp; &#123;
  3682. * &nbsp; onSuccess: function(o) &#123;
  3683. * &nbsp; this.log("won't cause error because Y is the context");
  3684. * &nbsp; // immediately
  3685. * &nbsp; &#125;,
  3686. * &nbsp; onFailure: function(o) &#123;
  3687. * &nbsp; &#125;,
  3688. * &nbsp; onTimeout: function(o) &#123;
  3689. * &nbsp; &#125;,
  3690. * &nbsp; data: "foo",
  3691. * &nbsp; timeout: 10000, // 10 second timeout
  3692. * &nbsp; context: Y, // make the YUI instance
  3693. * &nbsp; // win: otherframe // target another window/frame
  3694. * &nbsp; autopurge: true // allow the utility to choose when to
  3695. * &nbsp; // remove the nodes
  3696. * &nbsp; purgetheshold: 1 // purge previous transaction before
  3697. * &nbsp; // next transaction
  3698. * &nbsp; &#125;);.
  3699. * </pre>
  3700. * @return {tId: string} an object containing info about the
  3701. * transaction.
  3702. */
  3703. script: function(url, opts) {
  3704. return _queue(SCRIPT, url, opts);
  3705. },
  3706. /**
  3707. * Fetches and inserts one or more css link nodes into the
  3708. * head of the current document or the document in a specified
  3709. * window.
  3710. * @method css
  3711. * @static
  3712. * @param {string} url the url or urls to the css file(s).
  3713. * @param {object} opts Options:
  3714. * <dl>
  3715. * <dt>onSuccess</dt>
  3716. * <dd>
  3717. * callback to execute when the css file(s) are finished loading
  3718. * The callback receives an object back with the following
  3719. * data:
  3720. * <dl>win</dl>
  3721. * <dd>the window the link nodes(s) were inserted into</dd>
  3722. * <dt>data</dt>
  3723. * <dd>the data object passed in when the request was made</dd>
  3724. * <dt>nodes</dt>
  3725. * <dd>An array containing references to the nodes that were
  3726. * inserted</dd>
  3727. * <dt>purge</dt>
  3728. * <dd>A function that, when executed, will remove the nodes
  3729. * that were inserted</dd>
  3730. * <dt>
  3731. * </dl>
  3732. * </dd>
  3733. * <dt>onProgress</dt>
  3734. * <dd>callback to execute when each individual file is done loading (useful when passing in an array of css files). Receives the same
  3735. * payload as onSuccess, with the addition of a <code>url</code> property, which identifies the file which was loaded. Currently only useful for non Webkit/Gecko browsers,
  3736. * where onload for css is detected accurately.</dd>
  3737. * <dt>async</dt>
  3738. * <dd>When passing in an array of css files, setting this flag to true will insert them
  3739. * into the document in parallel, as oppposed to the default behavior, which is to chain load them (where possible).
  3740. * This flag is more useful for scripts currently, since for css Get only chains if not Webkit/Gecko.</dd>
  3741. * <dt>context</dt>
  3742. * <dd>the execution context for the callbacks</dd>
  3743. * <dt>win</dt>
  3744. * <dd>a window other than the one the utility occupies</dd>
  3745. * <dt>data</dt>
  3746. * <dd>
  3747. * data that is supplied to the callbacks when the nodes(s) are
  3748. * loaded.
  3749. * </dd>
  3750. * <dt>insertBefore</dt>
  3751. * <dd>node or node id that will become the new node's nextSibling</dd>
  3752. * <dt>charset</dt>
  3753. * <dd>Node charset, default utf-8 (deprecated, use the attributes
  3754. * config)</dd>
  3755. * <dt>attributes</dt>
  3756. * <dd>An object literal containing additional attributes to add to
  3757. * the link tags</dd>
  3758. * </dl>
  3759. * <pre>
  3760. * Y.Get.css("http://localhost/css/menu.css");
  3761. * </pre>
  3762. * <pre>
  3763. * &nbsp; Y.Get.css(
  3764. * &nbsp; ["http://localhost/css/menu.css",
  3765. * &nbsp; insertBefore: 'custom-styles' // nodes will be inserted
  3766. * &nbsp; // before the specified node
  3767. * &nbsp; &#125;);.
  3768. * </pre>
  3769. * @return {tId: string} an object containing info about the
  3770. * transaction.
  3771. */
  3772. css: function(url, opts) {
  3773. return _queue('css', url, opts);
  3774. }
  3775. };
  3776. }, '3.4.0' ,{requires:['yui-base']});
  3777. YUI.add('features', function(Y) {
  3778. var feature_tests = {};
  3779. /**
  3780. Contains the core of YUI's feature test architecture.
  3781. @module features
  3782. */
  3783. /**
  3784. * Feature detection
  3785. * @class Features
  3786. * @static
  3787. */
  3788. Y.mix(Y.namespace('Features'), {
  3789. /**
  3790. * Object hash of all registered feature tests
  3791. * @property tests
  3792. * @type Object
  3793. */
  3794. tests: feature_tests,
  3795. /**
  3796. * Add a test to the system
  3797. *
  3798. * ```
  3799. * Y.Features.add("load", "1", {});
  3800. * ```
  3801. *
  3802. * @method add
  3803. * @param {String} cat The category, right now only 'load' is supported
  3804. * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
  3805. * @param {Object} o Object containing test properties
  3806. * @param {String} o.name The name of the test
  3807. * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
  3808. * @param {String} o.trigger The module that triggers this test.
  3809. */
  3810. add: function(cat, name, o) {
  3811. feature_tests[cat] = feature_tests[cat] || {};
  3812. feature_tests[cat][name] = o;
  3813. },
  3814. /**
  3815. * Execute all tests of a given category and return the serialized results
  3816. *
  3817. * ```
  3818. * caps=1:1;2:1;3:0
  3819. * ```
  3820. * @method all
  3821. * @param {String} cat The category to execute
  3822. * @param {Array} args The arguments to pass to the test function
  3823. * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0
  3824. */
  3825. all: function(cat, args) {
  3826. var cat_o = feature_tests[cat],
  3827. // results = {};
  3828. result = [];
  3829. if (cat_o) {
  3830. Y.Object.each(cat_o, function(v, k) {
  3831. result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0));
  3832. });
  3833. }
  3834. return (result.length) ? result.join(';') : '';
  3835. },
  3836. /**
  3837. * Run a sepecific test and return a Boolean response.
  3838. *
  3839. * ```
  3840. * Y.Features.test("load", "1");
  3841. * ```
  3842. *
  3843. * @method test
  3844. * @param {String} cat The category of the test to run
  3845. * @param {String} name The name of the test to run
  3846. * @param {Array} args The arguments to pass to the test function
  3847. * @return {Boolean} True or false if the test passed/failed.
  3848. */
  3849. test: function(cat, name, args) {
  3850. args = args || [];
  3851. var result, ua, test,
  3852. cat_o = feature_tests[cat],
  3853. feature = cat_o && cat_o[name];
  3854. if (!feature) {
  3855. } else {
  3856. result = feature.result;
  3857. if (Y.Lang.isUndefined(result)) {
  3858. ua = feature.ua;
  3859. if (ua) {
  3860. result = (Y.UA[ua]);
  3861. }
  3862. test = feature.test;
  3863. if (test && ((!ua) || result)) {
  3864. result = test.apply(Y, args);
  3865. }
  3866. feature.result = result;
  3867. }
  3868. }
  3869. return result;
  3870. }
  3871. });
  3872. // Y.Features.add("load", "1", {});
  3873. // Y.Features.test("load", "1");
  3874. // caps=1:1;2:0;3:1;
  3875. /* This file is auto-generated by src/loader/scripts/meta_join.py */
  3876. var add = Y.Features.add;
  3877. // graphics-canvas-default
  3878. add('load', '0', {
  3879. "name": "graphics-canvas-default",
  3880. "test": function(Y) {
  3881. var DOCUMENT = Y.config.doc,
  3882. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  3883. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
  3884. },
  3885. "trigger": "graphics"
  3886. });
  3887. // autocomplete-list-keys
  3888. add('load', '1', {
  3889. "name": "autocomplete-list-keys",
  3890. "test": function (Y) {
  3891. // Only add keyboard support to autocomplete-list if this doesn't appear to
  3892. // be an iOS or Android-based mobile device.
  3893. //
  3894. // There's currently no feasible way to actually detect whether a device has
  3895. // a hardware keyboard, so this sniff will have To Do. It can easily be
  3896. // overridden by manually loading the autocomplete-list-keys module.
  3897. //
  3898. // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
  3899. // doesn't fire the keyboard events used by AutoCompleteList, so there's
  3900. // no point loading the -keys module even when a bluetooth keyboard may be
  3901. // available.
  3902. return !(Y.UA.ios || Y.UA.android);
  3903. },
  3904. "trigger": "autocomplete-list"
  3905. });
  3906. // graphics-svg
  3907. add('load', '2', {
  3908. "name": "graphics-svg",
  3909. "test": function(Y) {
  3910. var DOCUMENT = Y.config.doc;
  3911. return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
  3912. },
  3913. "trigger": "graphics"
  3914. });
  3915. // history-hash-ie
  3916. add('load', '3', {
  3917. "name": "history-hash-ie",
  3918. "test": function (Y) {
  3919. var docMode = Y.config.doc && Y.config.doc.documentMode;
  3920. return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
  3921. !docMode || docMode < 8);
  3922. },
  3923. "trigger": "history-hash"
  3924. });
  3925. // graphics-vml-default
  3926. add('load', '4', {
  3927. "name": "graphics-vml-default",
  3928. "test": function(Y) {
  3929. var DOCUMENT = Y.config.doc,
  3930. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  3931. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
  3932. },
  3933. "trigger": "graphics"
  3934. });
  3935. // graphics-svg-default
  3936. add('load', '5', {
  3937. "name": "graphics-svg-default",
  3938. "test": function(Y) {
  3939. var DOCUMENT = Y.config.doc;
  3940. return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
  3941. },
  3942. "trigger": "graphics"
  3943. });
  3944. // widget-base-ie
  3945. add('load', '6', {
  3946. "name": "widget-base-ie",
  3947. "trigger": "widget-base",
  3948. "ua": "ie"
  3949. });
  3950. // transition-timer
  3951. add('load', '7', {
  3952. "name": "transition-timer",
  3953. "test": function (Y) {
  3954. var DOCUMENT = Y.config.doc,
  3955. node = (DOCUMENT) ? DOCUMENT.documentElement: null,
  3956. ret = true;
  3957. if (node && node.style) {
  3958. ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style);
  3959. }
  3960. return ret;
  3961. },
  3962. "trigger": "transition"
  3963. });
  3964. // dom-style-ie
  3965. add('load', '8', {
  3966. "name": "dom-style-ie",
  3967. "test": function (Y) {
  3968. var testFeature = Y.Features.test,
  3969. addFeature = Y.Features.add,
  3970. WINDOW = Y.config.win,
  3971. DOCUMENT = Y.config.doc,
  3972. DOCUMENT_ELEMENT = 'documentElement',
  3973. ret = false;
  3974. addFeature('style', 'computedStyle', {
  3975. test: function() {
  3976. return WINDOW && 'getComputedStyle' in WINDOW;
  3977. }
  3978. });
  3979. addFeature('style', 'opacity', {
  3980. test: function() {
  3981. return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
  3982. }
  3983. });
  3984. ret = (!testFeature('style', 'opacity') &&
  3985. !testFeature('style', 'computedStyle'));
  3986. return ret;
  3987. },
  3988. "trigger": "dom-style"
  3989. });
  3990. // selector-css2
  3991. add('load', '9', {
  3992. "name": "selector-css2",
  3993. "test": function (Y) {
  3994. var DOCUMENT = Y.config.doc,
  3995. ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
  3996. return ret;
  3997. },
  3998. "trigger": "selector"
  3999. });
  4000. // event-base-ie
  4001. add('load', '10', {
  4002. "name": "event-base-ie",
  4003. "test": function(Y) {
  4004. var imp = Y.config.doc && Y.config.doc.implementation;
  4005. return (imp && (!imp.hasFeature('Events', '2.0')));
  4006. },
  4007. "trigger": "node-base"
  4008. });
  4009. // dd-gestures
  4010. add('load', '11', {
  4011. "name": "dd-gestures",
  4012. "test": function(Y) {
  4013. var UA = Y.UA;
  4014. return ((UA.mobile || UA.android || UA.ios) && UA.touch);
  4015. },
  4016. "trigger": "dd-drag"
  4017. });
  4018. // scrollview-base-ie
  4019. add('load', '12', {
  4020. "name": "scrollview-base-ie",
  4021. "trigger": "scrollview-base",
  4022. "ua": "ie"
  4023. });
  4024. // graphics-canvas
  4025. add('load', '13', {
  4026. "name": "graphics-canvas",
  4027. "test": function(Y) {
  4028. var DOCUMENT = Y.config.doc,
  4029. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  4030. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
  4031. },
  4032. "trigger": "graphics"
  4033. });
  4034. // graphics-vml
  4035. add('load', '14', {
  4036. "name": "graphics-vml",
  4037. "test": function(Y) {
  4038. var DOCUMENT = Y.config.doc,
  4039. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  4040. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
  4041. },
  4042. "trigger": "graphics"
  4043. });
  4044. }, '3.4.0' ,{requires:['yui-base']});
  4045. YUI.add('intl-base', function(Y) {
  4046. /**
  4047. * The Intl utility provides a central location for managing sets of
  4048. * localized resources (strings and formatting patterns).
  4049. *
  4050. * @class Intl
  4051. * @uses EventTarget
  4052. * @static
  4053. */
  4054. var SPLIT_REGEX = /[, ]/;
  4055. Y.mix(Y.namespace('Intl'), {
  4056. /**
  4057. * Returns the language among those available that
  4058. * best matches the preferred language list, using the Lookup
  4059. * algorithm of BCP 47.
  4060. * If none of the available languages meets the user's preferences,
  4061. * then "" is returned.
  4062. * Extended language ranges are not supported.
  4063. *
  4064. * @method lookupBestLang
  4065. * @param {String[] | String} preferredLanguages The list of preferred
  4066. * languages in descending preference order, represented as BCP 47
  4067. * language tags. A string array or a comma-separated list.
  4068. * @param {String[]} availableLanguages The list of languages
  4069. * that the application supports, represented as BCP 47 language
  4070. * tags.
  4071. *
  4072. * @return {String} The available language that best matches the
  4073. * preferred language list, or "".
  4074. * @since 3.1.0
  4075. */
  4076. lookupBestLang: function(preferredLanguages, availableLanguages) {
  4077. var i, language, result, index;
  4078. // check whether the list of available languages contains language;
  4079. // if so return it
  4080. function scan(language) {
  4081. var i;
  4082. for (i = 0; i < availableLanguages.length; i += 1) {
  4083. if (language.toLowerCase() ===
  4084. availableLanguages[i].toLowerCase()) {
  4085. return availableLanguages[i];
  4086. }
  4087. }
  4088. }
  4089. if (Y.Lang.isString(preferredLanguages)) {
  4090. preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
  4091. }
  4092. for (i = 0; i < preferredLanguages.length; i += 1) {
  4093. language = preferredLanguages[i];
  4094. if (!language || language === '*') {
  4095. continue;
  4096. }
  4097. // check the fallback sequence for one language
  4098. while (language.length > 0) {
  4099. result = scan(language);
  4100. if (result) {
  4101. return result;
  4102. } else {
  4103. index = language.lastIndexOf('-');
  4104. if (index >= 0) {
  4105. language = language.substring(0, index);
  4106. // one-character subtags get cut along with the
  4107. // following subtag
  4108. if (index >= 2 && language.charAt(index - 2) === '-') {
  4109. language = language.substring(0, index - 2);
  4110. }
  4111. } else {
  4112. // nothing available for this language
  4113. break;
  4114. }
  4115. }
  4116. }
  4117. }
  4118. return '';
  4119. }
  4120. });
  4121. }, '3.4.0' ,{requires:['yui-base']});
  4122. YUI.add('yui-log', function(Y) {
  4123. /**
  4124. * Provides console log capability and exposes a custom event for
  4125. * console implementations. This module is a `core` YUI module, <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
  4126. *
  4127. * @module yui
  4128. * @submodule yui-log
  4129. */
  4130. var INSTANCE = Y,
  4131. LOGEVENT = 'yui:log',
  4132. UNDEFINED = 'undefined',
  4133. LEVELS = { debug: 1,
  4134. info: 1,
  4135. warn: 1,
  4136. error: 1 };
  4137. /**
  4138. * If the 'debug' config is true, a 'yui:log' event will be
  4139. * dispatched, which the Console widget and anything else
  4140. * can consume. If the 'useBrowserConsole' config is true, it will
  4141. * write to the browser console if available. YUI-specific log
  4142. * messages will only be present in the -debug versions of the
  4143. * JS files. The build system is supposed to remove log statements
  4144. * from the raw and minified versions of the files.
  4145. *
  4146. * @method log
  4147. * @for YUI
  4148. * @param {String} msg The message to log.
  4149. * @param {String} cat The log category for the message. Default
  4150. * categories are "info", "warn", "error", time".
  4151. * Custom categories can be used as well. (opt).
  4152. * @param {String} src The source of the the message (opt).
  4153. * @param {boolean} silent If true, the log event won't fire.
  4154. * @return {YUI} YUI instance.
  4155. */
  4156. INSTANCE.log = function(msg, cat, src, silent) {
  4157. var bail, excl, incl, m, f,
  4158. Y = INSTANCE,
  4159. c = Y.config,
  4160. publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
  4161. // suppress log message if the config is off or the event stack
  4162. // or the event call stack contains a consumer of the yui:log event
  4163. if (c.debug) {
  4164. // apply source filters
  4165. if (src) {
  4166. excl = c.logExclude;
  4167. incl = c.logInclude;
  4168. if (incl && !(src in incl)) {
  4169. bail = 1;
  4170. } else if (incl && (src in incl)) {
  4171. bail = !incl[src];
  4172. } else if (excl && (src in excl)) {
  4173. bail = excl[src];
  4174. }
  4175. }
  4176. if (!bail) {
  4177. if (c.useBrowserConsole) {
  4178. m = (src) ? src + ': ' + msg : msg;
  4179. if (Y.Lang.isFunction(c.logFn)) {
  4180. c.logFn.call(Y, msg, cat, src);
  4181. } else if (typeof console != UNDEFINED && console.log) {
  4182. f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
  4183. console[f](m);
  4184. } else if (typeof opera != UNDEFINED) {
  4185. opera.postError(m);
  4186. }
  4187. }
  4188. if (publisher && !silent) {
  4189. if (publisher == Y && (!publisher.getEvent(LOGEVENT))) {
  4190. publisher.publish(LOGEVENT, {
  4191. broadcast: 2
  4192. });
  4193. }
  4194. publisher.fire(LOGEVENT, {
  4195. msg: msg,
  4196. cat: cat,
  4197. src: src
  4198. });
  4199. }
  4200. }
  4201. }
  4202. return Y;
  4203. };
  4204. /**
  4205. * Write a system message. This message will be preserved in the
  4206. * minified and raw versions of the YUI files, unlike log statements.
  4207. * @method message
  4208. * @for YUI
  4209. * @param {String} msg The message to log.
  4210. * @param {String} cat The log category for the message. Default
  4211. * categories are "info", "warn", "error", time".
  4212. * Custom categories can be used as well. (opt).
  4213. * @param {String} src The source of the the message (opt).
  4214. * @param {boolean} silent If true, the log event won't fire.
  4215. * @return {YUI} YUI instance.
  4216. */
  4217. INSTANCE.message = function() {
  4218. return INSTANCE.log.apply(INSTANCE, arguments);
  4219. };
  4220. }, '3.4.0' ,{requires:['yui-base']});
  4221. YUI.add('yui-later', function(Y) {
  4222. /**
  4223. * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>.
  4224. *
  4225. * @module yui
  4226. * @submodule yui-later
  4227. */
  4228. var NO_ARGS = [];
  4229. /**
  4230. * Executes the supplied function in the context of the supplied
  4231. * object 'when' milliseconds later. Executes the function a
  4232. * single time unless periodic is set to true.
  4233. * @for YUI
  4234. * @method later
  4235. * @param when {int} the number of milliseconds to wait until the fn
  4236. * is executed.
  4237. * @param o the context object.
  4238. * @param fn {Function|String} the function to execute or the name of
  4239. * the method in the 'o' object to execute.
  4240. * @param data [Array] data that is provided to the function. This
  4241. * accepts either a single item or an array. If an array is provided,
  4242. * the function is executed with one parameter for each array item.
  4243. * If you need to pass a single array parameter, it needs to be wrapped
  4244. * in an array [myarray].
  4245. *
  4246. * Note: native methods in IE may not have the call and apply methods.
  4247. * In this case, it will work, but you are limited to four arguments.
  4248. *
  4249. * @param periodic {boolean} if true, executes continuously at supplied
  4250. * interval until canceled.
  4251. * @return {object} a timer object. Call the cancel() method on this
  4252. * object to stop the timer.
  4253. */
  4254. Y.later = function(when, o, fn, data, periodic) {
  4255. when = when || 0;
  4256. data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS;
  4257. o = o || Y.config.win || Y;
  4258. var cancelled = false,
  4259. method = (o && Y.Lang.isString(fn)) ? o[fn] : fn,
  4260. wrapper = function() {
  4261. // IE 8- may execute a setInterval callback one last time
  4262. // after clearInterval was called, so in order to preserve
  4263. // the cancel() === no more runny-run, we have to jump through
  4264. // an extra hoop.
  4265. if (!cancelled) {
  4266. if (!method.apply) {
  4267. method(data[0], data[1], data[2], data[3]);
  4268. } else {
  4269. method.apply(o, data || NO_ARGS);
  4270. }
  4271. }
  4272. },
  4273. id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when);
  4274. return {
  4275. id: id,
  4276. interval: periodic,
  4277. cancel: function() {
  4278. cancelled = true;
  4279. if (this.interval) {
  4280. clearInterval(id);
  4281. } else {
  4282. clearTimeout(id);
  4283. }
  4284. }
  4285. };
  4286. };
  4287. Y.Lang.later = Y.later;
  4288. }, '3.4.0' ,{requires:['yui-base']});
  4289. YUI.add('loader-base', function(Y) {
  4290. /**
  4291. * The YUI loader core
  4292. * @module loader
  4293. * @submodule loader-base
  4294. */
  4295. if (!YUI.Env[Y.version]) {
  4296. (function() {
  4297. var VERSION = Y.version,
  4298. BUILD = '/build/',
  4299. ROOT = VERSION + BUILD,
  4300. CDN_BASE = Y.Env.base,
  4301. GALLERY_VERSION = 'gallery-2011.09.14-20-40',
  4302. TNT = '2in3',
  4303. TNT_VERSION = '4',
  4304. YUI2_VERSION = '2.9.0',
  4305. COMBO_BASE = CDN_BASE + 'combo?',
  4306. META = { version: VERSION,
  4307. root: ROOT,
  4308. base: Y.Env.base,
  4309. comboBase: COMBO_BASE,
  4310. skin: { defaultSkin: 'sam',
  4311. base: 'assets/skins/',
  4312. path: 'skin.css',
  4313. after: ['cssreset',
  4314. 'cssfonts',
  4315. 'cssgrids',
  4316. 'cssbase',
  4317. 'cssreset-context',
  4318. 'cssfonts-context']},
  4319. groups: {},
  4320. patterns: {} },
  4321. groups = META.groups,
  4322. yui2Update = function(tnt, yui2) {
  4323. var root = TNT + '.' +
  4324. (tnt || TNT_VERSION) + '/' +
  4325. (yui2 || YUI2_VERSION) + BUILD;
  4326. groups.yui2.base = CDN_BASE + root;
  4327. groups.yui2.root = root;
  4328. },
  4329. galleryUpdate = function(tag) {
  4330. var root = (tag || GALLERY_VERSION) + BUILD;
  4331. groups.gallery.base = CDN_BASE + root;
  4332. groups.gallery.root = root;
  4333. };
  4334. groups[VERSION] = {};
  4335. groups.gallery = {
  4336. ext: false,
  4337. combine: true,
  4338. comboBase: COMBO_BASE,
  4339. update: galleryUpdate,
  4340. patterns: { 'gallery-': { },
  4341. 'lang/gallery-': {},
  4342. 'gallerycss-': { type: 'css' } }
  4343. };
  4344. groups.yui2 = {
  4345. combine: true,
  4346. ext: false,
  4347. comboBase: COMBO_BASE,
  4348. update: yui2Update,
  4349. patterns: {
  4350. 'yui2-': {
  4351. configFn: function(me) {
  4352. if (/-skin|reset|fonts|grids|base/.test(me.name)) {
  4353. me.type = 'css';
  4354. me.path = me.path.replace(/\.js/, '.css');
  4355. // this makes skins in builds earlier than
  4356. // 2.6.0 work as long as combine is false
  4357. me.path = me.path.replace(/\/yui2-skin/,
  4358. '/assets/skins/sam/yui2-skin');
  4359. }
  4360. }
  4361. }
  4362. }
  4363. };
  4364. galleryUpdate();
  4365. yui2Update();
  4366. YUI.Env[VERSION] = META;
  4367. }());
  4368. }
  4369. /**
  4370. * Loader dynamically loads script and css files. It includes the dependency
  4371. * info for the version of the library in use, and will automatically pull in
  4372. * dependencies for the modules requested. It supports rollup files and will
  4373. * automatically use these when appropriate in order to minimize the number of
  4374. * http connections required to load all of the dependencies. It can load the
  4375. * files from the Yahoo! CDN, and it can utilize the combo service provided on
  4376. * this network to reduce the number of http connections required To Download
  4377. * YUI files.
  4378. *
  4379. * @module loader
  4380. * @main loader
  4381. * @submodule loader-base
  4382. */
  4383. var NOT_FOUND = {},
  4384. NO_REQUIREMENTS = [],
  4385. MAX_URL_LENGTH = 2048,
  4386. GLOBAL_ENV = YUI.Env,
  4387. GLOBAL_LOADED = GLOBAL_ENV._loaded,
  4388. CSS = 'css',
  4389. JS = 'js',
  4390. INTL = 'intl',
  4391. VERSION = Y.version,
  4392. ROOT_LANG = '',
  4393. YObject = Y.Object,
  4394. oeach = YObject.each,
  4395. YArray = Y.Array,
  4396. _queue = GLOBAL_ENV._loaderQueue,
  4397. META = GLOBAL_ENV[VERSION],
  4398. SKIN_PREFIX = 'skin-',
  4399. L = Y.Lang,
  4400. ON_PAGE = GLOBAL_ENV.mods,
  4401. modulekey,
  4402. cache,
  4403. _path = function(dir, file, type, nomin) {
  4404. var path = dir + '/' + file;
  4405. if (!nomin) {
  4406. path += '-min';
  4407. }
  4408. path += '.' + (type || CSS);
  4409. return path;
  4410. };
  4411. if (YUI.Env.aliases) {
  4412. YUI.Env.aliases = {}; //Don't need aliases if Loader is present
  4413. }
  4414. /**
  4415. * The component metadata is stored in Y.Env.meta.
  4416. * Part of the loader module.
  4417. * @property meta
  4418. * @for YUI
  4419. */
  4420. Y.Env.meta = META;
  4421. /**
  4422. * Loader dynamically loads script and css files. It includes the dependency
  4423. * info for the version of the library in use, and will automatically pull in
  4424. * dependencies for the modules requested. It supports rollup files and will
  4425. * automatically use these when appropriate in order to minimize the number of
  4426. * http connections required to load all of the dependencies. It can load the
  4427. * files from the Yahoo! CDN, and it can utilize the combo service provided on
  4428. * this network to reduce the number of http connections required To Download
  4429. * YUI files.
  4430. *
  4431. * While the loader can be instantiated by the end user, it normally is not.
  4432. * @see YUI.use for the normal use case. The use function automatically will
  4433. * pull in missing dependencies.
  4434. *
  4435. * @constructor
  4436. * @class Loader
  4437. * @param {object} o an optional set of configuration options. Valid options:
  4438. * <ul>
  4439. * <li>base:
  4440. * The base dir</li>
  4441. * <li>comboBase:
  4442. * The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
  4443. * <li>root:
  4444. * The root path to prepend to module names for the combo service.
  4445. * Ex: 2.5.2/build/</li>
  4446. * <li>filter:.
  4447. *
  4448. * A filter to apply to result urls. This filter will modify the default
  4449. * path for all modules. The default path for the YUI library is the
  4450. * minified version of the files (e.g., event-min.js). The filter property
  4451. * can be a predefined filter or a custom filter. The valid predefined
  4452. * filters are:
  4453. * <dl>
  4454. * <dt>DEBUG</dt>
  4455. * <dd>Selects the debug versions of the library (e.g., event-debug.js).
  4456. * This option will automatically include the Logger widget</dd>
  4457. * <dt>RAW</dt>
  4458. * <dd>Selects the non-minified version of the library (e.g., event.js).
  4459. * </dd>
  4460. * </dl>
  4461. * You can also define a custom filter, which must be an object literal
  4462. * containing a search expression and a replace string:
  4463. * <pre>
  4464. * myFilter: &#123;
  4465. * 'searchExp': "-min\\.js",
  4466. * 'replaceStr': "-debug.js"
  4467. * &#125;
  4468. * </pre>
  4469. *
  4470. * </li>
  4471. * <li>filters: per-component filter specification. If specified
  4472. * for a given component, this overrides the filter config. _Note:_ This does not work on combo urls, use the filter property instead.</li>
  4473. * <li>combine:
  4474. * Use the YUI combo service to reduce the number of http connections
  4475. * required to load your dependencies</li>
  4476. * <li>ignore:
  4477. * A list of modules that should never be dynamically loaded</li>
  4478. * <li>force:
  4479. * A list of modules that should always be loaded when required, even if
  4480. * already present on the page</li>
  4481. * <li>insertBefore:
  4482. * Node or id for a node that should be used as the insertion point for
  4483. * new nodes</li>
  4484. * <li>charset:
  4485. * charset for dynamic nodes (deprecated, use jsAttributes or cssAttributes)
  4486. * </li>
  4487. * <li>jsAttributes: object literal containing attributes to add to script
  4488. * nodes</li>
  4489. * <li>cssAttributes: object literal containing attributes to add to link
  4490. * nodes</li>
  4491. * <li>timeout:
  4492. * The number of milliseconds before a timeout occurs when dynamically
  4493. * loading nodes. If not set, there is no timeout</li>
  4494. * <li>context:
  4495. * execution context for all callbacks</li>
  4496. * <li>onSuccess:
  4497. * callback for the 'success' event</li>
  4498. * <li>onFailure: callback for the 'failure' event</li>
  4499. * <li>onCSS: callback for the 'CSSComplete' event. When loading YUI
  4500. * components with CSS the CSS is loaded first, then the script. This
  4501. * provides a moment you can tie into to improve
  4502. * the presentation of the page while the script is loading.</li>
  4503. * <li>onTimeout:
  4504. * callback for the 'timeout' event</li>
  4505. * <li>onProgress:
  4506. * callback executed each time a script or css file is loaded</li>
  4507. * <li>modules:
  4508. * A list of module definitions. See Loader.addModule for the supported
  4509. * module metadata</li>
  4510. * <li>groups:
  4511. * A list of group definitions. Each group can contain specific definitions
  4512. * for base, comboBase, combine, and accepts a list of modules. See above
  4513. * for the description of these properties.</li>
  4514. * <li>2in3: the version of the YUI 2 in 3 wrapper to use. The intrinsic
  4515. * support for YUI 2 modules in YUI 3 relies on versions of the YUI 2
  4516. * components inside YUI 3 module wrappers. These wrappers
  4517. * change over time to accomodate the issues that arise from running YUI 2
  4518. * in a YUI 3 sandbox.</li>
  4519. * <li>yui2: when using the 2in3 project, you can select the version of
  4520. * YUI 2 to use. Valid values * are 2.2.2, 2.3.1, 2.4.1, 2.5.2, 2.6.0,
  4521. * 2.7.0, 2.8.0, and 2.8.1 [default] -- plus all versions of YUI 2
  4522. * going forward.</li>
  4523. * </ul>
  4524. */
  4525. Y.Loader = function(o) {
  4526. var defaults = META.modules,
  4527. self = this;
  4528. modulekey = META.md5;
  4529. /**
  4530. * Internal callback to handle multiple internal insert() calls
  4531. * so that css is inserted prior to js
  4532. * @property _internalCallback
  4533. * @private
  4534. */
  4535. // self._internalCallback = null;
  4536. /**
  4537. * Callback that will be executed when the loader is finished
  4538. * with an insert
  4539. * @method onSuccess
  4540. * @type function
  4541. */
  4542. // self.onSuccess = null;
  4543. /**
  4544. * Callback that will be executed if there is a failure
  4545. * @method onFailure
  4546. * @type function
  4547. */
  4548. // self.onFailure = null;
  4549. /**
  4550. * Callback for the 'CSSComplete' event. When loading YUI components
  4551. * with CSS the CSS is loaded first, then the script. This provides
  4552. * a moment you can tie into to improve the presentation of the page
  4553. * while the script is loading.
  4554. * @method onCSS
  4555. * @type function
  4556. */
  4557. // self.onCSS = null;
  4558. /**
  4559. * Callback executed each time a script or css file is loaded
  4560. * @method onProgress
  4561. * @type function
  4562. */
  4563. // self.onProgress = null;
  4564. /**
  4565. * Callback that will be executed if a timeout occurs
  4566. * @method onTimeout
  4567. * @type function
  4568. */
  4569. // self.onTimeout = null;
  4570. /**
  4571. * The execution context for all callbacks
  4572. * @property context
  4573. * @default {YUI} the YUI instance
  4574. */
  4575. self.context = Y;
  4576. /**
  4577. * Data that is passed to all callbacks
  4578. * @property data
  4579. */
  4580. // self.data = null;
  4581. /**
  4582. * Node reference or id where new nodes should be inserted before
  4583. * @property insertBefore
  4584. * @type string|HTMLElement
  4585. */
  4586. // self.insertBefore = null;
  4587. /**
  4588. * The charset attribute for inserted nodes
  4589. * @property charset
  4590. * @type string
  4591. * @deprecated , use cssAttributes or jsAttributes.
  4592. */
  4593. // self.charset = null;
  4594. /**
  4595. * An object literal containing attributes to add to link nodes
  4596. * @property cssAttributes
  4597. * @type object
  4598. */
  4599. // self.cssAttributes = null;
  4600. /**
  4601. * An object literal containing attributes to add to script nodes
  4602. * @property jsAttributes
  4603. * @type object
  4604. */
  4605. // self.jsAttributes = null;
  4606. /**
  4607. * The base directory.
  4608. * @property base
  4609. * @type string
  4610. * @default http://yui.yahooapis.com/[YUI VERSION]/build/
  4611. */
  4612. self.base = Y.Env.meta.base + Y.Env.meta.root;
  4613. /**
  4614. * Base path for the combo service
  4615. * @property comboBase
  4616. * @type string
  4617. * @default http://yui.yahooapis.com/combo?
  4618. */
  4619. self.comboBase = Y.Env.meta.comboBase;
  4620. /*
  4621. * Base path for language packs.
  4622. */
  4623. // self.langBase = Y.Env.meta.langBase;
  4624. // self.lang = "";
  4625. /**
  4626. * If configured, the loader will attempt to use the combo
  4627. * service for YUI resources and configured external resources.
  4628. * @property combine
  4629. * @type boolean
  4630. * @default true if a base dir isn't in the config
  4631. */
  4632. self.combine = o.base &&
  4633. (o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
  4634. /**
  4635. * The default seperator to use between files in a combo URL
  4636. * @property comboSep
  4637. * @type {String}
  4638. * @default Ampersand
  4639. */
  4640. self.comboSep = '&';
  4641. /**
  4642. * Max url length for combo urls. The default is 2048. This is the URL
  4643. * limit for the Yahoo! hosted combo servers. If consuming
  4644. * a different combo service that has a different URL limit
  4645. * it is possible to override this default by supplying
  4646. * the maxURLLength config option. The config option will
  4647. * only take effect if lower than the default.
  4648. *
  4649. * @property maxURLLength
  4650. * @type int
  4651. */
  4652. self.maxURLLength = MAX_URL_LENGTH;
  4653. /**
  4654. * Ignore modules registered on the YUI global
  4655. * @property ignoreRegistered
  4656. * @default false
  4657. */
  4658. // self.ignoreRegistered = false;
  4659. /**
  4660. * Root path to prepend to module path for the combo
  4661. * service
  4662. * @property root
  4663. * @type string
  4664. * @default [YUI VERSION]/build/
  4665. */
  4666. self.root = Y.Env.meta.root;
  4667. /**
  4668. * Timeout value in milliseconds. If set, self value will be used by
  4669. * the get utility. the timeout event will fire if
  4670. * a timeout occurs.
  4671. * @property timeout
  4672. * @type int
  4673. */
  4674. self.timeout = 0;
  4675. /**
  4676. * A list of modules that should not be loaded, even if
  4677. * they turn up in the dependency tree
  4678. * @property ignore
  4679. * @type string[]
  4680. */
  4681. // self.ignore = null;
  4682. /**
  4683. * A list of modules that should always be loaded, even
  4684. * if they have already been inserted into the page.
  4685. * @property force
  4686. * @type string[]
  4687. */
  4688. // self.force = null;
  4689. self.forceMap = {};
  4690. /**
  4691. * Should we allow rollups
  4692. * @property allowRollup
  4693. * @type boolean
  4694. * @default false
  4695. */
  4696. self.allowRollup = false;
  4697. /**
  4698. * A filter to apply to result urls. This filter will modify the default
  4699. * path for all modules. The default path for the YUI library is the
  4700. * minified version of the files (e.g., event-min.js). The filter property
  4701. * can be a predefined filter or a custom filter. The valid predefined
  4702. * filters are:
  4703. * <dl>
  4704. * <dt>DEBUG</dt>
  4705. * <dd>Selects the debug versions of the library (e.g., event-debug.js).
  4706. * This option will automatically include the Logger widget</dd>
  4707. * <dt>RAW</dt>
  4708. * <dd>Selects the non-minified version of the library (e.g., event.js).
  4709. * </dd>
  4710. * </dl>
  4711. * You can also define a custom filter, which must be an object literal
  4712. * containing a search expression and a replace string:
  4713. * <pre>
  4714. * myFilter: &#123;
  4715. * 'searchExp': "-min\\.js",
  4716. * 'replaceStr': "-debug.js"
  4717. * &#125;
  4718. * </pre>
  4719. * @property filter
  4720. * @type string| {searchExp: string, replaceStr: string}
  4721. */
  4722. // self.filter = null;
  4723. /**
  4724. * per-component filter specification. If specified for a given
  4725. * component, this overrides the filter config.
  4726. * @property filters
  4727. * @type object
  4728. */
  4729. self.filters = {};
  4730. /**
  4731. * The list of requested modules
  4732. * @property required
  4733. * @type {string: boolean}
  4734. */
  4735. self.required = {};
  4736. /**
  4737. * If a module name is predefined when requested, it is checked againsts
  4738. * the patterns provided in this property. If there is a match, the
  4739. * module is added with the default configuration.
  4740. *
  4741. * At the moment only supporting module prefixes, but anticipate
  4742. * supporting at least regular expressions.
  4743. * @property patterns
  4744. * @type Object
  4745. */
  4746. // self.patterns = Y.merge(Y.Env.meta.patterns);
  4747. self.patterns = {};
  4748. /**
  4749. * The library metadata
  4750. * @property moduleInfo
  4751. */
  4752. // self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
  4753. self.moduleInfo = {};
  4754. self.groups = Y.merge(Y.Env.meta.groups);
  4755. /**
  4756. * Provides the information used to skin the skinnable components.
  4757. * The following skin definition would result in 'skin1' and 'skin2'
  4758. * being loaded for calendar (if calendar was requested), and
  4759. * 'sam' for all other skinnable components:
  4760. *
  4761. * <code>
  4762. * skin: {
  4763. *
  4764. * // The default skin, which is automatically applied if not
  4765. * // overriden by a component-specific skin definition.
  4766. * // Change this in to apply a different skin globally
  4767. * defaultSkin: 'sam',
  4768. *
  4769. * // This is combined with the loader base property to get
  4770. * // the default root directory for a skin. ex:
  4771. * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
  4772. * base: 'assets/skins/',
  4773. *
  4774. * // Any component-specific overrides can be specified here,
  4775. * // making it possible to load different skins for different
  4776. * // components. It is possible to load more than one skin
  4777. * // for a given component as well.
  4778. * overrides: {
  4779. * calendar: ['skin1', 'skin2']
  4780. * }
  4781. * }
  4782. * </code>
  4783. * @property skin
  4784. */
  4785. self.skin = Y.merge(Y.Env.meta.skin);
  4786. /*
  4787. * Map of conditional modules
  4788. * @since 3.2.0
  4789. */
  4790. self.conditions = {};
  4791. // map of modules with a hash of modules that meet the requirement
  4792. // self.provides = {};
  4793. self.config = o;
  4794. self._internal = true;
  4795. cache = GLOBAL_ENV._renderedMods;
  4796. if (cache) {
  4797. oeach(cache, function modCache(v, k) {
  4798. //self.moduleInfo[k] = Y.merge(v);
  4799. self.moduleInfo[k] = v;
  4800. });
  4801. cache = GLOBAL_ENV._conditions;
  4802. oeach(cache, function condCache(v, k) {
  4803. //self.conditions[k] = Y.merge(v);
  4804. self.conditions[k] = v;
  4805. });
  4806. } else {
  4807. oeach(defaults, self.addModule, self);
  4808. }
  4809. if (!GLOBAL_ENV._renderedMods) {
  4810. //GLOBAL_ENV._renderedMods = Y.merge(self.moduleInfo);
  4811. //GLOBAL_ENV._conditions = Y.merge(self.conditions);
  4812. GLOBAL_ENV._renderedMods = self.moduleInfo;
  4813. GLOBAL_ENV._conditions = self.conditions;
  4814. }
  4815. self._inspectPage();
  4816. self._internal = false;
  4817. self._config(o);
  4818. self.testresults = null;
  4819. if (Y.config.tests) {
  4820. self.testresults = Y.config.tests;
  4821. }
  4822. /**
  4823. * List of rollup files found in the library metadata
  4824. * @property rollups
  4825. */
  4826. // self.rollups = null;
  4827. /**
  4828. * Whether or not to load optional dependencies for
  4829. * the requested modules
  4830. * @property loadOptional
  4831. * @type boolean
  4832. * @default false
  4833. */
  4834. // self.loadOptional = false;
  4835. /**
  4836. * All of the derived dependencies in sorted order, which
  4837. * will be populated when either calculate() or insert()
  4838. * is called
  4839. * @property sorted
  4840. * @type string[]
  4841. */
  4842. self.sorted = [];
  4843. /**
  4844. * Set when beginning to compute the dependency tree.
  4845. * Composed of what YUI reports to be loaded combined
  4846. * with what has been loaded by any instance on the page
  4847. * with the version number specified in the metadata.
  4848. * @property loaded
  4849. * @type {string: boolean}
  4850. */
  4851. self.loaded = GLOBAL_LOADED[VERSION];
  4852. /*
  4853. * A list of modules to attach to the YUI instance when complete.
  4854. * If not supplied, the sorted list of dependencies are applied.
  4855. * @property attaching
  4856. */
  4857. // self.attaching = null;
  4858. /**
  4859. * Flag to indicate the dependency tree needs to be recomputed
  4860. * if insert is called again.
  4861. * @property dirty
  4862. * @type boolean
  4863. * @default true
  4864. */
  4865. self.dirty = true;
  4866. /**
  4867. * List of modules inserted by the utility
  4868. * @property inserted
  4869. * @type {string: boolean}
  4870. */
  4871. self.inserted = {};
  4872. /**
  4873. * List of skipped modules during insert() because the module
  4874. * was not defined
  4875. * @property skipped
  4876. */
  4877. self.skipped = {};
  4878. // Y.on('yui:load', self.loadNext, self);
  4879. self.tested = {};
  4880. /*
  4881. * Cached sorted calculate results
  4882. * @property results
  4883. * @since 3.2.0
  4884. */
  4885. //self.results = {};
  4886. };
  4887. Y.Loader.prototype = {
  4888. FILTER_DEFS: {
  4889. RAW: {
  4890. 'searchExp': '-min\\.js',
  4891. 'replaceStr': '.js'
  4892. },
  4893. DEBUG: {
  4894. 'searchExp': '-min\\.js',
  4895. 'replaceStr': '-debug.js'
  4896. }
  4897. },
  4898. /*
  4899. * Check the pages meta-data and cache the result.
  4900. * @method _inspectPage
  4901. * @private
  4902. */
  4903. _inspectPage: function() {
  4904. oeach(ON_PAGE, function(v, k) {
  4905. if (v.details) {
  4906. var m = this.moduleInfo[k],
  4907. req = v.details.requires,
  4908. mr = m && m.requires;
  4909. if (m) {
  4910. if (!m._inspected && req && mr.length != req.length) {
  4911. // console.log('deleting ' + m.name);
  4912. // m.requres = YObject.keys(Y.merge(YArray.hash(req), YArray.hash(mr)));
  4913. delete m.expanded;
  4914. // delete m.expanded_map;
  4915. }
  4916. } else {
  4917. m = this.addModule(v.details, k);
  4918. }
  4919. m._inspected = true;
  4920. }
  4921. }, this);
  4922. },
  4923. /*
  4924. * returns true if b is not loaded, and is required directly or by means of modules it supersedes.
  4925. * @private
  4926. * @method _requires
  4927. * @param {String} mod1 The first module to compare
  4928. * @param {String} mod2 The second module to compare
  4929. */
  4930. _requires: function(mod1, mod2) {
  4931. var i, rm, after_map, s,
  4932. info = this.moduleInfo,
  4933. m = info[mod1],
  4934. other = info[mod2];
  4935. if (!m || !other) {
  4936. return false;
  4937. }
  4938. rm = m.expanded_map;
  4939. after_map = m.after_map;
  4940. // check if this module should be sorted after the other
  4941. // do this first to short circut circular deps
  4942. if (after_map && (mod2 in after_map)) {
  4943. return true;
  4944. }
  4945. after_map = other.after_map;
  4946. // and vis-versa
  4947. if (after_map && (mod1 in after_map)) {
  4948. return false;
  4949. }
  4950. // check if this module requires one the other supersedes
  4951. s = info[mod2] && info[mod2].supersedes;
  4952. if (s) {
  4953. for (i = 0; i < s.length; i++) {
  4954. if (this._requires(mod1, s[i])) {
  4955. return true;
  4956. }
  4957. }
  4958. }
  4959. s = info[mod1] && info[mod1].supersedes;
  4960. if (s) {
  4961. for (i = 0; i < s.length; i++) {
  4962. if (this._requires(mod2, s[i])) {
  4963. return false;
  4964. }
  4965. }
  4966. }
  4967. // check if this module requires the other directly
  4968. // if (r && YArray.indexOf(r, mod2) > -1) {
  4969. if (rm && (mod2 in rm)) {
  4970. return true;
  4971. }
  4972. // external css files should be sorted below yui css
  4973. if (m.ext && m.type == CSS && !other.ext && other.type == CSS) {
  4974. return true;
  4975. }
  4976. return false;
  4977. },
  4978. /**
  4979. * Apply a new config to the Loader instance
  4980. * @method _config
  4981. * @param {Object} o The new configuration
  4982. */
  4983. _config: function(o) {
  4984. var i, j, val, f, group, groupName, self = this;
  4985. // apply config values
  4986. if (o) {
  4987. for (i in o) {
  4988. if (o.hasOwnProperty(i)) {
  4989. val = o[i];
  4990. if (i == 'require') {
  4991. self.require(val);
  4992. } else if (i == 'skin') {
  4993. Y.mix(self.skin, o[i], true);
  4994. } else if (i == 'groups') {
  4995. for (j in val) {
  4996. if (val.hasOwnProperty(j)) {
  4997. groupName = j;
  4998. group = val[j];
  4999. self.addGroup(group, groupName);
  5000. }
  5001. }
  5002. } else if (i == 'modules') {
  5003. // add a hash of module definitions
  5004. oeach(val, self.addModule, self);
  5005. } else if (i == 'gallery') {
  5006. this.groups.gallery.update(val);
  5007. } else if (i == 'yui2' || i == '2in3') {
  5008. this.groups.yui2.update(o['2in3'], o.yui2);
  5009. } else if (i == 'maxURLLength') {
  5010. self[i] = Math.min(MAX_URL_LENGTH, val);
  5011. } else {
  5012. self[i] = val;
  5013. }
  5014. }
  5015. }
  5016. }
  5017. // fix filter
  5018. f = self.filter;
  5019. if (L.isString(f)) {
  5020. f = f.toUpperCase();
  5021. self.filterName = f;
  5022. self.filter = self.FILTER_DEFS[f];
  5023. if (f == 'DEBUG') {
  5024. self.require('yui-log', 'dump');
  5025. }
  5026. }
  5027. if (self.lang) {
  5028. self.require('intl-base', 'intl');
  5029. }
  5030. },
  5031. /**
  5032. * Returns the skin module name for the specified skin name. If a
  5033. * module name is supplied, the returned skin module name is
  5034. * specific to the module passed in.
  5035. * @method formatSkin
  5036. * @param {string} skin the name of the skin.
  5037. * @param {string} mod optional: the name of a module to skin.
  5038. * @return {string} the full skin module name.
  5039. */
  5040. formatSkin: function(skin, mod) {
  5041. var s = SKIN_PREFIX + skin;
  5042. if (mod) {
  5043. s = s + '-' + mod;
  5044. }
  5045. return s;
  5046. },
  5047. /**
  5048. * Adds the skin def to the module info
  5049. * @method _addSkin
  5050. * @param {string} skin the name of the skin.
  5051. * @param {string} mod the name of the module.
  5052. * @param {string} parent parent module if this is a skin of a
  5053. * submodule or plugin.
  5054. * @return {string} the module name for the skin.
  5055. * @private
  5056. */
  5057. _addSkin: function(skin, mod, parent) {
  5058. var mdef, pkg, name, nmod,
  5059. info = this.moduleInfo,
  5060. sinf = this.skin,
  5061. ext = info[mod] && info[mod].ext;
  5062. // Add a module definition for the module-specific skin css
  5063. if (mod) {
  5064. name = this.formatSkin(skin, mod);
  5065. if (!info[name]) {
  5066. mdef = info[mod];
  5067. pkg = mdef.pkg || mod;
  5068. nmod = {
  5069. name: name,
  5070. group: mdef.group,
  5071. type: 'css',
  5072. after: sinf.after,
  5073. path: (parent || pkg) + '/' + sinf.base + skin +
  5074. '/' + mod + '.css',
  5075. ext: ext
  5076. };
  5077. if (mdef.base) {
  5078. nmod.base = mdef.base;
  5079. }
  5080. if (mdef.configFn) {
  5081. nmod.configFn = mdef.configFn;
  5082. }
  5083. this.addModule(nmod, name);
  5084. }
  5085. }
  5086. return name;
  5087. },
  5088. /**
  5089. * Add a new module group
  5090. * <dl>
  5091. * <dt>name:</dt> <dd>required, the group name</dd>
  5092. * <dt>base:</dt> <dd>The base dir for this module group</dd>
  5093. * <dt>root:</dt> <dd>The root path to add to each combo
  5094. * resource path</dd>
  5095. * <dt>combine:</dt> <dd>combo handle</dd>
  5096. * <dt>comboBase:</dt> <dd>combo service base path</dd>
  5097. * <dt>modules:</dt> <dd>the group of modules</dd>
  5098. * </dl>
  5099. * @method addGroup
  5100. * @param {object} o An object containing the module data.
  5101. * @param {string} name the group name.
  5102. */
  5103. addGroup: function(o, name) {
  5104. var mods = o.modules,
  5105. self = this;
  5106. name = name || o.name;
  5107. o.name = name;
  5108. self.groups[name] = o;
  5109. if (o.patterns) {
  5110. oeach(o.patterns, function(v, k) {
  5111. v.group = name;
  5112. self.patterns[k] = v;
  5113. });
  5114. }
  5115. if (mods) {
  5116. oeach(mods, function(v, k) {
  5117. v.group = name;
  5118. self.addModule(v, k);
  5119. }, self);
  5120. }
  5121. },
  5122. /**
  5123. * Add a new module to the component metadata.
  5124. * <dl>
  5125. * <dt>name:</dt> <dd>required, the component name</dd>
  5126. * <dt>type:</dt> <dd>required, the component type (js or css)
  5127. * </dd>
  5128. * <dt>path:</dt> <dd>required, the path to the script from
  5129. * "base"</dd>
  5130. * <dt>requires:</dt> <dd>array of modules required by this
  5131. * component</dd>
  5132. * <dt>optional:</dt> <dd>array of optional modules for this
  5133. * component</dd>
  5134. * <dt>supersedes:</dt> <dd>array of the modules this component
  5135. * replaces</dd>
  5136. * <dt>after:</dt> <dd>array of modules the components which, if
  5137. * present, should be sorted above this one</dd>
  5138. * <dt>after_map:</dt> <dd>faster alternative to 'after' -- supply
  5139. * a hash instead of an array</dd>
  5140. * <dt>rollup:</dt> <dd>the number of superseded modules required
  5141. * for automatic rollup</dd>
  5142. * <dt>fullpath:</dt> <dd>If fullpath is specified, this is used
  5143. * instead of the configured base + path</dd>
  5144. * <dt>skinnable:</dt> <dd>flag to determine if skin assets should
  5145. * automatically be pulled in</dd>
  5146. * <dt>submodules:</dt> <dd>a hash of submodules</dd>
  5147. * <dt>group:</dt> <dd>The group the module belongs to -- this
  5148. * is set automatically when it is added as part of a group
  5149. * configuration.</dd>
  5150. * <dt>lang:</dt>
  5151. * <dd>array of BCP 47 language tags of languages for which this
  5152. * module has localized resource bundles,
  5153. * e.g., ["en-GB","zh-Hans-CN"]</dd>
  5154. * <dt>condition:</dt>
  5155. * <dd>Specifies that the module should be loaded automatically if
  5156. * a condition is met. This is an object with up to three fields:
  5157. * [trigger] - the name of a module that can trigger the auto-load
  5158. * [test] - a function that returns true when the module is to be
  5159. * loaded.
  5160. * [when] - specifies the load order of the conditional module
  5161. * with regard to the position of the trigger module.
  5162. * This should be one of three values: 'before', 'after', or
  5163. * 'instead'. The default is 'after'.
  5164. * </dd>
  5165. * <dt>testresults:</dt><dd>a hash of test results from Y.Features.all()</dd>
  5166. * </dl>
  5167. * @method addModule
  5168. * @param {object} o An object containing the module data.
  5169. * @param {string} name the module name (optional), required if not
  5170. * in the module data.
  5171. * @return {object} the module definition or null if
  5172. * the object passed in did not provide all required attributes.
  5173. */
  5174. addModule: function(o, name) {
  5175. name = name || o.name;
  5176. //Only merge this data if the temp flag is set
  5177. //from an earlier pass from a pattern or else
  5178. //an override module (YUI_config) can not be used to
  5179. //replace a default module.
  5180. if (this.moduleInfo[name] && this.moduleInfo[name].temp) {
  5181. //This catches temp modules loaded via a pattern
  5182. // The module will be added twice, once from the pattern and
  5183. // Once from the actual add call, this ensures that properties
  5184. // that were added to the module the first time around (group: gallery)
  5185. // are also added the second time around too.
  5186. o = Y.merge(this.moduleInfo[name], o);
  5187. }
  5188. o.name = name;
  5189. if (!o || !o.name) {
  5190. return null;
  5191. }
  5192. if (!o.type) {
  5193. o.type = JS;
  5194. }
  5195. if (!o.path && !o.fullpath) {
  5196. o.path = _path(name, name, o.type);
  5197. }
  5198. o.supersedes = o.supersedes || o.use;
  5199. o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
  5200. o.requires = this.filterRequires(o.requires) || [];
  5201. // Handle submodule logic
  5202. var subs = o.submodules, i, l, t, sup, s, smod, plugins, plug,
  5203. j, langs, packName, supName, flatSup, flatLang, lang, ret,
  5204. overrides, skinname, when,
  5205. conditions = this.conditions, trigger;
  5206. // , existing = this.moduleInfo[name], newr;
  5207. this.moduleInfo[name] = o;
  5208. if (!o.langPack && o.lang) {
  5209. langs = YArray(o.lang);
  5210. for (j = 0; j < langs.length; j++) {
  5211. lang = langs[j];
  5212. packName = this.getLangPackName(lang, name);
  5213. smod = this.moduleInfo[packName];
  5214. if (!smod) {
  5215. smod = this._addLangPack(lang, o, packName);
  5216. }
  5217. }
  5218. }
  5219. if (subs) {
  5220. sup = o.supersedes || [];
  5221. l = 0;
  5222. for (i in subs) {
  5223. if (subs.hasOwnProperty(i)) {
  5224. s = subs[i];
  5225. s.path = s.path || _path(name, i, o.type);
  5226. s.pkg = name;
  5227. s.group = o.group;
  5228. if (s.supersedes) {
  5229. sup = sup.concat(s.supersedes);
  5230. }
  5231. smod = this.addModule(s, i);
  5232. sup.push(i);
  5233. if (smod.skinnable) {
  5234. o.skinnable = true;
  5235. overrides = this.skin.overrides;
  5236. if (overrides && overrides[i]) {
  5237. for (j = 0; j < overrides[i].length; j++) {
  5238. skinname = this._addSkin(overrides[i][j],
  5239. i, name);
  5240. sup.push(skinname);
  5241. }
  5242. }
  5243. skinname = this._addSkin(this.skin.defaultSkin,
  5244. i, name);
  5245. sup.push(skinname);
  5246. }
  5247. // looks like we are expected to work out the metadata
  5248. // for the parent module language packs from what is
  5249. // specified in the child modules.
  5250. if (s.lang && s.lang.length) {
  5251. langs = YArray(s.lang);
  5252. for (j = 0; j < langs.length; j++) {
  5253. lang = langs[j];
  5254. packName = this.getLangPackName(lang, name);
  5255. supName = this.getLangPackName(lang, i);
  5256. smod = this.moduleInfo[packName];
  5257. if (!smod) {
  5258. smod = this._addLangPack(lang, o, packName);
  5259. }
  5260. flatSup = flatSup || YArray.hash(smod.supersedes);
  5261. if (!(supName in flatSup)) {
  5262. smod.supersedes.push(supName);
  5263. }
  5264. o.lang = o.lang || [];
  5265. flatLang = flatLang || YArray.hash(o.lang);
  5266. if (!(lang in flatLang)) {
  5267. o.lang.push(lang);
  5268. }
  5269. // Add rollup file, need to add to supersedes list too
  5270. // default packages
  5271. packName = this.getLangPackName(ROOT_LANG, name);
  5272. supName = this.getLangPackName(ROOT_LANG, i);
  5273. smod = this.moduleInfo[packName];
  5274. if (!smod) {
  5275. smod = this._addLangPack(lang, o, packName);
  5276. }
  5277. if (!(supName in flatSup)) {
  5278. smod.supersedes.push(supName);
  5279. }
  5280. // Add rollup file, need to add to supersedes list too
  5281. }
  5282. }
  5283. l++;
  5284. }
  5285. }
  5286. //o.supersedes = YObject.keys(YArray.hash(sup));
  5287. o.supersedes = YArray.dedupe(sup);
  5288. if (this.allowRollup) {
  5289. o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
  5290. }
  5291. }
  5292. plugins = o.plugins;
  5293. if (plugins) {
  5294. for (i in plugins) {
  5295. if (plugins.hasOwnProperty(i)) {
  5296. plug = plugins[i];
  5297. plug.pkg = name;
  5298. plug.path = plug.path || _path(name, i, o.type);
  5299. plug.requires = plug.requires || [];
  5300. plug.group = o.group;
  5301. this.addModule(plug, i);
  5302. if (o.skinnable) {
  5303. this._addSkin(this.skin.defaultSkin, i, name);
  5304. }
  5305. }
  5306. }
  5307. }
  5308. if (o.condition) {
  5309. t = o.condition.trigger;
  5310. if (YUI.Env.aliases[t]) {
  5311. t = YUI.Env.aliases[t];
  5312. }
  5313. if (!Y.Lang.isArray(t)) {
  5314. t = [t];
  5315. }
  5316. for (i = 0; i < t.length; i++) {
  5317. trigger = t[i];
  5318. when = o.condition.when;
  5319. conditions[trigger] = conditions[trigger] || {};
  5320. conditions[trigger][name] = o.condition;
  5321. // the 'when' attribute can be 'before', 'after', or 'instead'
  5322. // the default is after.
  5323. if (when && when != 'after') {
  5324. if (when == 'instead') { // replace the trigger
  5325. o.supersedes = o.supersedes || [];
  5326. o.supersedes.push(trigger);
  5327. } else { // before the trigger
  5328. // the trigger requires the conditional mod,
  5329. // so it should appear before the conditional
  5330. // mod if we do not intersede.
  5331. }
  5332. } else { // after the trigger
  5333. o.after = o.after || [];
  5334. o.after.push(trigger);
  5335. }
  5336. }
  5337. }
  5338. if (o.after) {
  5339. o.after_map = YArray.hash(o.after);
  5340. }
  5341. // this.dirty = true;
  5342. if (o.configFn) {
  5343. ret = o.configFn(o);
  5344. if (ret === false) {
  5345. delete this.moduleInfo[name];
  5346. o = null;
  5347. }
  5348. }
  5349. return o;
  5350. },
  5351. /**
  5352. * Add a requirement for one or more module
  5353. * @method require
  5354. * @param {string[] | string*} what the modules to load.
  5355. */
  5356. require: function(what) {
  5357. var a = (typeof what === 'string') ? YArray(arguments) : what;
  5358. this.dirty = true;
  5359. this.required = Y.merge(this.required, YArray.hash(this.filterRequires(a)));
  5360. this._explodeRollups();
  5361. },
  5362. /**
  5363. * Grab all the items that were asked for, check to see if the Loader
  5364. * meta-data contains a "use" array. If it doesm remove the asked item and replace it with
  5365. * the content of the "use".
  5366. * This will make asking for: "dd"
  5367. * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
  5368. * @private
  5369. * @method _explodeRollups
  5370. */
  5371. _explodeRollups: function() {
  5372. var self = this, m,
  5373. r = self.required;
  5374. if (!self.allowRollup) {
  5375. oeach(r, function(v, name) {
  5376. m = self.getModule(name);
  5377. if (m && m.use) {
  5378. //delete r[name];
  5379. YArray.each(m.use, function(v) {
  5380. m = self.getModule(v);
  5381. if (m && m.use) {
  5382. //delete r[v];
  5383. YArray.each(m.use, function(v) {
  5384. r[v] = true;
  5385. });
  5386. } else {
  5387. r[v] = true;
  5388. }
  5389. });
  5390. }
  5391. });
  5392. self.required = r;
  5393. }
  5394. },
  5395. /**
  5396. * Explodes the required array to remove aliases and replace them with real modules
  5397. * @method filterRequires
  5398. * @param {Array} r The original requires array
  5399. * @return {Array} The new array of exploded requirements
  5400. */
  5401. filterRequires: function(r) {
  5402. if (r) {
  5403. if (!Y.Lang.isArray(r)) {
  5404. r = [r];
  5405. }
  5406. r = Y.Array(r);
  5407. var c = [], i, mod, o, m;
  5408. for (i = 0; i < r.length; i++) {
  5409. mod = this.getModule(r[i]);
  5410. if (mod && mod.use) {
  5411. for (o = 0; o < mod.use.length; o++) {
  5412. //Must walk the other modules in case a module is a rollup of rollups (datatype)
  5413. m = this.getModule(mod.use[o]);
  5414. if (m && m.use) {
  5415. c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
  5416. } else {
  5417. c.push(mod.use[o]);
  5418. }
  5419. }
  5420. } else {
  5421. c.push(r[i]);
  5422. }
  5423. }
  5424. r = c;
  5425. }
  5426. return r;
  5427. },
  5428. /**
  5429. * Returns an object containing properties for all modules required
  5430. * in order to load the requested module
  5431. * @method getRequires
  5432. * @param {object} mod The module definition from moduleInfo.
  5433. * @return {array} the expanded requirement list.
  5434. */
  5435. getRequires: function(mod) {
  5436. if (!mod || mod._parsed) {
  5437. return NO_REQUIREMENTS;
  5438. }
  5439. var i, m, j, add, packName, lang, testresults = this.testresults,
  5440. name = mod.name, cond, go,
  5441. adddef = ON_PAGE[name] && ON_PAGE[name].details,
  5442. d, k, m1,
  5443. r, old_mod,
  5444. o, skinmod, skindef, skinpar, skinname,
  5445. intl = mod.lang || mod.intl,
  5446. info = this.moduleInfo,
  5447. ftests = Y.Features && Y.Features.tests.load,
  5448. hash;
  5449. // console.log(name);
  5450. // pattern match leaves module stub that needs to be filled out
  5451. if (mod.temp && adddef) {
  5452. old_mod = mod;
  5453. mod = this.addModule(adddef, name);
  5454. mod.group = old_mod.group;
  5455. mod.pkg = old_mod.pkg;
  5456. delete mod.expanded;
  5457. }
  5458. // console.log('cache: ' + mod.langCache + ' == ' + this.lang);
  5459. // if (mod.expanded && (!mod.langCache || mod.langCache == this.lang)) {
  5460. if (mod.expanded && (!this.lang || mod.langCache === this.lang)) {
  5461. return mod.expanded;
  5462. }
  5463. d = [];
  5464. hash = {};
  5465. r = this.filterRequires(mod.requires);
  5466. if (mod.lang) {
  5467. //If a module has a lang attribute, auto add the intl requirement.
  5468. d.unshift('intl');
  5469. r.unshift('intl');
  5470. intl = true;
  5471. }
  5472. o = this.filterRequires(mod.optional);
  5473. mod._parsed = true;
  5474. mod.langCache = this.lang;
  5475. for (i = 0; i < r.length; i++) {
  5476. if (!hash[r[i]]) {
  5477. d.push(r[i]);
  5478. hash[r[i]] = true;
  5479. m = this.getModule(r[i]);
  5480. if (m) {
  5481. add = this.getRequires(m);
  5482. intl = intl || (m.expanded_map &&
  5483. (INTL in m.expanded_map));
  5484. for (j = 0; j < add.length; j++) {
  5485. d.push(add[j]);
  5486. }
  5487. }
  5488. }
  5489. }
  5490. // get the requirements from superseded modules, if any
  5491. r = this.filterRequires(mod.supersedes);
  5492. if (r) {
  5493. for (i = 0; i < r.length; i++) {
  5494. if (!hash[r[i]]) {
  5495. // if this module has submodules, the requirements list is
  5496. // expanded to include the submodules. This is so we can
  5497. // prevent dups when a submodule is already loaded and the
  5498. // parent is requested.
  5499. if (mod.submodules) {
  5500. d.push(r[i]);
  5501. }
  5502. hash[r[i]] = true;
  5503. m = this.getModule(r[i]);
  5504. if (m) {
  5505. add = this.getRequires(m);
  5506. intl = intl || (m.expanded_map &&
  5507. (INTL in m.expanded_map));
  5508. for (j = 0; j < add.length; j++) {
  5509. d.push(add[j]);
  5510. }
  5511. }
  5512. }
  5513. }
  5514. }
  5515. if (o && this.loadOptional) {
  5516. for (i = 0; i < o.length; i++) {
  5517. if (!hash[o[i]]) {
  5518. d.push(o[i]);
  5519. hash[o[i]] = true;
  5520. m = info[o[i]];
  5521. if (m) {
  5522. add = this.getRequires(m);
  5523. intl = intl || (m.expanded_map &&
  5524. (INTL in m.expanded_map));
  5525. for (j = 0; j < add.length; j++) {
  5526. d.push(add[j]);
  5527. }
  5528. }
  5529. }
  5530. }
  5531. }
  5532. cond = this.conditions[name];
  5533. if (cond) {
  5534. if (testresults && ftests) {
  5535. oeach(testresults, function(result, id) {
  5536. var condmod = ftests[id].name;
  5537. if (!hash[condmod] && ftests[id].trigger == name) {
  5538. if (result && ftests[id]) {
  5539. hash[condmod] = true;
  5540. d.push(condmod);
  5541. }
  5542. }
  5543. });
  5544. } else {
  5545. oeach(cond, function(def, condmod) {
  5546. if (!hash[condmod]) {
  5547. go = def && ((def.ua && Y.UA[def.ua]) ||
  5548. (def.test && def.test(Y, r)));
  5549. if (go) {
  5550. hash[condmod] = true;
  5551. d.push(condmod);
  5552. m = this.getModule(condmod);
  5553. if (m) {
  5554. add = this.getRequires(m);
  5555. for (j = 0; j < add.length; j++) {
  5556. d.push(add[j]);
  5557. }
  5558. }
  5559. }
  5560. }
  5561. }, this);
  5562. }
  5563. }
  5564. // Create skin modules
  5565. if (mod.skinnable) {
  5566. skindef = this.skin.overrides;
  5567. oeach(YUI.Env.aliases, function(o, n) {
  5568. if (Y.Array.indexOf(o, name) > -1) {
  5569. skinpar = n;
  5570. }
  5571. });
  5572. if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
  5573. skinname = name;
  5574. if (skindef[skinpar]) {
  5575. skinname = skinpar;
  5576. }
  5577. for (i = 0; i < skindef[skinname].length; i++) {
  5578. skinmod = this._addSkin(skindef[skinname][i], name);
  5579. d.push(skinmod);
  5580. }
  5581. } else {
  5582. skinmod = this._addSkin(this.skin.defaultSkin, name);
  5583. d.push(skinmod);
  5584. }
  5585. }
  5586. mod._parsed = false;
  5587. if (intl) {
  5588. if (mod.lang && !mod.langPack && Y.Intl) {
  5589. lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
  5590. packName = this.getLangPackName(lang, name);
  5591. if (packName) {
  5592. d.unshift(packName);
  5593. }
  5594. }
  5595. d.unshift(INTL);
  5596. }
  5597. mod.expanded_map = YArray.hash(d);
  5598. mod.expanded = YObject.keys(mod.expanded_map);
  5599. return mod.expanded;
  5600. },
  5601. /**
  5602. * Returns a hash of module names the supplied module satisfies.
  5603. * @method getProvides
  5604. * @param {string} name The name of the module.
  5605. * @return {object} what this module provides.
  5606. */
  5607. getProvides: function(name) {
  5608. var m = this.getModule(name), o, s;
  5609. // supmap = this.provides;
  5610. if (!m) {
  5611. return NOT_FOUND;
  5612. }
  5613. if (m && !m.provides) {
  5614. o = {};
  5615. s = m.supersedes;
  5616. if (s) {
  5617. YArray.each(s, function(v) {
  5618. Y.mix(o, this.getProvides(v));
  5619. }, this);
  5620. }
  5621. o[name] = true;
  5622. m.provides = o;
  5623. }
  5624. return m.provides;
  5625. },
  5626. /**
  5627. * Calculates the dependency tree, the result is stored in the sorted
  5628. * property.
  5629. * @method calculate
  5630. * @param {object} o optional options object.
  5631. * @param {string} type optional argument to prune modules.
  5632. */
  5633. calculate: function(o, type) {
  5634. if (o || type || this.dirty) {
  5635. if (o) {
  5636. this._config(o);
  5637. }
  5638. if (!this._init) {
  5639. this._setup();
  5640. }
  5641. this._explode();
  5642. if (this.allowRollup) {
  5643. this._rollup();
  5644. } else {
  5645. this._explodeRollups();
  5646. }
  5647. this._reduce();
  5648. this._sort();
  5649. }
  5650. },
  5651. /**
  5652. * Creates a "psuedo" package for languages provided in the lang array
  5653. * @method _addLangPack
  5654. * @param {String} lang The language to create
  5655. * @param {Object} m The module definition to create the language pack around
  5656. * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
  5657. * @return {Object} The module definition
  5658. */
  5659. _addLangPack: function(lang, m, packName) {
  5660. var name = m.name,
  5661. packPath,
  5662. existing = this.moduleInfo[packName];
  5663. if (!existing) {
  5664. packPath = _path((m.pkg || name), packName, JS, true);
  5665. this.addModule({ path: packPath,
  5666. intl: true,
  5667. langPack: true,
  5668. ext: m.ext,
  5669. group: m.group,
  5670. supersedes: [] }, packName);
  5671. if (lang) {
  5672. Y.Env.lang = Y.Env.lang || {};
  5673. Y.Env.lang[lang] = Y.Env.lang[lang] || {};
  5674. Y.Env.lang[lang][name] = true;
  5675. }
  5676. }
  5677. return this.moduleInfo[packName];
  5678. },
  5679. /**
  5680. * Investigates the current YUI configuration on the page. By default,
  5681. * modules already detected will not be loaded again unless a force
  5682. * option is encountered. Called by calculate()
  5683. * @method _setup
  5684. * @private
  5685. */
  5686. _setup: function() {
  5687. var info = this.moduleInfo, name, i, j, m, l,
  5688. packName;
  5689. for (name in info) {
  5690. if (info.hasOwnProperty(name)) {
  5691. m = info[name];
  5692. if (m) {
  5693. // remove dups
  5694. //m.requires = YObject.keys(YArray.hash(m.requires));
  5695. m.requires = YArray.dedupe(m.requires);
  5696. // Create lang pack modules
  5697. if (m.lang && m.lang.length) {
  5698. // Setup root package if the module has lang defined,
  5699. // it needs to provide a root language pack
  5700. packName = this.getLangPackName(ROOT_LANG, name);
  5701. this._addLangPack(null, m, packName);
  5702. }
  5703. }
  5704. }
  5705. }
  5706. //l = Y.merge(this.inserted);
  5707. l = {};
  5708. // available modules
  5709. if (!this.ignoreRegistered) {
  5710. Y.mix(l, GLOBAL_ENV.mods);
  5711. }
  5712. // add the ignore list to the list of loaded packages
  5713. if (this.ignore) {
  5714. Y.mix(l, YArray.hash(this.ignore));
  5715. }
  5716. // expand the list to include superseded modules
  5717. for (j in l) {
  5718. if (l.hasOwnProperty(j)) {
  5719. Y.mix(l, this.getProvides(j));
  5720. }
  5721. }
  5722. // remove modules on the force list from the loaded list
  5723. if (this.force) {
  5724. for (i = 0; i < this.force.length; i++) {
  5725. if (this.force[i] in l) {
  5726. delete l[this.force[i]];
  5727. }
  5728. }
  5729. }
  5730. Y.mix(this.loaded, l);
  5731. this._init = true;
  5732. },
  5733. /**
  5734. * Builds a module name for a language pack
  5735. * @method getLangPackName
  5736. * @param {string} lang the language code.
  5737. * @param {string} mname the module to build it for.
  5738. * @return {string} the language pack module name.
  5739. */
  5740. getLangPackName: function(lang, mname) {
  5741. return ('lang/' + mname + ((lang) ? '_' + lang : ''));
  5742. },
  5743. /**
  5744. * Inspects the required modules list looking for additional
  5745. * dependencies. Expands the required list to include all
  5746. * required modules. Called by calculate()
  5747. * @method _explode
  5748. * @private
  5749. */
  5750. _explode: function() {
  5751. var r = this.required, m, reqs, done = {},
  5752. self = this;
  5753. // the setup phase is over, all modules have been created
  5754. self.dirty = false;
  5755. self._explodeRollups();
  5756. r = self.required;
  5757. oeach(r, function(v, name) {
  5758. if (!done[name]) {
  5759. done[name] = true;
  5760. m = self.getModule(name);
  5761. if (m) {
  5762. var expound = m.expound;
  5763. if (expound) {
  5764. r[expound] = self.getModule(expound);
  5765. reqs = self.getRequires(r[expound]);
  5766. Y.mix(r, YArray.hash(reqs));
  5767. }
  5768. reqs = self.getRequires(m);
  5769. Y.mix(r, YArray.hash(reqs));
  5770. }
  5771. }
  5772. });
  5773. },
  5774. /**
  5775. * Get's the loader meta data for the requested module
  5776. * @method getModule
  5777. * @param {String} mname The module name to get
  5778. * @return {Object} The module metadata
  5779. */
  5780. getModule: function(mname) {
  5781. //TODO: Remove name check - it's a quick hack to fix pattern WIP
  5782. if (!mname) {
  5783. return null;
  5784. }
  5785. var p, found, pname,
  5786. m = this.moduleInfo[mname],
  5787. patterns = this.patterns;
  5788. // check the patterns library to see if we should automatically add
  5789. // the module with defaults
  5790. if (!m) {
  5791. for (pname in patterns) {
  5792. if (patterns.hasOwnProperty(pname)) {
  5793. p = patterns[pname];
  5794. // use the metadata supplied for the pattern
  5795. // as the module definition.
  5796. if (mname.indexOf(pname) > -1) {
  5797. found = p;
  5798. break;
  5799. }
  5800. }
  5801. }
  5802. if (found) {
  5803. if (p.action) {
  5804. p.action.call(this, mname, pname);
  5805. } else {
  5806. // ext true or false?
  5807. m = this.addModule(Y.merge(found), mname);
  5808. m.temp = true;
  5809. }
  5810. }
  5811. }
  5812. return m;
  5813. },
  5814. // impl in rollup submodule
  5815. _rollup: function() { },
  5816. /**
  5817. * Remove superceded modules and loaded modules. Called by
  5818. * calculate() after we have the mega list of all dependencies
  5819. * @method _reduce
  5820. * @return {object} the reduced dependency hash.
  5821. * @private
  5822. */
  5823. _reduce: function(r) {
  5824. r = r || this.required;
  5825. var i, j, s, m, type = this.loadType,
  5826. ignore = this.ignore ? YArray.hash(this.ignore) : false;
  5827. for (i in r) {
  5828. if (r.hasOwnProperty(i)) {
  5829. m = this.getModule(i);
  5830. // remove if already loaded
  5831. if (((this.loaded[i] || ON_PAGE[i]) &&
  5832. !this.forceMap[i] && !this.ignoreRegistered) ||
  5833. (type && m && m.type != type)) {
  5834. delete r[i];
  5835. }
  5836. if (ignore && ignore[i]) {
  5837. delete r[i];
  5838. }
  5839. // remove anything this module supersedes
  5840. s = m && m.supersedes;
  5841. if (s) {
  5842. for (j = 0; j < s.length; j++) {
  5843. if (s[j] in r) {
  5844. delete r[s[j]];
  5845. }
  5846. }
  5847. }
  5848. }
  5849. }
  5850. return r;
  5851. },
  5852. /**
  5853. * Handles the queue when a module has been loaded for all cases
  5854. * @method _finish
  5855. * @private
  5856. * @param {String} msg The message from Loader
  5857. * @param {Boolean} success A boolean denoting success or failure
  5858. */
  5859. _finish: function(msg, success) {
  5860. _queue.running = false;
  5861. var onEnd = this.onEnd;
  5862. if (onEnd) {
  5863. onEnd.call(this.context, {
  5864. msg: msg,
  5865. data: this.data,
  5866. success: success
  5867. });
  5868. }
  5869. this._continue();
  5870. },
  5871. /**
  5872. * The default Loader onSuccess handler, calls this.onSuccess with a payload
  5873. * @method _onSuccess
  5874. * @private
  5875. */
  5876. _onSuccess: function() {
  5877. var self = this, skipped = Y.merge(self.skipped), fn,
  5878. failed = [], rreg = self.requireRegistration,
  5879. success, msg;
  5880. oeach(skipped, function(k) {
  5881. delete self.inserted[k];
  5882. });
  5883. self.skipped = {};
  5884. oeach(self.inserted, function(v, k) {
  5885. var mod = self.getModule(k);
  5886. if (mod && rreg && mod.type == JS && !(k in YUI.Env.mods)) {
  5887. failed.push(k);
  5888. } else {
  5889. Y.mix(self.loaded, self.getProvides(k));
  5890. }
  5891. });
  5892. fn = self.onSuccess;
  5893. msg = (failed.length) ? 'notregistered' : 'success';
  5894. success = !(failed.length);
  5895. if (fn) {
  5896. fn.call(self.context, {
  5897. msg: msg,
  5898. data: self.data,
  5899. success: success,
  5900. failed: failed,
  5901. skipped: skipped
  5902. });
  5903. }
  5904. self._finish(msg, success);
  5905. },
  5906. /**
  5907. * The default Loader onFailure handler, calls this.onFailure with a payload
  5908. * @method _onFailure
  5909. * @private
  5910. */
  5911. _onFailure: function(o) {
  5912. var f = this.onFailure, msg = 'failure: ' + o.msg;
  5913. if (f) {
  5914. f.call(this.context, {
  5915. msg: msg,
  5916. data: this.data,
  5917. success: false
  5918. });
  5919. }
  5920. this._finish(msg, false);
  5921. },
  5922. /**
  5923. * The default Loader onTimeout handler, calls this.onTimeout with a payload
  5924. * @method _onTimeout
  5925. * @private
  5926. */
  5927. _onTimeout: function() {
  5928. var f = this.onTimeout;
  5929. if (f) {
  5930. f.call(this.context, {
  5931. msg: 'timeout',
  5932. data: this.data,
  5933. success: false
  5934. });
  5935. }
  5936. this._finish('timeout', false);
  5937. },
  5938. /**
  5939. * Sorts the dependency tree. The last step of calculate()
  5940. * @method _sort
  5941. * @private
  5942. */
  5943. _sort: function() {
  5944. // create an indexed list
  5945. var s = YObject.keys(this.required),
  5946. // loaded = this.loaded,
  5947. done = {},
  5948. p = 0, l, a, b, j, k, moved, doneKey;
  5949. // keep going until we make a pass without moving anything
  5950. for (;;) {
  5951. l = s.length;
  5952. moved = false;
  5953. // start the loop after items that are already sorted
  5954. for (j = p; j < l; j++) {
  5955. // check the next module on the list to see if its
  5956. // dependencies have been met
  5957. a = s[j];
  5958. // check everything below current item and move if we
  5959. // find a requirement for the current item
  5960. for (k = j + 1; k < l; k++) {
  5961. doneKey = a + s[k];
  5962. if (!done[doneKey] && this._requires(a, s[k])) {
  5963. // extract the dependency so we can move it up
  5964. b = s.splice(k, 1);
  5965. // insert the dependency above the item that
  5966. // requires it
  5967. s.splice(j, 0, b[0]);
  5968. // only swap two dependencies once to short circut
  5969. // circular dependencies
  5970. done[doneKey] = true;
  5971. // keep working
  5972. moved = true;
  5973. break;
  5974. }
  5975. }
  5976. // jump out of loop if we moved something
  5977. if (moved) {
  5978. break;
  5979. // this item is sorted, move our pointer and keep going
  5980. } else {
  5981. p++;
  5982. }
  5983. }
  5984. // when we make it here and moved is false, we are
  5985. // finished sorting
  5986. if (!moved) {
  5987. break;
  5988. }
  5989. }
  5990. this.sorted = s;
  5991. },
  5992. /**
  5993. * (Unimplemented)
  5994. * @method partial
  5995. * @unimplemented
  5996. */
  5997. partial: function(partial, o, type) {
  5998. this.sorted = partial;
  5999. this.insert(o, type, true);
  6000. },
  6001. /**
  6002. * Handles the actual insertion of script/link tags
  6003. * @method _insert
  6004. * @param {Object} source The YUI instance the request came from
  6005. * @param {Object} o The metadata to include
  6006. * @param {String} type JS or CSS
  6007. * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
  6008. */
  6009. _insert: function(source, o, type, skipcalc) {
  6010. // restore the state at the time of the request
  6011. if (source) {
  6012. this._config(source);
  6013. }
  6014. // build the dependency list
  6015. // don't include type so we can process CSS and script in
  6016. // one pass when the type is not specified.
  6017. if (!skipcalc) {
  6018. this.calculate(o);
  6019. }
  6020. this.loadType = type;
  6021. if (!type) {
  6022. var self = this;
  6023. this._internalCallback = function() {
  6024. var f = self.onCSS, n, p, sib;
  6025. // IE hack for style overrides that are not being applied
  6026. if (this.insertBefore && Y.UA.ie) {
  6027. n = Y.config.doc.getElementById(this.insertBefore);
  6028. p = n.parentNode;
  6029. sib = n.nextSibling;
  6030. p.removeChild(n);
  6031. if (sib) {
  6032. p.insertBefore(n, sib);
  6033. } else {
  6034. p.appendChild(n);
  6035. }
  6036. }
  6037. if (f) {
  6038. f.call(self.context, Y);
  6039. }
  6040. self._internalCallback = null;
  6041. self._insert(null, null, JS);
  6042. };
  6043. this._insert(null, null, CSS);
  6044. return;
  6045. }
  6046. // set a flag to indicate the load has started
  6047. this._loading = true;
  6048. // flag to indicate we are done with the combo service
  6049. // and any additional files will need to be loaded
  6050. // individually
  6051. this._combineComplete = {};
  6052. // start the load
  6053. this.loadNext();
  6054. },
  6055. /**
  6056. * Once a loader operation is completely finished, process any additional queued items.
  6057. * @method _continue
  6058. * @private
  6059. */
  6060. _continue: function() {
  6061. if (!(_queue.running) && _queue.size() > 0) {
  6062. _queue.running = true;
  6063. _queue.next()();
  6064. }
  6065. },
  6066. /**
  6067. * inserts the requested modules and their dependencies.
  6068. * <code>type</code> can be "js" or "css". Both script and
  6069. * css are inserted if type is not provided.
  6070. * @method insert
  6071. * @param {object} o optional options object.
  6072. * @param {string} type the type of dependency to insert.
  6073. */
  6074. insert: function(o, type, skipsort) {
  6075. var self = this, copy = Y.merge(this);
  6076. delete copy.require;
  6077. delete copy.dirty;
  6078. _queue.add(function() {
  6079. self._insert(copy, o, type, skipsort);
  6080. });
  6081. this._continue();
  6082. },
  6083. /**
  6084. * Executed every time a module is loaded, and if we are in a load
  6085. * cycle, we attempt to load the next script. Public so that it
  6086. * is possible to call this if using a method other than
  6087. * Y.register to determine when scripts are fully loaded
  6088. * @method loadNext
  6089. * @param {string} mname optional the name of the module that has
  6090. * been loaded (which is usually why it is time to load the next
  6091. * one).
  6092. */
  6093. loadNext: function(mname) {
  6094. // It is possible that this function is executed due to something
  6095. // else on the page loading a YUI module. Only react when we
  6096. // are actively loading something
  6097. if (!this._loading) {
  6098. return;
  6099. }
  6100. var s, len, i, m, url, fn, msg, attr, group, groupName, j, frag,
  6101. comboSource, comboSources, mods, combining, urls, comboBase,
  6102. self = this,
  6103. type = self.loadType,
  6104. handleSuccess = function(o) {
  6105. self.loadNext(o.data);
  6106. },
  6107. handleCombo = function(o) {
  6108. self._combineComplete[type] = true;
  6109. var i, len = combining.length;
  6110. for (i = 0; i < len; i++) {
  6111. self.inserted[combining[i]] = true;
  6112. }
  6113. handleSuccess(o);
  6114. };
  6115. if (self.combine && (!self._combineComplete[type])) {
  6116. combining = [];
  6117. self._combining = combining;
  6118. s = self.sorted;
  6119. len = s.length;
  6120. // the default combo base
  6121. comboBase = self.comboBase;
  6122. url = comboBase;
  6123. urls = [];
  6124. comboSources = {};
  6125. for (i = 0; i < len; i++) {
  6126. comboSource = comboBase;
  6127. m = self.getModule(s[i]);
  6128. groupName = m && m.group;
  6129. if (groupName) {
  6130. group = self.groups[groupName];
  6131. if (!group.combine) {
  6132. m.combine = false;
  6133. continue;
  6134. }
  6135. m.combine = true;
  6136. if (group.comboBase) {
  6137. comboSource = group.comboBase;
  6138. }
  6139. if ("root" in group && L.isValue(group.root)) {
  6140. m.root = group.root;
  6141. }
  6142. }
  6143. comboSources[comboSource] = comboSources[comboSource] || [];
  6144. comboSources[comboSource].push(m);
  6145. }
  6146. for (j in comboSources) {
  6147. if (comboSources.hasOwnProperty(j)) {
  6148. url = j;
  6149. mods = comboSources[j];
  6150. len = mods.length;
  6151. for (i = 0; i < len; i++) {
  6152. // m = self.getModule(s[i]);
  6153. m = mods[i];
  6154. // Do not try to combine non-yui JS unless combo def
  6155. // is found
  6156. if (m && (m.type === type) && (m.combine || !m.ext)) {
  6157. frag = ((L.isValue(m.root)) ? m.root : self.root) + m.path;
  6158. frag = self._filter(frag, m.name);
  6159. if ((url !== j) && (i <= (len - 1)) &&
  6160. ((frag.length + url.length) > self.maxURLLength)) {
  6161. //Hack until this is rewritten to use an array and not string concat:
  6162. if (url.substr(url.length - 1, 1) === self.comboSep) {
  6163. url = url.substr(0, (url.length - 1));
  6164. }
  6165. urls.push(self._filter(url));
  6166. url = j;
  6167. }
  6168. url += frag;
  6169. if (i < (len - 1)) {
  6170. url += self.comboSep;
  6171. }
  6172. combining.push(m.name);
  6173. }
  6174. }
  6175. if (combining.length && (url != j)) {
  6176. //Hack until this is rewritten to use an array and not string concat:
  6177. if (url.substr(url.length - 1, 1) === self.comboSep) {
  6178. url = url.substr(0, (url.length - 1));
  6179. }
  6180. urls.push(self._filter(url));
  6181. }
  6182. }
  6183. }
  6184. if (combining.length) {
  6185. // if (m.type === CSS) {
  6186. if (type === CSS) {
  6187. fn = Y.Get.css;
  6188. attr = self.cssAttributes;
  6189. } else {
  6190. fn = Y.Get.script;
  6191. attr = self.jsAttributes;
  6192. }
  6193. fn(urls, {
  6194. data: self._loading,
  6195. onSuccess: handleCombo,
  6196. onFailure: self._onFailure,
  6197. onTimeout: self._onTimeout,
  6198. insertBefore: self.insertBefore,
  6199. charset: self.charset,
  6200. attributes: attr,
  6201. timeout: self.timeout,
  6202. autopurge: false,
  6203. context: self
  6204. });
  6205. return;
  6206. } else {
  6207. self._combineComplete[type] = true;
  6208. }
  6209. }
  6210. if (mname) {
  6211. // if the module that was just loaded isn't what we were expecting,
  6212. // continue to wait
  6213. if (mname !== self._loading) {
  6214. return;
  6215. }
  6216. // The global handler that is called when each module is loaded
  6217. // will pass that module name to this function. Storing this
  6218. // data to avoid loading the same module multiple times
  6219. // centralize this in the callback
  6220. self.inserted[mname] = true;
  6221. // self.loaded[mname] = true;
  6222. // provided = self.getProvides(mname);
  6223. // Y.mix(self.loaded, provided);
  6224. // Y.mix(self.inserted, provided);
  6225. if (self.onProgress) {
  6226. self.onProgress.call(self.context, {
  6227. name: mname,
  6228. data: self.data
  6229. });
  6230. }
  6231. }
  6232. s = self.sorted;
  6233. len = s.length;
  6234. for (i = 0; i < len; i = i + 1) {
  6235. // this.inserted keeps track of what the loader has loaded.
  6236. // move on if this item is done.
  6237. if (s[i] in self.inserted) {
  6238. continue;
  6239. }
  6240. // Because rollups will cause multiple load notifications
  6241. // from Y, loadNext may be called multiple times for
  6242. // the same module when loading a rollup. We can safely
  6243. // skip the subsequent requests
  6244. if (s[i] === self._loading) {
  6245. return;
  6246. }
  6247. // log("inserting " + s[i]);
  6248. m = self.getModule(s[i]);
  6249. if (!m) {
  6250. if (!self.skipped[s[i]]) {
  6251. msg = 'Undefined module ' + s[i] + ' skipped';
  6252. // self.inserted[s[i]] = true;
  6253. self.skipped[s[i]] = true;
  6254. }
  6255. continue;
  6256. }
  6257. group = (m.group && self.groups[m.group]) || NOT_FOUND;
  6258. // The load type is stored to offer the possibility to load
  6259. // the css separately from the script.
  6260. if (!type || type === m.type) {
  6261. self._loading = s[i];
  6262. if (m.type === CSS) {
  6263. fn = Y.Get.css;
  6264. attr = self.cssAttributes;
  6265. } else {
  6266. fn = Y.Get.script;
  6267. attr = self.jsAttributes;
  6268. }
  6269. url = (m.fullpath) ? self._filter(m.fullpath, s[i]) :
  6270. self._url(m.path, s[i], group.base || m.base);
  6271. fn(url, {
  6272. data: s[i],
  6273. onSuccess: handleSuccess,
  6274. insertBefore: self.insertBefore,
  6275. charset: self.charset,
  6276. attributes: attr,
  6277. onFailure: self._onFailure,
  6278. onTimeout: self._onTimeout,
  6279. timeout: self.timeout,
  6280. autopurge: false,
  6281. context: self
  6282. });
  6283. return;
  6284. }
  6285. }
  6286. // we are finished
  6287. self._loading = null;
  6288. fn = self._internalCallback;
  6289. // internal callback for loading css first
  6290. if (fn) {
  6291. self._internalCallback = null;
  6292. fn.call(self);
  6293. } else {
  6294. self._onSuccess();
  6295. }
  6296. },
  6297. /**
  6298. * Apply filter defined for this instance to a url/path
  6299. * @method _filter
  6300. * @param {string} u the string to filter.
  6301. * @param {string} name the name of the module, if we are processing
  6302. * a single module as opposed to a combined url.
  6303. * @return {string} the filtered string.
  6304. * @private
  6305. */
  6306. _filter: function(u, name) {
  6307. var f = this.filter,
  6308. hasFilter = name && (name in this.filters),
  6309. modFilter = hasFilter && this.filters[name],
  6310. groupName = this.moduleInfo[name] ? this.moduleInfo[name].group:null;
  6311. if (groupName && this.groups[groupName] && this.groups[groupName].filter) {
  6312. modFilter = this.groups[groupName].filter;
  6313. hasFilter = true;
  6314. };
  6315. if (u) {
  6316. if (hasFilter) {
  6317. f = (L.isString(modFilter)) ?
  6318. this.FILTER_DEFS[modFilter.toUpperCase()] || null :
  6319. modFilter;
  6320. }
  6321. if (f) {
  6322. u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
  6323. }
  6324. }
  6325. return u;
  6326. },
  6327. /**
  6328. * Generates the full url for a module
  6329. * @method _url
  6330. * @param {string} path the path fragment.
  6331. * @param {String} name The name of the module
  6332. * @pamra {String} [base=self.base] The base url to use
  6333. * @return {string} the full url.
  6334. * @private
  6335. */
  6336. _url: function(path, name, base) {
  6337. return this._filter((base || this.base || '') + path, name);
  6338. },
  6339. /**
  6340. * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
  6341. * @method resolve
  6342. * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
  6343. * @param {Array} [s=loader.sorted] An override for the loader.sorted array
  6344. * @return {Object} Object hash (js and css) of two arrays of file lists
  6345. * @example This method can be used as an off-line dep calculator
  6346. *
  6347. * var Y = YUI();
  6348. * var loader = new Y.Loader({
  6349. * filter: 'debug',
  6350. * base: '../../',
  6351. * root: 'build/',
  6352. * combine: true,
  6353. * require: ['node', 'dd', 'console']
  6354. * });
  6355. * var out = loader.resolve(true);
  6356. *
  6357. */
  6358. resolve: function(calc, s) {
  6359. var self = this, i, m, url, out = { js: [], css: [] };
  6360. if (calc) {
  6361. self.calculate();
  6362. }
  6363. s = s || self.sorted;
  6364. for (i = 0; i < s.length; i++) {
  6365. m = self.getModule(s[i]);
  6366. if (m) {
  6367. if (self.combine) {
  6368. url = self._filter((self.root + m.path), m.name, self.root);
  6369. } else {
  6370. url = self._filter(m.fullpath, m.name, '') || self._url(m.path, m.name);
  6371. }
  6372. out[m.type].push(url);
  6373. }
  6374. }
  6375. if (self.combine) {
  6376. out.js = [self.comboBase + out.js.join(self.comboSep)];
  6377. out.css = [self.comboBase + out.css.join(self.comboSep)];
  6378. }
  6379. return out;
  6380. },
  6381. /**
  6382. * Returns an Object hash of hashes built from `loader.sorted` or from an arbitrary list of sorted modules.
  6383. * @method hash
  6384. * @private
  6385. * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
  6386. * @param {Array} [s=loader.sorted] An override for the loader.sorted array
  6387. * @return {Object} Object hash (js and css) of two object hashes of file lists, with the module name as the key
  6388. * @example This method can be used as an off-line dep calculator
  6389. *
  6390. * var Y = YUI();
  6391. * var loader = new Y.Loader({
  6392. * filter: 'debug',
  6393. * base: '../../',
  6394. * root: 'build/',
  6395. * combine: true,
  6396. * require: ['node', 'dd', 'console']
  6397. * });
  6398. * var out = loader.hash(true);
  6399. *
  6400. */
  6401. hash: function(calc, s) {
  6402. var self = this, i, m, url, out = { js: {}, css: {} };
  6403. if (calc) {
  6404. self.calculate();
  6405. }
  6406. s = s || self.sorted;
  6407. for (i = 0; i < s.length; i++) {
  6408. m = self.getModule(s[i]);
  6409. if (m) {
  6410. url = self._filter(m.fullpath, m.name, '') || self._url(m.path, m.name);
  6411. out[m.type][m.name] = url;
  6412. }
  6413. }
  6414. return out;
  6415. }
  6416. };
  6417. }, '3.4.0' ,{requires:['get']});
  6418. YUI.add('loader-rollup', function(Y) {
  6419. /**
  6420. * Optional automatic rollup logic for reducing http connections
  6421. * when not using a combo service.
  6422. * @module loader
  6423. * @submodule rollup
  6424. */
  6425. /**
  6426. * Look for rollup packages to determine if all of the modules a
  6427. * rollup supersedes are required. If so, include the rollup to
  6428. * help reduce the total number of connections required. Called
  6429. * by calculate(). This is an optional feature, and requires the
  6430. * appropriate submodule to function.
  6431. * @method _rollup
  6432. * @for Loader
  6433. * @private
  6434. */
  6435. Y.Loader.prototype._rollup = function() {
  6436. var i, j, m, s, r = this.required, roll,
  6437. info = this.moduleInfo, rolled, c, smod;
  6438. // find and cache rollup modules
  6439. if (this.dirty || !this.rollups) {
  6440. this.rollups = {};
  6441. for (i in info) {
  6442. if (info.hasOwnProperty(i)) {
  6443. m = this.getModule(i);
  6444. // if (m && m.rollup && m.supersedes) {
  6445. if (m && m.rollup) {
  6446. this.rollups[i] = m;
  6447. }
  6448. }
  6449. }
  6450. this.forceMap = (this.force) ? Y.Array.hash(this.force) : {};
  6451. }
  6452. // make as many passes as needed to pick up rollup rollups
  6453. for (;;) {
  6454. rolled = false;
  6455. // go through the rollup candidates
  6456. for (i in this.rollups) {
  6457. if (this.rollups.hasOwnProperty(i)) {
  6458. // there can be only one, unless forced
  6459. if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
  6460. m = this.getModule(i);
  6461. s = m.supersedes || [];
  6462. roll = false;
  6463. // @TODO remove continue
  6464. if (!m.rollup) {
  6465. continue;
  6466. }
  6467. c = 0;
  6468. // check the threshold
  6469. for (j = 0; j < s.length; j++) {
  6470. smod = info[s[j]];
  6471. // if the superseded module is loaded, we can't
  6472. // load the rollup unless it has been forced.
  6473. if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
  6474. roll = false;
  6475. break;
  6476. // increment the counter if this module is required.
  6477. // if we are beyond the rollup threshold, we will
  6478. // use the rollup module
  6479. } else if (r[s[j]] && m.type == smod.type) {
  6480. c++;
  6481. roll = (c >= m.rollup);
  6482. if (roll) {
  6483. break;
  6484. }
  6485. }
  6486. }
  6487. if (roll) {
  6488. // add the rollup
  6489. r[i] = true;
  6490. rolled = true;
  6491. // expand the rollup's dependencies
  6492. this.getRequires(m);
  6493. }
  6494. }
  6495. }
  6496. }
  6497. // if we made it here w/o rolling up something, we are done
  6498. if (!rolled) {
  6499. break;
  6500. }
  6501. }
  6502. };
  6503. }, '3.4.0' ,{requires:['loader-base']});
  6504. YUI.add('loader-yui3', function(Y) {
  6505. /* This file is auto-generated by src/loader/scripts/meta_join.py */
  6506. /**
  6507. * YUI 3 module metadata
  6508. * @module loader
  6509. * @submodule yui3
  6510. */
  6511. YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {
  6512. "align-plugin": {
  6513. "requires": [
  6514. "node-screen",
  6515. "node-pluginhost"
  6516. ]
  6517. },
  6518. "anim": {
  6519. "use": [
  6520. "anim-base",
  6521. "anim-color",
  6522. "anim-curve",
  6523. "anim-easing",
  6524. "anim-node-plugin",
  6525. "anim-scroll",
  6526. "anim-xy"
  6527. ]
  6528. },
  6529. "anim-base": {
  6530. "requires": [
  6531. "base-base",
  6532. "node-style"
  6533. ]
  6534. },
  6535. "anim-color": {
  6536. "requires": [
  6537. "anim-base"
  6538. ]
  6539. },
  6540. "anim-curve": {
  6541. "requires": [
  6542. "anim-xy"
  6543. ]
  6544. },
  6545. "anim-easing": {
  6546. "requires": [
  6547. "anim-base"
  6548. ]
  6549. },
  6550. "anim-node-plugin": {
  6551. "requires": [
  6552. "node-pluginhost",
  6553. "anim-base"
  6554. ]
  6555. },
  6556. "anim-scroll": {
  6557. "requires": [
  6558. "anim-base"
  6559. ]
  6560. },
  6561. "anim-xy": {
  6562. "requires": [
  6563. "anim-base",
  6564. "node-screen"
  6565. ]
  6566. },
  6567. "app": {
  6568. "use": [
  6569. "controller",
  6570. "model",
  6571. "model-list",
  6572. "view"
  6573. ]
  6574. },
  6575. "array-extras": {
  6576. "requires": [
  6577. "yui-base"
  6578. ]
  6579. },
  6580. "array-invoke": {
  6581. "requires": [
  6582. "yui-base"
  6583. ]
  6584. },
  6585. "arraylist": {
  6586. "requires": [
  6587. "yui-base"
  6588. ]
  6589. },
  6590. "arraylist-add": {
  6591. "requires": [
  6592. "arraylist"
  6593. ]
  6594. },
  6595. "arraylist-filter": {
  6596. "requires": [
  6597. "arraylist"
  6598. ]
  6599. },
  6600. "arraysort": {
  6601. "requires": [
  6602. "yui-base"
  6603. ]
  6604. },
  6605. "async-queue": {
  6606. "requires": [
  6607. "event-custom"
  6608. ]
  6609. },
  6610. "attribute": {
  6611. "use": [
  6612. "attribute-base",
  6613. "attribute-complex"
  6614. ]
  6615. },
  6616. "attribute-base": {
  6617. "requires": [
  6618. "event-custom"
  6619. ]
  6620. },
  6621. "attribute-complex": {
  6622. "requires": [
  6623. "attribute-base"
  6624. ]
  6625. },
  6626. "autocomplete": {
  6627. "use": [
  6628. "autocomplete-base",
  6629. "autocomplete-sources",
  6630. "autocomplete-list",
  6631. "autocomplete-plugin"
  6632. ]
  6633. },
  6634. "autocomplete-base": {
  6635. "optional": [
  6636. "autocomplete-sources"
  6637. ],
  6638. "requires": [
  6639. "array-extras",
  6640. "base-build",
  6641. "escape",
  6642. "event-valuechange",
  6643. "node-base"
  6644. ]
  6645. },
  6646. "autocomplete-filters": {
  6647. "requires": [
  6648. "array-extras",
  6649. "text-wordbreak"
  6650. ]
  6651. },
  6652. "autocomplete-filters-accentfold": {
  6653. "requires": [
  6654. "array-extras",
  6655. "text-accentfold",
  6656. "text-wordbreak"
  6657. ]
  6658. },
  6659. "autocomplete-highlighters": {
  6660. "requires": [
  6661. "array-extras",
  6662. "highlight-base"
  6663. ]
  6664. },
  6665. "autocomplete-highlighters-accentfold": {
  6666. "requires": [
  6667. "array-extras",
  6668. "highlight-accentfold"
  6669. ]
  6670. },
  6671. "autocomplete-list": {
  6672. "after": [
  6673. "autocomplete-sources"
  6674. ],
  6675. "lang": [
  6676. "en"
  6677. ],
  6678. "requires": [
  6679. "autocomplete-base",
  6680. "event-resize",
  6681. "node-screen",
  6682. "selector-css3",
  6683. "shim-plugin",
  6684. "widget",
  6685. "widget-position",
  6686. "widget-position-align"
  6687. ],
  6688. "skinnable": true
  6689. },
  6690. "autocomplete-list-keys": {
  6691. "condition": {
  6692. "name": "autocomplete-list-keys",
  6693. "test": function (Y) {
  6694. // Only add keyboard support to autocomplete-list if this doesn't appear to
  6695. // be an iOS or Android-based mobile device.
  6696. //
  6697. // There's currently no feasible way to actually detect whether a device has
  6698. // a hardware keyboard, so this sniff will have To Do. It can easily be
  6699. // overridden by manually loading the autocomplete-list-keys module.
  6700. //
  6701. // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
  6702. // doesn't fire the keyboard events used by AutoCompleteList, so there's
  6703. // no point loading the -keys module even when a bluetooth keyboard may be
  6704. // available.
  6705. return !(Y.UA.ios || Y.UA.android);
  6706. },
  6707. "trigger": "autocomplete-list"
  6708. },
  6709. "requires": [
  6710. "autocomplete-list",
  6711. "base-build"
  6712. ]
  6713. },
  6714. "autocomplete-plugin": {
  6715. "requires": [
  6716. "autocomplete-list",
  6717. "node-pluginhost"
  6718. ]
  6719. },
  6720. "autocomplete-sources": {
  6721. "optional": [
  6722. "io-base",
  6723. "json-parse",
  6724. "jsonp",
  6725. "yql"
  6726. ],
  6727. "requires": [
  6728. "autocomplete-base"
  6729. ]
  6730. },
  6731. "base": {
  6732. "use": [
  6733. "base-base",
  6734. "base-pluginhost",
  6735. "base-build"
  6736. ]
  6737. },
  6738. "base-base": {
  6739. "after": [
  6740. "attribute-complex"
  6741. ],
  6742. "requires": [
  6743. "attribute-base"
  6744. ]
  6745. },
  6746. "base-build": {
  6747. "requires": [
  6748. "base-base"
  6749. ]
  6750. },
  6751. "base-pluginhost": {
  6752. "requires": [
  6753. "base-base",
  6754. "pluginhost"
  6755. ]
  6756. },
  6757. "cache": {
  6758. "use": [
  6759. "cache-base",
  6760. "cache-offline",
  6761. "cache-plugin"
  6762. ]
  6763. },
  6764. "cache-base": {
  6765. "requires": [
  6766. "base"
  6767. ]
  6768. },
  6769. "cache-offline": {
  6770. "requires": [
  6771. "cache-base",
  6772. "json"
  6773. ]
  6774. },
  6775. "cache-plugin": {
  6776. "requires": [
  6777. "plugin",
  6778. "cache-base"
  6779. ]
  6780. },
  6781. "calendar": {
  6782. "lang": [
  6783. "en",
  6784. "ja",
  6785. "ru"
  6786. ],
  6787. "requires": [
  6788. "calendar-base",
  6789. "calendarnavigator"
  6790. ],
  6791. "skinnable": true
  6792. },
  6793. "calendar-base": {
  6794. "lang": [
  6795. "en",
  6796. "ja",
  6797. "ru"
  6798. ],
  6799. "requires": [
  6800. "widget",
  6801. "substitute",
  6802. "datatype-date",
  6803. "datatype-date-math",
  6804. "cssgrids"
  6805. ],
  6806. "skinnable": true
  6807. },
  6808. "calendarnavigator": {
  6809. "requires": [
  6810. "plugin",
  6811. "classnamemanager",
  6812. "datatype-date",
  6813. "node",
  6814. "substitute"
  6815. ],
  6816. "skinnable": true
  6817. },
  6818. "charts": {
  6819. "requires": [
  6820. "dom",
  6821. "datatype-number",
  6822. "datatype-date",
  6823. "event-custom",
  6824. "event-mouseenter",
  6825. "widget",
  6826. "widget-position",
  6827. "widget-stack",
  6828. "graphics"
  6829. ]
  6830. },
  6831. "classnamemanager": {
  6832. "requires": [
  6833. "yui-base"
  6834. ]
  6835. },
  6836. "clickable-rail": {
  6837. "requires": [
  6838. "slider-base"
  6839. ]
  6840. },
  6841. "collection": {
  6842. "use": [
  6843. "array-extras",
  6844. "arraylist",
  6845. "arraylist-add",
  6846. "arraylist-filter",
  6847. "array-invoke"
  6848. ]
  6849. },
  6850. "console": {
  6851. "lang": [
  6852. "en",
  6853. "es",
  6854. "ja"
  6855. ],
  6856. "requires": [
  6857. "yui-log",
  6858. "widget",
  6859. "substitute"
  6860. ],
  6861. "skinnable": true
  6862. },
  6863. "console-filters": {
  6864. "requires": [
  6865. "plugin",
  6866. "console"
  6867. ],
  6868. "skinnable": true
  6869. },
  6870. "controller": {
  6871. "optional": [
  6872. "querystring-parse"
  6873. ],
  6874. "requires": [
  6875. "array-extras",
  6876. "base-build",
  6877. "history"
  6878. ]
  6879. },
  6880. "cookie": {
  6881. "requires": [
  6882. "yui-base"
  6883. ]
  6884. },
  6885. "createlink-base": {
  6886. "requires": [
  6887. "editor-base"
  6888. ]
  6889. },
  6890. "cssbase": {
  6891. "after": [
  6892. "cssreset",
  6893. "cssfonts",
  6894. "cssgrids",
  6895. "cssreset-context",
  6896. "cssfonts-context",
  6897. "cssgrids-context"
  6898. ],
  6899. "type": "css"
  6900. },
  6901. "cssbase-context": {
  6902. "after": [
  6903. "cssreset",
  6904. "cssfonts",
  6905. "cssgrids",
  6906. "cssreset-context",
  6907. "cssfonts-context",
  6908. "cssgrids-context"
  6909. ],
  6910. "type": "css"
  6911. },
  6912. "cssfonts": {
  6913. "type": "css"
  6914. },
  6915. "cssfonts-context": {
  6916. "type": "css"
  6917. },
  6918. "cssgrids": {
  6919. "optional": [
  6920. "cssreset",
  6921. "cssfonts"
  6922. ],
  6923. "type": "css"
  6924. },
  6925. "cssreset": {
  6926. "type": "css"
  6927. },
  6928. "cssreset-context": {
  6929. "type": "css"
  6930. },
  6931. "dataschema": {
  6932. "use": [
  6933. "dataschema-base",
  6934. "dataschema-json",
  6935. "dataschema-xml",
  6936. "dataschema-array",
  6937. "dataschema-text"
  6938. ]
  6939. },
  6940. "dataschema-array": {
  6941. "requires": [
  6942. "dataschema-base"
  6943. ]
  6944. },
  6945. "dataschema-base": {
  6946. "requires": [
  6947. "base"
  6948. ]
  6949. },
  6950. "dataschema-json": {
  6951. "requires": [
  6952. "dataschema-base",
  6953. "json"
  6954. ]
  6955. },
  6956. "dataschema-text": {
  6957. "requires": [
  6958. "dataschema-base"
  6959. ]
  6960. },
  6961. "dataschema-xml": {
  6962. "requires": [
  6963. "dataschema-base"
  6964. ]
  6965. },
  6966. "datasource": {
  6967. "use": [
  6968. "datasource-local",
  6969. "datasource-io",
  6970. "datasource-get",
  6971. "datasource-function",
  6972. "datasource-cache",
  6973. "datasource-jsonschema",
  6974. "datasource-xmlschema",
  6975. "datasource-arrayschema",
  6976. "datasource-textschema",
  6977. "datasource-polling"
  6978. ]
  6979. },
  6980. "datasource-arrayschema": {
  6981. "requires": [
  6982. "datasource-local",
  6983. "plugin",
  6984. "dataschema-array"
  6985. ]
  6986. },
  6987. "datasource-cache": {
  6988. "requires": [
  6989. "datasource-local",
  6990. "plugin",
  6991. "cache-base"
  6992. ]
  6993. },
  6994. "datasource-function": {
  6995. "requires": [
  6996. "datasource-local"
  6997. ]
  6998. },
  6999. "datasource-get": {
  7000. "requires": [
  7001. "datasource-local",
  7002. "get"
  7003. ]
  7004. },
  7005. "datasource-io": {
  7006. "requires": [
  7007. "datasource-local",
  7008. "io-base"
  7009. ]
  7010. },
  7011. "datasource-jsonschema": {
  7012. "requires": [
  7013. "datasource-local",
  7014. "plugin",
  7015. "dataschema-json"
  7016. ]
  7017. },
  7018. "datasource-local": {
  7019. "requires": [
  7020. "base"
  7021. ]
  7022. },
  7023. "datasource-polling": {
  7024. "requires": [
  7025. "datasource-local"
  7026. ]
  7027. },
  7028. "datasource-textschema": {
  7029. "requires": [
  7030. "datasource-local",
  7031. "plugin",
  7032. "dataschema-text"
  7033. ]
  7034. },
  7035. "datasource-xmlschema": {
  7036. "requires": [
  7037. "datasource-local",
  7038. "plugin",
  7039. "dataschema-xml"
  7040. ]
  7041. },
  7042. "datatable": {
  7043. "use": [
  7044. "datatable-base",
  7045. "datatable-datasource",
  7046. "datatable-sort",
  7047. "datatable-scroll"
  7048. ]
  7049. },
  7050. "datatable-base": {
  7051. "requires": [
  7052. "recordset-base",
  7053. "widget",
  7054. "substitute",
  7055. "event-mouseenter"
  7056. ],
  7057. "skinnable": true
  7058. },
  7059. "datatable-datasource": {
  7060. "requires": [
  7061. "datatable-base",
  7062. "plugin",
  7063. "datasource-local"
  7064. ]
  7065. },
  7066. "datatable-scroll": {
  7067. "requires": [
  7068. "datatable-base",
  7069. "plugin"
  7070. ]
  7071. },
  7072. "datatable-sort": {
  7073. "lang": [
  7074. "en"
  7075. ],
  7076. "requires": [
  7077. "datatable-base",
  7078. "plugin",
  7079. "recordset-sort"
  7080. ]
  7081. },
  7082. "datatype": {
  7083. "use": [
  7084. "datatype-number",
  7085. "datatype-date",
  7086. "datatype-xml"
  7087. ]
  7088. },
  7089. "datatype-date": {
  7090. "supersedes": [
  7091. "datatype-date-format"
  7092. ],
  7093. "use": [
  7094. "datatype-date-parse",
  7095. "datatype-date-format"
  7096. ]
  7097. },
  7098. "datatype-date-format": {
  7099. "lang": [
  7100. "ar",
  7101. "ar-JO",
  7102. "ca",
  7103. "ca-ES",
  7104. "da",
  7105. "da-DK",
  7106. "de",
  7107. "de-AT",
  7108. "de-DE",
  7109. "el",
  7110. "el-GR",
  7111. "en",
  7112. "en-AU",
  7113. "en-CA",
  7114. "en-GB",
  7115. "en-IE",
  7116. "en-IN",
  7117. "en-JO",
  7118. "en-MY",
  7119. "en-NZ",
  7120. "en-PH",
  7121. "en-SG",
  7122. "en-US",
  7123. "es",
  7124. "es-AR",
  7125. "es-BO",
  7126. "es-CL",
  7127. "es-CO",
  7128. "es-EC",
  7129. "es-ES",
  7130. "es-MX",
  7131. "es-PE",
  7132. "es-PY",
  7133. "es-US",
  7134. "es-UY",
  7135. "es-VE",
  7136. "fi",
  7137. "fi-FI",
  7138. "fr",
  7139. "fr-BE",
  7140. "fr-CA",
  7141. "fr-FR",
  7142. "hi",
  7143. "hi-IN",
  7144. "id",
  7145. "id-ID",
  7146. "it",
  7147. "it-IT",
  7148. "ja",
  7149. "ja-JP",
  7150. "ko",
  7151. "ko-KR",
  7152. "ms",
  7153. "ms-MY",
  7154. "nb",
  7155. "nb-NO",
  7156. "nl",
  7157. "nl-BE",
  7158. "nl-NL",
  7159. "pl",
  7160. "pl-PL",
  7161. "pt",
  7162. "pt-BR",
  7163. "ro",
  7164. "ro-RO",
  7165. "ru",
  7166. "ru-RU",
  7167. "sv",
  7168. "sv-SE",
  7169. "th",
  7170. "th-TH",
  7171. "tr",
  7172. "tr-TR",
  7173. "vi",
  7174. "vi-VN",
  7175. "zh-Hans",
  7176. "zh-Hans-CN",
  7177. "zh-Hant",
  7178. "zh-Hant-HK",
  7179. "zh-Hant-TW"
  7180. ]
  7181. },
  7182. "datatype-date-math": {
  7183. "requires": [
  7184. "yui-base"
  7185. ]
  7186. },
  7187. "datatype-date-parse": {},
  7188. "datatype-number": {
  7189. "use": [
  7190. "datatype-number-parse",
  7191. "datatype-number-format"
  7192. ]
  7193. },
  7194. "datatype-number-format": {},
  7195. "datatype-number-parse": {},
  7196. "datatype-xml": {
  7197. "use": [
  7198. "datatype-xml-parse",
  7199. "datatype-xml-format"
  7200. ]
  7201. },
  7202. "datatype-xml-format": {},
  7203. "datatype-xml-parse": {},
  7204. "dd": {
  7205. "use": [
  7206. "dd-ddm-base",
  7207. "dd-ddm",
  7208. "dd-ddm-drop",
  7209. "dd-drag",
  7210. "dd-proxy",
  7211. "dd-constrain",
  7212. "dd-drop",
  7213. "dd-scroll",
  7214. "dd-delegate"
  7215. ]
  7216. },
  7217. "dd-constrain": {
  7218. "requires": [
  7219. "dd-drag"
  7220. ]
  7221. },
  7222. "dd-ddm": {
  7223. "requires": [
  7224. "dd-ddm-base",
  7225. "event-resize"
  7226. ]
  7227. },
  7228. "dd-ddm-base": {
  7229. "requires": [
  7230. "node",
  7231. "base",
  7232. "yui-throttle",
  7233. "classnamemanager"
  7234. ]
  7235. },
  7236. "dd-ddm-drop": {
  7237. "requires": [
  7238. "dd-ddm"
  7239. ]
  7240. },
  7241. "dd-delegate": {
  7242. "requires": [
  7243. "dd-drag",
  7244. "dd-drop-plugin",
  7245. "event-mouseenter"
  7246. ]
  7247. },
  7248. "dd-drag": {
  7249. "requires": [
  7250. "dd-ddm-base"
  7251. ]
  7252. },
  7253. "dd-drop": {
  7254. "requires": [
  7255. "dd-drag",
  7256. "dd-ddm-drop"
  7257. ]
  7258. },
  7259. "dd-drop-plugin": {
  7260. "requires": [
  7261. "dd-drop"
  7262. ]
  7263. },
  7264. "dd-gestures": {
  7265. "condition": {
  7266. "name": "dd-gestures",
  7267. "test": function(Y) {
  7268. var UA = Y.UA;
  7269. return ((UA.mobile || UA.android || UA.ios) && UA.touch);
  7270. },
  7271. "trigger": "dd-drag"
  7272. },
  7273. "requires": [
  7274. "dd-drag",
  7275. "event-synthetic",
  7276. "event-gestures"
  7277. ]
  7278. },
  7279. "dd-plugin": {
  7280. "optional": [
  7281. "dd-constrain",
  7282. "dd-proxy"
  7283. ],
  7284. "requires": [
  7285. "dd-drag"
  7286. ]
  7287. },
  7288. "dd-proxy": {
  7289. "requires": [
  7290. "dd-drag"
  7291. ]
  7292. },
  7293. "dd-scroll": {
  7294. "requires": [
  7295. "dd-drag"
  7296. ]
  7297. },
  7298. "dial": {
  7299. "lang": [
  7300. "en",
  7301. "es"
  7302. ],
  7303. "requires": [
  7304. "widget",
  7305. "dd-drag",
  7306. "substitute",
  7307. "event-mouseenter",
  7308. "event-move",
  7309. "event-key",
  7310. "transition",
  7311. "intl"
  7312. ],
  7313. "skinnable": true
  7314. },
  7315. "dom": {
  7316. "use": [
  7317. "dom-base",
  7318. "dom-screen",
  7319. "dom-style",
  7320. "selector-native",
  7321. "selector"
  7322. ]
  7323. },
  7324. "dom-base": {
  7325. "requires": [
  7326. "dom-core"
  7327. ]
  7328. },
  7329. "dom-core": {
  7330. "requires": [
  7331. "oop",
  7332. "features"
  7333. ]
  7334. },
  7335. "dom-deprecated": {
  7336. "requires": [
  7337. "dom-base"
  7338. ]
  7339. },
  7340. "dom-screen": {
  7341. "requires": [
  7342. "dom-base",
  7343. "dom-style"
  7344. ]
  7345. },
  7346. "dom-style": {
  7347. "requires": [
  7348. "dom-base"
  7349. ]
  7350. },
  7351. "dom-style-ie": {
  7352. "condition": {
  7353. "name": "dom-style-ie",
  7354. "test": function (Y) {
  7355. var testFeature = Y.Features.test,
  7356. addFeature = Y.Features.add,
  7357. WINDOW = Y.config.win,
  7358. DOCUMENT = Y.config.doc,
  7359. DOCUMENT_ELEMENT = 'documentElement',
  7360. ret = false;
  7361. addFeature('style', 'computedStyle', {
  7362. test: function() {
  7363. return WINDOW && 'getComputedStyle' in WINDOW;
  7364. }
  7365. });
  7366. addFeature('style', 'opacity', {
  7367. test: function() {
  7368. return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
  7369. }
  7370. });
  7371. ret = (!testFeature('style', 'opacity') &&
  7372. !testFeature('style', 'computedStyle'));
  7373. return ret;
  7374. },
  7375. "trigger": "dom-style"
  7376. },
  7377. "requires": [
  7378. "dom-style"
  7379. ]
  7380. },
  7381. "dump": {
  7382. "requires": [
  7383. "yui-base"
  7384. ]
  7385. },
  7386. "editor": {
  7387. "use": [
  7388. "frame",
  7389. "selection",
  7390. "exec-command",
  7391. "editor-base",
  7392. "editor-para",
  7393. "editor-br",
  7394. "editor-bidi",
  7395. "editor-tab",
  7396. "createlink-base"
  7397. ]
  7398. },
  7399. "editor-base": {
  7400. "requires": [
  7401. "base",
  7402. "frame",
  7403. "node",
  7404. "exec-command",
  7405. "selection"
  7406. ]
  7407. },
  7408. "editor-bidi": {
  7409. "requires": [
  7410. "editor-base"
  7411. ]
  7412. },
  7413. "editor-br": {
  7414. "requires": [
  7415. "editor-base"
  7416. ]
  7417. },
  7418. "editor-lists": {
  7419. "requires": [
  7420. "editor-base"
  7421. ]
  7422. },
  7423. "editor-para": {
  7424. "requires": [
  7425. "editor-base"
  7426. ]
  7427. },
  7428. "editor-tab": {
  7429. "requires": [
  7430. "editor-base"
  7431. ]
  7432. },
  7433. "escape": {
  7434. "requires": [
  7435. "yui-base"
  7436. ]
  7437. },
  7438. "event": {
  7439. "after": [
  7440. "node-base"
  7441. ],
  7442. "use": [
  7443. "event-base",
  7444. "event-delegate",
  7445. "event-synthetic",
  7446. "event-mousewheel",
  7447. "event-mouseenter",
  7448. "event-key",
  7449. "event-focus",
  7450. "event-resize",
  7451. "event-hover",
  7452. "event-outside"
  7453. ]
  7454. },
  7455. "event-base": {
  7456. "after": [
  7457. "node-base"
  7458. ],
  7459. "requires": [
  7460. "event-custom-base"
  7461. ]
  7462. },
  7463. "event-base-ie": {
  7464. "after": [
  7465. "event-base"
  7466. ],
  7467. "condition": {
  7468. "name": "event-base-ie",
  7469. "test": function(Y) {
  7470. var imp = Y.config.doc && Y.config.doc.implementation;
  7471. return (imp && (!imp.hasFeature('Events', '2.0')));
  7472. },
  7473. "trigger": "node-base"
  7474. },
  7475. "requires": [
  7476. "node-base"
  7477. ]
  7478. },
  7479. "event-custom": {
  7480. "use": [
  7481. "event-custom-base",
  7482. "event-custom-complex"
  7483. ]
  7484. },
  7485. "event-custom-base": {
  7486. "requires": [
  7487. "oop"
  7488. ]
  7489. },
  7490. "event-custom-complex": {
  7491. "requires": [
  7492. "event-custom-base"
  7493. ]
  7494. },
  7495. "event-delegate": {
  7496. "requires": [
  7497. "node-base"
  7498. ]
  7499. },
  7500. "event-flick": {
  7501. "requires": [
  7502. "node-base",
  7503. "event-touch",
  7504. "event-synthetic"
  7505. ]
  7506. },
  7507. "event-focus": {
  7508. "requires": [
  7509. "event-synthetic"
  7510. ]
  7511. },
  7512. "event-gestures": {
  7513. "use": [
  7514. "event-flick",
  7515. "event-move"
  7516. ]
  7517. },
  7518. "event-hover": {
  7519. "requires": [
  7520. "event-mouseenter"
  7521. ]
  7522. },
  7523. "event-key": {
  7524. "requires": [
  7525. "event-synthetic"
  7526. ]
  7527. },
  7528. "event-mouseenter": {
  7529. "requires": [
  7530. "event-synthetic"
  7531. ]
  7532. },
  7533. "event-mousewheel": {
  7534. "requires": [
  7535. "node-base"
  7536. ]
  7537. },
  7538. "event-move": {
  7539. "requires": [
  7540. "node-base",
  7541. "event-touch",
  7542. "event-synthetic"
  7543. ]
  7544. },
  7545. "event-outside": {
  7546. "requires": [
  7547. "event-synthetic"
  7548. ]
  7549. },
  7550. "event-resize": {
  7551. "requires": [
  7552. "node-base",
  7553. "event-synthetic"
  7554. ]
  7555. },
  7556. "event-simulate": {
  7557. "requires": [
  7558. "event-base"
  7559. ]
  7560. },
  7561. "event-synthetic": {
  7562. "requires": [
  7563. "node-base",
  7564. "event-custom-complex"
  7565. ]
  7566. },
  7567. "event-touch": {
  7568. "requires": [
  7569. "node-base"
  7570. ]
  7571. },
  7572. "event-valuechange": {
  7573. "requires": [
  7574. "event-focus",
  7575. "event-synthetic"
  7576. ]
  7577. },
  7578. "exec-command": {
  7579. "requires": [
  7580. "frame"
  7581. ]
  7582. },
  7583. "features": {
  7584. "requires": [
  7585. "yui-base"
  7586. ]
  7587. },
  7588. "frame": {
  7589. "requires": [
  7590. "base",
  7591. "node",
  7592. "selector-css3",
  7593. "substitute",
  7594. "yui-throttle"
  7595. ]
  7596. },
  7597. "get": {
  7598. "requires": [
  7599. "yui-base"
  7600. ]
  7601. },
  7602. "graphics": {
  7603. "requires": [
  7604. "node",
  7605. "event-custom",
  7606. "pluginhost"
  7607. ]
  7608. },
  7609. "graphics-canvas": {
  7610. "condition": {
  7611. "name": "graphics-canvas",
  7612. "test": function(Y) {
  7613. var DOCUMENT = Y.config.doc,
  7614. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  7615. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
  7616. },
  7617. "trigger": "graphics"
  7618. },
  7619. "requires": [
  7620. "graphics"
  7621. ]
  7622. },
  7623. "graphics-canvas-default": {
  7624. "condition": {
  7625. "name": "graphics-canvas-default",
  7626. "test": function(Y) {
  7627. var DOCUMENT = Y.config.doc,
  7628. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  7629. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
  7630. },
  7631. "trigger": "graphics"
  7632. }
  7633. },
  7634. "graphics-svg": {
  7635. "condition": {
  7636. "name": "graphics-svg",
  7637. "test": function(Y) {
  7638. var DOCUMENT = Y.config.doc;
  7639. return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
  7640. },
  7641. "trigger": "graphics"
  7642. },
  7643. "requires": [
  7644. "graphics"
  7645. ]
  7646. },
  7647. "graphics-svg-default": {
  7648. "condition": {
  7649. "name": "graphics-svg-default",
  7650. "test": function(Y) {
  7651. var DOCUMENT = Y.config.doc;
  7652. return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
  7653. },
  7654. "trigger": "graphics"
  7655. }
  7656. },
  7657. "graphics-vml": {
  7658. "condition": {
  7659. "name": "graphics-vml",
  7660. "test": function(Y) {
  7661. var DOCUMENT = Y.config.doc,
  7662. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  7663. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
  7664. },
  7665. "trigger": "graphics"
  7666. },
  7667. "requires": [
  7668. "graphics"
  7669. ]
  7670. },
  7671. "graphics-vml-default": {
  7672. "condition": {
  7673. "name": "graphics-vml-default",
  7674. "test": function(Y) {
  7675. var DOCUMENT = Y.config.doc,
  7676. canvas = DOCUMENT && DOCUMENT.createElement("canvas");
  7677. return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
  7678. },
  7679. "trigger": "graphics"
  7680. }
  7681. },
  7682. "highlight": {
  7683. "use": [
  7684. "highlight-base",
  7685. "highlight-accentfold"
  7686. ]
  7687. },
  7688. "highlight-accentfold": {
  7689. "requires": [
  7690. "highlight-base",
  7691. "text-accentfold"
  7692. ]
  7693. },
  7694. "highlight-base": {
  7695. "requires": [
  7696. "array-extras",
  7697. "classnamemanager",
  7698. "escape",
  7699. "text-wordbreak"
  7700. ]
  7701. },
  7702. "history": {
  7703. "use": [
  7704. "history-base",
  7705. "history-hash",
  7706. "history-hash-ie",
  7707. "history-html5"
  7708. ]
  7709. },
  7710. "history-base": {
  7711. "requires": [
  7712. "event-custom-complex"
  7713. ]
  7714. },
  7715. "history-hash": {
  7716. "after": [
  7717. "history-html5"
  7718. ],
  7719. "requires": [
  7720. "event-synthetic",
  7721. "history-base",
  7722. "yui-later"
  7723. ]
  7724. },
  7725. "history-hash-ie": {
  7726. "condition": {
  7727. "name": "history-hash-ie",
  7728. "test": function (Y) {
  7729. var docMode = Y.config.doc && Y.config.doc.documentMode;
  7730. return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
  7731. !docMode || docMode < 8);
  7732. },
  7733. "trigger": "history-hash"
  7734. },
  7735. "requires": [
  7736. "history-hash",
  7737. "node-base"
  7738. ]
  7739. },
  7740. "history-html5": {
  7741. "optional": [
  7742. "json"
  7743. ],
  7744. "requires": [
  7745. "event-base",
  7746. "history-base",
  7747. "node-base"
  7748. ]
  7749. },
  7750. "imageloader": {
  7751. "requires": [
  7752. "base-base",
  7753. "node-style",
  7754. "node-screen"
  7755. ]
  7756. },
  7757. "intl": {
  7758. "requires": [
  7759. "intl-base",
  7760. "event-custom"
  7761. ]
  7762. },
  7763. "intl-base": {
  7764. "requires": [
  7765. "yui-base"
  7766. ]
  7767. },
  7768. "io": {
  7769. "use": [
  7770. "io-base",
  7771. "io-xdr",
  7772. "io-form",
  7773. "io-upload-iframe",
  7774. "io-queue"
  7775. ]
  7776. },
  7777. "io-base": {
  7778. "requires": [
  7779. "event-custom-base",
  7780. "querystring-stringify-simple"
  7781. ]
  7782. },
  7783. "io-form": {
  7784. "requires": [
  7785. "io-base",
  7786. "node-base"
  7787. ]
  7788. },
  7789. "io-queue": {
  7790. "requires": [
  7791. "io-base",
  7792. "queue-promote"
  7793. ]
  7794. },
  7795. "io-upload-iframe": {
  7796. "requires": [
  7797. "io-base",
  7798. "node-base"
  7799. ]
  7800. },
  7801. "io-xdr": {
  7802. "requires": [
  7803. "io-base",
  7804. "datatype-xml-parse"
  7805. ]
  7806. },
  7807. "json": {
  7808. "use": [
  7809. "json-parse",
  7810. "json-stringify"
  7811. ]
  7812. },
  7813. "json-parse": {
  7814. "requires": [
  7815. "yui-base"
  7816. ]
  7817. },
  7818. "json-stringify": {
  7819. "requires": [
  7820. "yui-base"
  7821. ]
  7822. },
  7823. "jsonp": {
  7824. "requires": [
  7825. "get",
  7826. "oop"
  7827. ]
  7828. },
  7829. "jsonp-url": {
  7830. "requires": [
  7831. "jsonp"
  7832. ]
  7833. },
  7834. "loader": {
  7835. "use": [
  7836. "loader-base",
  7837. "loader-rollup",
  7838. "loader-yui3"
  7839. ]
  7840. },
  7841. "loader-base": {
  7842. "requires": [
  7843. "get"
  7844. ]
  7845. },
  7846. "loader-rollup": {
  7847. "requires": [
  7848. "loader-base"
  7849. ]
  7850. },
  7851. "loader-yui3": {
  7852. "requires": [
  7853. "loader-base"
  7854. ]
  7855. },
  7856. "model": {
  7857. "requires": [
  7858. "base-build",
  7859. "escape",
  7860. "json-parse"
  7861. ]
  7862. },
  7863. "model-list": {
  7864. "requires": [
  7865. "array-extras",
  7866. "array-invoke",
  7867. "arraylist",
  7868. "base-build",
  7869. "escape",
  7870. "json-parse",
  7871. "model"
  7872. ]
  7873. },
  7874. "node": {
  7875. "use": [
  7876. "node-base",
  7877. "node-event-delegate",
  7878. "node-pluginhost",
  7879. "node-screen",
  7880. "node-style"
  7881. ]
  7882. },
  7883. "node-base": {
  7884. "requires": [
  7885. "event-base",
  7886. "node-core",
  7887. "dom-base"
  7888. ]
  7889. },
  7890. "node-core": {
  7891. "requires": [
  7892. "dom-core",
  7893. "selector"
  7894. ]
  7895. },
  7896. "node-deprecated": {
  7897. "requires": [
  7898. "node-base"
  7899. ]
  7900. },
  7901. "node-event-delegate": {
  7902. "requires": [
  7903. "node-base",
  7904. "event-delegate"
  7905. ]
  7906. },
  7907. "node-event-html5": {
  7908. "requires": [
  7909. "node-base"
  7910. ]
  7911. },
  7912. "node-event-simulate": {
  7913. "requires": [
  7914. "node-base",
  7915. "event-simulate"
  7916. ]
  7917. },
  7918. "node-flick": {
  7919. "requires": [
  7920. "classnamemanager",
  7921. "transition",
  7922. "event-flick",
  7923. "plugin"
  7924. ],
  7925. "skinnable": true
  7926. },
  7927. "node-focusmanager": {
  7928. "requires": [
  7929. "attribute",
  7930. "node",
  7931. "plugin",
  7932. "node-event-simulate",
  7933. "event-key",
  7934. "event-focus"
  7935. ]
  7936. },
  7937. "node-load": {
  7938. "requires": [
  7939. "node-base",
  7940. "io-base"
  7941. ]
  7942. },
  7943. "node-menunav": {
  7944. "requires": [
  7945. "node",
  7946. "classnamemanager",
  7947. "plugin",
  7948. "node-focusmanager"
  7949. ],
  7950. "skinnable": true
  7951. },
  7952. "node-pluginhost": {
  7953. "requires": [
  7954. "node-base",
  7955. "pluginhost"
  7956. ]
  7957. },
  7958. "node-screen": {
  7959. "requires": [
  7960. "dom-screen",
  7961. "node-base"
  7962. ]
  7963. },
  7964. "node-style": {
  7965. "requires": [
  7966. "dom-style",
  7967. "node-base"
  7968. ]
  7969. },
  7970. "oop": {
  7971. "requires": [
  7972. "yui-base"
  7973. ]
  7974. },
  7975. "overlay": {
  7976. "requires": [
  7977. "widget",
  7978. "widget-stdmod",
  7979. "widget-position",
  7980. "widget-position-align",
  7981. "widget-stack",
  7982. "widget-position-constrain"
  7983. ],
  7984. "skinnable": true
  7985. },
  7986. "panel": {
  7987. "requires": [
  7988. "widget",
  7989. "widget-stdmod",
  7990. "widget-position",
  7991. "widget-position-align",
  7992. "widget-stack",
  7993. "widget-position-constrain",
  7994. "widget-modality",
  7995. "widget-autohide",
  7996. "widget-buttons"
  7997. ],
  7998. "skinnable": true
  7999. },
  8000. "plugin": {
  8001. "requires": [
  8002. "base-base"
  8003. ]
  8004. },
  8005. "pluginhost": {
  8006. "use": [
  8007. "pluginhost-base",
  8008. "pluginhost-config"
  8009. ]
  8010. },
  8011. "pluginhost-base": {
  8012. "requires": [
  8013. "yui-base"
  8014. ]
  8015. },
  8016. "pluginhost-config": {
  8017. "requires": [
  8018. "pluginhost-base"
  8019. ]
  8020. },
  8021. "profiler": {
  8022. "requires": [
  8023. "yui-base"
  8024. ]
  8025. },
  8026. "querystring": {
  8027. "use": [
  8028. "querystring-parse",
  8029. "querystring-stringify"
  8030. ]
  8031. },
  8032. "querystring-parse": {
  8033. "requires": [
  8034. "yui-base",
  8035. "array-extras"
  8036. ]
  8037. },
  8038. "querystring-parse-simple": {
  8039. "requires": [
  8040. "yui-base"
  8041. ]
  8042. },
  8043. "querystring-stringify": {
  8044. "requires": [
  8045. "yui-base"
  8046. ]
  8047. },
  8048. "querystring-stringify-simple": {
  8049. "requires": [
  8050. "yui-base"
  8051. ]
  8052. },
  8053. "queue-promote": {
  8054. "requires": [
  8055. "yui-base"
  8056. ]
  8057. },
  8058. "range-slider": {
  8059. "requires": [
  8060. "slider-base",
  8061. "slider-value-range",
  8062. "clickable-rail"
  8063. ]
  8064. },
  8065. "recordset": {
  8066. "use": [
  8067. "recordset-base",
  8068. "recordset-sort",
  8069. "recordset-filter",
  8070. "recordset-indexer"
  8071. ]
  8072. },
  8073. "recordset-base": {
  8074. "requires": [
  8075. "base",
  8076. "arraylist"
  8077. ]
  8078. },
  8079. "recordset-filter": {
  8080. "requires": [
  8081. "recordset-base",
  8082. "array-extras",
  8083. "plugin"
  8084. ]
  8085. },
  8086. "recordset-indexer": {
  8087. "requires": [
  8088. "recordset-base",
  8089. "plugin"
  8090. ]
  8091. },
  8092. "recordset-sort": {
  8093. "requires": [
  8094. "arraysort",
  8095. "recordset-base",
  8096. "plugin"
  8097. ]
  8098. },
  8099. "resize": {
  8100. "use": [
  8101. "resize-base",
  8102. "resize-proxy",
  8103. "resize-constrain"
  8104. ]
  8105. },
  8106. "resize-base": {
  8107. "requires": [
  8108. "base",
  8109. "widget",
  8110. "substitute",
  8111. "event",
  8112. "oop",
  8113. "dd-drag",
  8114. "dd-delegate",
  8115. "dd-drop"
  8116. ],
  8117. "skinnable": true
  8118. },
  8119. "resize-constrain": {
  8120. "requires": [
  8121. "plugin",
  8122. "resize-base"
  8123. ]
  8124. },
  8125. "resize-plugin": {
  8126. "optional": [
  8127. "resize-constrain"
  8128. ],
  8129. "requires": [
  8130. "resize-base",
  8131. "plugin"
  8132. ]
  8133. },
  8134. "resize-proxy": {
  8135. "requires": [
  8136. "plugin",
  8137. "resize-base"
  8138. ]
  8139. },
  8140. "rls": {
  8141. "requires": [
  8142. "get",
  8143. "features"
  8144. ]
  8145. },
  8146. "scrollview": {
  8147. "requires": [
  8148. "scrollview-base",
  8149. "scrollview-scrollbars"
  8150. ]
  8151. },
  8152. "scrollview-base": {
  8153. "requires": [
  8154. "widget",
  8155. "event-gestures",
  8156. "transition"
  8157. ],
  8158. "skinnable": true
  8159. },
  8160. "scrollview-base-ie": {
  8161. "condition": {
  8162. "name": "scrollview-base-ie",
  8163. "trigger": "scrollview-base",
  8164. "ua": "ie"
  8165. },
  8166. "requires": [
  8167. "scrollview-base"
  8168. ]
  8169. },
  8170. "scrollview-list": {
  8171. "requires": [
  8172. "plugin",
  8173. "classnamemanager"
  8174. ],
  8175. "skinnable": true
  8176. },
  8177. "scrollview-paginator": {
  8178. "requires": [
  8179. "plugin"
  8180. ]
  8181. },
  8182. "scrollview-scrollbars": {
  8183. "requires": [
  8184. "classnamemanager",
  8185. "transition",
  8186. "plugin"
  8187. ],
  8188. "skinnable": true
  8189. },
  8190. "selection": {
  8191. "requires": [
  8192. "node"
  8193. ]
  8194. },
  8195. "selector": {
  8196. "requires": [
  8197. "selector-native"
  8198. ]
  8199. },
  8200. "selector-css2": {
  8201. "condition": {
  8202. "name": "selector-css2",
  8203. "test": function (Y) {
  8204. var DOCUMENT = Y.config.doc,
  8205. ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
  8206. return ret;
  8207. },
  8208. "trigger": "selector"
  8209. },
  8210. "requires": [
  8211. "selector-native"
  8212. ]
  8213. },
  8214. "selector-css3": {
  8215. "requires": [
  8216. "selector-native",
  8217. "selector-css2"
  8218. ]
  8219. },
  8220. "selector-native": {
  8221. "requires": [
  8222. "dom-base"
  8223. ]
  8224. },
  8225. "shim-plugin": {
  8226. "requires": [
  8227. "node-style",
  8228. "node-pluginhost"
  8229. ]
  8230. },
  8231. "slider": {
  8232. "use": [
  8233. "slider-base",
  8234. "slider-value-range",
  8235. "clickable-rail",
  8236. "range-slider"
  8237. ]
  8238. },
  8239. "slider-base": {
  8240. "requires": [
  8241. "widget",
  8242. "dd-constrain",
  8243. "substitute"
  8244. ],
  8245. "skinnable": true
  8246. },
  8247. "slider-value-range": {
  8248. "requires": [
  8249. "slider-base"
  8250. ]
  8251. },
  8252. "sortable": {
  8253. "requires": [
  8254. "dd-delegate",
  8255. "dd-drop-plugin",
  8256. "dd-proxy"
  8257. ]
  8258. },
  8259. "sortable-scroll": {
  8260. "requires": [
  8261. "dd-scroll",
  8262. "sortable"
  8263. ]
  8264. },
  8265. "stylesheet": {
  8266. "requires": [
  8267. "yui-base"
  8268. ]
  8269. },
  8270. "substitute": {
  8271. "optional": [
  8272. "dump"
  8273. ],
  8274. "requires": [
  8275. "yui-base"
  8276. ]
  8277. },
  8278. "swf": {
  8279. "requires": [
  8280. "event-custom",
  8281. "node",
  8282. "swfdetect",
  8283. "escape"
  8284. ]
  8285. },
  8286. "swfdetect": {
  8287. "requires": [
  8288. "yui-base"
  8289. ]
  8290. },
  8291. "tabview": {
  8292. "requires": [
  8293. "widget",
  8294. "widget-parent",
  8295. "widget-child",
  8296. "tabview-base",
  8297. "node-pluginhost",
  8298. "node-focusmanager"
  8299. ],
  8300. "skinnable": true
  8301. },
  8302. "tabview-base": {
  8303. "requires": [
  8304. "node-event-delegate",
  8305. "classnamemanager",
  8306. "skin-sam-tabview"
  8307. ]
  8308. },
  8309. "tabview-plugin": {
  8310. "requires": [
  8311. "tabview-base"
  8312. ]
  8313. },
  8314. "test": {
  8315. "requires": [
  8316. "event-simulate",
  8317. "event-custom",
  8318. "substitute",
  8319. "json-stringify"
  8320. ],
  8321. "skinnable": true
  8322. },
  8323. "text": {
  8324. "use": [
  8325. "text-accentfold",
  8326. "text-wordbreak"
  8327. ]
  8328. },
  8329. "text-accentfold": {
  8330. "requires": [
  8331. "array-extras",
  8332. "text-data-accentfold"
  8333. ]
  8334. },
  8335. "text-data-accentfold": {
  8336. "requires": [
  8337. "yui-base"
  8338. ]
  8339. },
  8340. "text-data-wordbreak": {
  8341. "requires": [
  8342. "yui-base"
  8343. ]
  8344. },
  8345. "text-wordbreak": {
  8346. "requires": [
  8347. "array-extras",
  8348. "text-data-wordbreak"
  8349. ]
  8350. },
  8351. "transition": {
  8352. "requires": [
  8353. "node-style"
  8354. ]
  8355. },
  8356. "transition-timer": {
  8357. "condition": {
  8358. "name": "transition-timer",
  8359. "test": function (Y) {
  8360. var DOCUMENT = Y.config.doc,
  8361. node = (DOCUMENT) ? DOCUMENT.documentElement: null,
  8362. ret = true;
  8363. if (node && node.style) {
  8364. ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style);
  8365. }
  8366. return ret;
  8367. },
  8368. "trigger": "transition"
  8369. },
  8370. "requires": [
  8371. "transition"
  8372. ]
  8373. },
  8374. "uploader": {
  8375. "requires": [
  8376. "event-custom",
  8377. "node",
  8378. "base",
  8379. "swf"
  8380. ]
  8381. },
  8382. "view": {
  8383. "requires": [
  8384. "base-build",
  8385. "node-event-delegate"
  8386. ]
  8387. },
  8388. "widget": {
  8389. "use": [
  8390. "widget-base",
  8391. "widget-htmlparser",
  8392. "widget-uievents",
  8393. "widget-skin"
  8394. ]
  8395. },
  8396. "widget-anim": {
  8397. "requires": [
  8398. "plugin",
  8399. "anim-base",
  8400. "widget"
  8401. ]
  8402. },
  8403. "widget-autohide": {
  8404. "requires": [
  8405. "widget",
  8406. "event-outside",
  8407. "base-build",
  8408. "event-key"
  8409. ],
  8410. "skinnable": false
  8411. },
  8412. "widget-base": {
  8413. "requires": [
  8414. "attribute",
  8415. "event-focus",
  8416. "base-base",
  8417. "base-pluginhost",
  8418. "node-base",
  8419. "node-style",
  8420. "classnamemanager"
  8421. ],
  8422. "skinnable": true
  8423. },
  8424. "widget-base-ie": {
  8425. "condition": {
  8426. "name": "widget-base-ie",
  8427. "trigger": "widget-base",
  8428. "ua": "ie"
  8429. },
  8430. "requires": [
  8431. "widget-base"
  8432. ]
  8433. },
  8434. "widget-buttons": {
  8435. "requires": [
  8436. "widget",
  8437. "base-build",
  8438. "widget-stdmod"
  8439. ],
  8440. "skinnable": true
  8441. },
  8442. "widget-child": {
  8443. "requires": [
  8444. "base-build",
  8445. "widget"
  8446. ]
  8447. },
  8448. "widget-htmlparser": {
  8449. "requires": [
  8450. "widget-base"
  8451. ]
  8452. },
  8453. "widget-locale": {
  8454. "requires": [
  8455. "widget-base"
  8456. ]
  8457. },
  8458. "widget-modality": {
  8459. "requires": [
  8460. "widget",
  8461. "event-outside",
  8462. "base-build"
  8463. ],
  8464. "skinnable": false
  8465. },
  8466. "widget-parent": {
  8467. "requires": [
  8468. "base-build",
  8469. "arraylist",
  8470. "widget"
  8471. ]
  8472. },
  8473. "widget-position": {
  8474. "requires": [
  8475. "base-build",
  8476. "node-screen",
  8477. "widget"
  8478. ]
  8479. },
  8480. "widget-position-align": {
  8481. "requires": [
  8482. "widget-position"
  8483. ]
  8484. },
  8485. "widget-position-constrain": {
  8486. "requires": [
  8487. "widget-position"
  8488. ]
  8489. },
  8490. "widget-skin": {
  8491. "requires": [
  8492. "widget-base"
  8493. ]
  8494. },
  8495. "widget-stack": {
  8496. "requires": [
  8497. "base-build",
  8498. "widget"
  8499. ],
  8500. "skinnable": true
  8501. },
  8502. "widget-stdmod": {
  8503. "requires": [
  8504. "base-build",
  8505. "widget"
  8506. ]
  8507. },
  8508. "widget-uievents": {
  8509. "requires": [
  8510. "widget-base",
  8511. "node-event-delegate"
  8512. ]
  8513. },
  8514. "yql": {
  8515. "requires": [
  8516. "jsonp",
  8517. "jsonp-url"
  8518. ]
  8519. },
  8520. "yui": {},
  8521. "yui-base": {},
  8522. "yui-later": {
  8523. "requires": [
  8524. "yui-base"
  8525. ]
  8526. },
  8527. "yui-log": {
  8528. "requires": [
  8529. "yui-base"
  8530. ]
  8531. },
  8532. "yui-rls": {},
  8533. "yui-throttle": {
  8534. "requires": [
  8535. "yui-base"
  8536. ]
  8537. }
  8538. };
  8539. YUI.Env[Y.version].md5 = '105ebffae27a0e3d7331f8cf5c0bb282';
  8540. }, '3.4.0' ,{requires:['loader-base']});
  8541. YUI.add('yui', function(Y){}, '3.4.0' ,{use:['yui-base','get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3' ]});