dojo.js 585 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. /*
  7. This is an optimized version of Dojo, built for deployment and not for
  8. development. To get sources and documentation, please visit:
  9. http://dojotoolkit.org
  10. */
  11. (function(
  12. userConfig,
  13. defaultConfig
  14. ){
  15. // summary:
  16. // This is the "source loader" and is the entry point for Dojo during development. You may also load Dojo with
  17. // any AMD-compliant loader via the package main module dojo/main.
  18. // description:
  19. // This is the "source loader" for Dojo. It provides an AMD-compliant loader that can be configured
  20. // to operate in either synchronous or asynchronous modes. After the loader is defined, dojo is loaded
  21. // IAW the package main module dojo/main. In the event you wish to use a foreign loader, you may load dojo as a package
  22. // via the package main module dojo/main and this loader is not required; see dojo/package.json for details.
  23. //
  24. // In order to keep compatibility with the v1.x line, this loader includes additional machinery that enables
  25. // the dojo.provide, dojo.require et al API. This machinery is loaded by default, but may be dynamically removed
  26. // via the has.js API and statically removed via the build system.
  27. //
  28. // This loader includes sniffing machinery to determine the environment; the following environments are supported:
  29. //
  30. // - browser
  31. // - node.js
  32. // - rhino
  33. //
  34. // This is the so-called "source loader". As such, it includes many optional features that may be discadred by
  35. // building a customized verion with the build system.
  36. // Design and Implementation Notes
  37. //
  38. // This is a dojo-specific adaption of bdLoad, donated to the dojo foundation by Altoviso LLC.
  39. //
  40. // This function defines an AMD-compliant (http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition)
  41. // loader that can be configured to operate in either synchronous or asynchronous modes.
  42. //
  43. // Since this machinery implements a loader, it does not have the luxury of using a load system and/or
  44. // leveraging a utility library. This results in an unpleasantly long file; here is a road map of the contents:
  45. //
  46. // 1. Small library for use implementing the loader.
  47. // 2. Define the has.js API; this is used throughout the loader to bracket features.
  48. // 3. Define the node.js and rhino sniffs and sniff.
  49. // 4. Define the loader's data.
  50. // 5. Define the configuration machinery.
  51. // 6. Define the script element sniffing machinery and sniff for configuration data.
  52. // 7. Configure the loader IAW the provided user, default, and sniffing data.
  53. // 8. Define the global require function.
  54. // 9. Define the module resolution machinery.
  55. // 10. Define the module and plugin module definition machinery
  56. // 11. Define the script injection machinery.
  57. // 12. Define the window load detection.
  58. // 13. Define the logging API.
  59. // 14. Define the tracing API.
  60. // 16. Define the AMD define function.
  61. // 17. Define the dojo v1.x provide/require machinery--so called "legacy" modes.
  62. // 18. Publish global variables.
  63. //
  64. // Language and Acronyms and Idioms
  65. //
  66. // moduleId: a CJS module identifier, (used for public APIs)
  67. // mid: moduleId (used internally)
  68. // packageId: a package identifier (used for public APIs)
  69. // pid: packageId (used internally); the implied system or default package has pid===""
  70. // pack: package is used internally to reference a package object (since javascript has reserved words including "package")
  71. // prid: plugin resource identifier
  72. // The integer constant 1 is used in place of true and 0 in place of false.
  73. // define a minimal library to help build the loader
  74. var noop = function(){
  75. },
  76. isEmpty = function(it){
  77. for(var p in it){
  78. return 0;
  79. }
  80. return 1;
  81. },
  82. toString = {}.toString,
  83. isFunction = function(it){
  84. return toString.call(it) == "[object Function]";
  85. },
  86. isString = function(it){
  87. return toString.call(it) == "[object String]";
  88. },
  89. isArray = function(it){
  90. return toString.call(it) == "[object Array]";
  91. },
  92. forEach = function(vector, callback){
  93. if(vector){
  94. for(var i = 0; i < vector.length;){
  95. callback(vector[i++]);
  96. }
  97. }
  98. },
  99. mix = function(dest, src){
  100. for(var p in src){
  101. dest[p] = src[p];
  102. }
  103. return dest;
  104. },
  105. makeError = function(error, info){
  106. return mix(new Error(error), {src:"dojoLoader", info:info});
  107. },
  108. uidSeed = 1,
  109. uid = function(){
  110. // Returns a unique indentifier (within the lifetime of the document) of the form /_d+/.
  111. return "_" + uidSeed++;
  112. },
  113. // FIXME: how to doc window.require() api
  114. // this will be the global require function; define it immediately so we can start hanging things off of it
  115. req = function(
  116. config, //(object, optional) hash of configuration properties
  117. dependencies, //(array of commonjs.moduleId, optional) list of modules to be loaded before applying callback
  118. callback //(function, optional) lamda expression to apply to module values implied by dependencies
  119. ){
  120. return contextRequire(config, dependencies, callback, 0, req);
  121. },
  122. // the loader uses the has.js API to control feature inclusion/exclusion; define then use throughout
  123. global = this,
  124. doc = global.document,
  125. element = doc && doc.createElement("DiV"),
  126. has = req.has = function(name){
  127. return isFunction(hasCache[name]) ? (hasCache[name] = hasCache[name](global, doc, element)) : hasCache[name];
  128. },
  129. hasCache = has.cache = defaultConfig.hasCache;
  130. has.add = function(name, test, now, force){
  131. (hasCache[name]===undefined || force) && (hasCache[name] = test);
  132. return now && has(name);
  133. };
  134. 0 && has.add("host-node", userConfig.has && "host-node" in userConfig.has ?
  135. userConfig.has["host-node"] :
  136. (typeof process == "object" && process.versions && process.versions.node && process.versions.v8));
  137. if( 0 ){
  138. // fixup the default config for node.js environment
  139. require("./_base/configNode.js").config(defaultConfig);
  140. // remember node's require (with respect to baseUrl==dojo's root)
  141. defaultConfig.loaderPatch.nodeRequire = require;
  142. }
  143. 0 && has.add("host-rhino", userConfig.has && "host-rhino" in userConfig.has ?
  144. userConfig.has["host-rhino"] :
  145. (typeof load == "function" && (typeof Packages == "function" || typeof Packages == "object")));
  146. if( 0 ){
  147. // owing to rhino's lame feature that hides the source of the script, give the user a way to specify the baseUrl...
  148. for(var baseUrl = userConfig.baseUrl || ".", arg, rhinoArgs = this.arguments, i = 0; i < rhinoArgs.length;){
  149. arg = (rhinoArgs[i++] + "").split("=");
  150. if(arg[0] == "baseUrl"){
  151. baseUrl = arg[1];
  152. break;
  153. }
  154. }
  155. load(baseUrl + "/_base/configRhino.js");
  156. rhinoDojoConfig(defaultConfig, baseUrl, rhinoArgs);
  157. }
  158. // userConfig has tests override defaultConfig has tests; do this after the environment detection because
  159. // the environment detection usually sets some has feature values in the hasCache.
  160. for(var p in userConfig.has){
  161. has.add(p, userConfig.has[p], 0, 1);
  162. }
  163. //
  164. // define the loader data
  165. //
  166. // the loader will use these like symbols if the loader has the traceApi; otherwise
  167. // define magic numbers so that modules can be provided as part of defaultConfig
  168. var requested = 1,
  169. arrived = 2,
  170. nonmodule = 3,
  171. executing = 4,
  172. executed = 5;
  173. if( 0 ){
  174. // these make debugging nice; but using strings for symbols is a gross rookie error; don't do it for production code
  175. requested = "requested";
  176. arrived = "arrived";
  177. nonmodule = "not-a-module";
  178. executing = "executing";
  179. executed = "executed";
  180. }
  181. var legacyMode = 0,
  182. sync = "sync",
  183. xd = "xd",
  184. syncExecStack = [],
  185. dojoRequirePlugin = 0,
  186. checkDojoRequirePlugin = noop,
  187. transformToAmd = noop,
  188. getXhr;
  189. if( 1 ){
  190. req.isXdUrl = noop;
  191. req.initSyncLoader = function(dojoRequirePlugin_, checkDojoRequirePlugin_, transformToAmd_){
  192. // the first dojo/_base/loader loaded gets to define these variables; they are designed to work
  193. // in the presense of zero to many mapped dojo/_base/loaders
  194. if(!dojoRequirePlugin){
  195. dojoRequirePlugin = dojoRequirePlugin_;
  196. checkDojoRequirePlugin = checkDojoRequirePlugin_;
  197. transformToAmd = transformToAmd_;
  198. }
  199. return {
  200. sync:sync,
  201. requested:requested,
  202. arrived:arrived,
  203. nonmodule:nonmodule,
  204. executing:executing,
  205. executed:executed,
  206. syncExecStack:syncExecStack,
  207. modules:modules,
  208. execQ:execQ,
  209. getModule:getModule,
  210. injectModule:injectModule,
  211. setArrived:setArrived,
  212. signal:signal,
  213. finishExec:finishExec,
  214. execModule:execModule,
  215. dojoRequirePlugin:dojoRequirePlugin,
  216. getLegacyMode:function(){return legacyMode;},
  217. guardCheckComplete:guardCheckComplete
  218. };
  219. };
  220. if( 1 ){
  221. // in legacy sync mode, the loader needs a minimal XHR library
  222. var locationProtocol = location.protocol,
  223. locationHost = location.host;
  224. req.isXdUrl = function(url){
  225. if(/^\./.test(url)){
  226. // begins with a dot is always relative to page URL; therefore not xdomain
  227. return false;
  228. }
  229. if(/^\/\//.test(url)){
  230. // for v1.6- backcompat, url starting with // indicates xdomain
  231. return true;
  232. }
  233. // get protocol and host
  234. // \/+ takes care of the typical file protocol that looks like file:///drive/path/to/file
  235. // locationHost is falsy if file protocol => if locationProtocol matches and is "file:", || will return false
  236. var match = url.match(/^([^\/\:]+\:)\/+([^\/]+)/);
  237. return match && (match[1] != locationProtocol || (locationHost && match[2] != locationHost));
  238. };
  239. // note: to get the file:// protocol to work in FF, you must set security.fileuri.strict_origin_policy to false in about:config
  240. 1 || has.add("dojo-xhr-factory", 1);
  241. has.add("dojo-force-activex-xhr", 1 && !doc.addEventListener && window.location.protocol == "file:");
  242. has.add("native-xhr", typeof XMLHttpRequest != "undefined");
  243. if(has("native-xhr") && !has("dojo-force-activex-xhr")){
  244. getXhr = function(){
  245. return new XMLHttpRequest();
  246. };
  247. }else{
  248. // if in the browser an old IE; find an xhr
  249. for(var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], progid, i = 0; i < 3;){
  250. try{
  251. progid = XMLHTTP_PROGIDS[i++];
  252. if(new ActiveXObject(progid)){
  253. // this progid works; therefore, use it from now on
  254. break;
  255. }
  256. }catch(e){
  257. // squelch; we're just trying to find a good ActiveX progid
  258. // if they all fail, then progid ends up as the last attempt and that will signal the error
  259. // the first time the client actually tries to exec an xhr
  260. }
  261. }
  262. getXhr = function(){
  263. return new ActiveXObject(progid);
  264. };
  265. }
  266. req.getXhr = getXhr;
  267. has.add("dojo-gettext-api", 1);
  268. req.getText = function(url, async, onLoad){
  269. var xhr = getXhr();
  270. xhr.open('GET', fixupUrl(url), false);
  271. xhr.send(null);
  272. if(xhr.status == 200 || (!location.host && !xhr.status)){
  273. if(onLoad){
  274. onLoad(xhr.responseText, async);
  275. }
  276. }else{
  277. throw makeError("xhrFailed", xhr.status);
  278. }
  279. return xhr.responseText;
  280. };
  281. }
  282. }else{
  283. req.async = 1;
  284. }
  285. //
  286. // loader eval
  287. //
  288. var eval_ =
  289. // use the function constructor so our eval is scoped close to (but not in) in the global space with minimal pollution
  290. new Function('return eval(arguments[0]);');
  291. req.eval =
  292. function(text, hint){
  293. return eval_(text + "\r\n////@ sourceURL=" + hint);
  294. };
  295. //
  296. // loader micro events API
  297. //
  298. var listenerQueues = {},
  299. error = "error",
  300. signal = req.signal = function(type, args){
  301. var queue = listenerQueues[type];
  302. // notice we run a copy of the queue; this allows listeners to add/remove
  303. // other listeners without affecting this particular signal
  304. forEach(queue && queue.slice(0), function(listener){
  305. listener.apply(null, isArray(args) ? args : [args]);
  306. });
  307. },
  308. on = req.on = function(type, listener){
  309. // notice a queue is not created until a client actually connects
  310. var queue = listenerQueues[type] || (listenerQueues[type] = []);
  311. queue.push(listener);
  312. return {
  313. remove:function(){
  314. for(var i = 0; i<queue.length; i++){
  315. if(queue[i]===listener){
  316. queue.splice(i, 1);
  317. return;
  318. }
  319. }
  320. }
  321. };
  322. };
  323. // configuration machinery; with an optimized/built defaultConfig, all configuration machinery can be discarded
  324. // lexical variables hold key loader data structures to help with minification; these may be completely,
  325. // one-time initialized by defaultConfig for optimized/built versions
  326. var
  327. aliases
  328. // a vector of pairs of [regexs or string, replacement] => (alias, actual)
  329. = [],
  330. paths
  331. // CommonJS paths
  332. = {},
  333. pathsMapProg
  334. // list of (from-path, to-path, regex, length) derived from paths;
  335. // a "program" to apply paths; see computeMapProg
  336. = [],
  337. packs
  338. // a map from packageId to package configuration object; see fixupPackageInfo
  339. = {},
  340. map = req.map
  341. // AMD map config variable; dojo/_base/kernel needs req.map to figure out the scope map
  342. = {},
  343. mapProgs
  344. // vector of quads as described by computeMapProg; map-key is AMD map key, map-value is AMD map value
  345. = [],
  346. modules
  347. // A hash:(mid) --> (module-object) the module namespace
  348. //
  349. // pid: the package identifier to which the module belongs (e.g., "dojo"); "" indicates the system or default package
  350. // mid: the fully-resolved (i.e., mappings have been applied) module identifier without the package identifier (e.g., "dojo/io/script")
  351. // url: the URL from which the module was retrieved
  352. // pack: the package object of the package to which the module belongs
  353. // executed: 0 => not executed; executing => in the process of tranversing deps and running factory; executed => factory has been executed
  354. // deps: the dependency vector for this module (vector of modules objects)
  355. // def: the factory for this module
  356. // result: the result of the running the factory for this module
  357. // injected: (0 | requested | arrived) the status of the module; nonmodule means the resource did not call define
  358. // load: plugin load function; applicable only for plugins
  359. //
  360. // Modules go through several phases in creation:
  361. //
  362. // 1. Requested: some other module's definition or a require application contained the requested module in
  363. // its dependency vector or executing code explicitly demands a module via req.require.
  364. //
  365. // 2. Injected: a script element has been appended to the insert-point element demanding the resource implied by the URL
  366. //
  367. // 3. Loaded: the resource injected in [2] has been evalated.
  368. //
  369. // 4. Defined: the resource contained a define statement that advised the loader about the module. Notice that some
  370. // resources may just contain a bundle of code and never formally define a module via define
  371. //
  372. // 5. Evaluated: the module was defined via define and the loader has evaluated the factory and computed a result.
  373. = {},
  374. cacheBust
  375. // query string to append to module URLs to bust browser cache
  376. = "",
  377. cache
  378. // hash:(mid | url)-->(function | string)
  379. //
  380. // A cache of resources. The resources arrive via a config.cache object, which is a hash from either mid --> function or
  381. // url --> string. The url key is distinguished from the mid key by always containing the prefix "url:". url keys as provided
  382. // by config.cache always have a string value that represents the contents of the resource at the given url. mid keys as provided
  383. // by configl.cache always have a function value that causes the same code to execute as if the module was script injected.
  384. //
  385. // Both kinds of key-value pairs are entered into cache via the function consumePendingCache, which may relocate keys as given
  386. // by any mappings *iff* the config.cache was received as part of a module resource request.
  387. //
  388. // Further, for mid keys, the implied url is computed and the value is entered into that key as well. This allows mapped modules
  389. // to retrieve cached items that may have arrived consequent to another namespace.
  390. //
  391. = {},
  392. urlKeyPrefix
  393. // the prefix to prepend to a URL key in the cache.
  394. = "url:",
  395. pendingCacheInsert
  396. // hash:(mid)-->(function)
  397. //
  398. // Gives a set of cache modules pending entry into cache. When cached modules are published to the loader, they are
  399. // entered into pendingCacheInsert; modules are then pressed into cache upon (1) AMD define or (2) upon receiving another
  400. // independent set of cached modules. (1) is the usual case, and this case allows normalizing mids given in the pending
  401. // cache for the local configuration, possibly relocating modules.
  402. = {},
  403. dojoSniffConfig
  404. // map of configuration variables
  405. // give the data-dojo-config as sniffed from the document (if any)
  406. = {};
  407. if( 1 ){
  408. var consumePendingCacheInsert = function(referenceModule){
  409. var p, item, match, now, m;
  410. for(p in pendingCacheInsert){
  411. item = pendingCacheInsert[p];
  412. match = p.match(/^url\:(.+)/);
  413. if(match){
  414. cache[urlKeyPrefix + toUrl(match[1], referenceModule)] = item;
  415. }else if(p=="*now"){
  416. now = item;
  417. }else if(p!="*noref"){
  418. m = getModuleInfo(p, referenceModule);
  419. cache[m.mid] = cache[urlKeyPrefix + m.url] = item;
  420. }
  421. }
  422. if(now){
  423. now(createRequire(referenceModule));
  424. }
  425. pendingCacheInsert = {};
  426. },
  427. escapeString = function(s){
  428. return s.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(c){ return "\\" + c; });
  429. },
  430. computeMapProg = function(map, dest){
  431. // This routine takes a map as represented by a JavaScript object and initializes dest, a vector of
  432. // quads of (map-key, map-value, refex-for-map-key, length-of-map-key), sorted decreasing by length-
  433. // of-map-key. The regex looks for the map-key followed by either "/" or end-of-string at the beginning
  434. // of a the search source. Notice the map-value is irrelevent to the algorithm
  435. dest.splice(0, dest.length);
  436. for(var p in map){
  437. dest.push([
  438. p,
  439. map[p],
  440. new RegExp("^" + escapeString(p) + "(\/|$)"),
  441. p.length]);
  442. }
  443. dest.sort(function(lhs, rhs){ return rhs[3] - lhs[3]; });
  444. return dest;
  445. },
  446. fixupPackageInfo = function(packageInfo){
  447. // calculate the precise (name, location, main, mappings) for a package
  448. var name = packageInfo.name;
  449. if(!name){
  450. // packageInfo must be a string that gives the name
  451. name = packageInfo;
  452. packageInfo = {name:name};
  453. }
  454. packageInfo = mix({main:"main"}, packageInfo);
  455. packageInfo.location = packageInfo.location ? packageInfo.location : name;
  456. // packageMap is depricated in favor of AMD map
  457. if(packageInfo.packageMap){
  458. map[name] = packageInfo.packageMap;
  459. }
  460. if(!packageInfo.main.indexOf("./")){
  461. packageInfo.main = packageInfo.main.substring(2);
  462. }
  463. // now that we've got a fully-resolved package object, push it into the configuration
  464. packs[name] = packageInfo;
  465. },
  466. delayedModuleConfig
  467. // module config cannot be consummed until the loader is completely initialized; therefore, all
  468. // module config detected during booting is memorized and applied at the end of loader initialization
  469. // TODO: this is a bit of a kludge; all config should be moved to end of loader initialization, but
  470. // we'll delay this chore and do it with a final loader 1.x cleanup after the 2.x loader prototyping is complete
  471. = [],
  472. config = function(config, booting, referenceModule){
  473. for(var p in config){
  474. if(p=="waitSeconds"){
  475. req.waitms = (config[p] || 0) * 1000;
  476. }
  477. if(p=="cacheBust"){
  478. cacheBust = config[p] ? (isString(config[p]) ? config[p] : (new Date()).getTime() + "") : "";
  479. }
  480. if(p=="baseUrl" || p=="combo"){
  481. req[p] = config[p];
  482. }
  483. if( 1 && p=="async"){
  484. // falsy or "sync" => legacy sync loader
  485. // "xd" => sync but loading xdomain tree and therefore loading asynchronously (not configurable, set automatically by the loader)
  486. // "legacyAsync" => permanently in "xd" by choice
  487. // "debugAtAllCosts" => trying to load everything via script injection (not implemented)
  488. // otherwise, must be truthy => AMD
  489. // legacyMode: sync | legacyAsync | xd | false
  490. var mode = config[p];
  491. req.legacyMode = legacyMode = (isString(mode) && /sync|legacyAsync/.test(mode) ? mode : (!mode ? sync : false));
  492. req.async = !legacyMode;
  493. }
  494. if(config[p]!==hasCache){
  495. // accumulate raw config info for client apps which can use this to pass their own config
  496. req.rawConfig[p] = config[p];
  497. p!="has" && has.add("config-"+p, config[p], 0, booting);
  498. }
  499. }
  500. // make sure baseUrl exists
  501. if(!req.baseUrl){
  502. req.baseUrl = "./";
  503. }
  504. // make sure baseUrl ends with a slash
  505. if(!/\/$/.test(req.baseUrl)){
  506. req.baseUrl += "/";
  507. }
  508. // now do the special work for has, packages, packagePaths, paths, aliases, and cache
  509. for(p in config.has){
  510. has.add(p, config.has[p], 0, booting);
  511. }
  512. // for each package found in any packages config item, augment the packs map owned by the loader
  513. forEach(config.packages, fixupPackageInfo);
  514. // for each packagePath found in any packagePaths config item, augment the packageConfig
  515. // packagePaths is depricated; remove in 2.0
  516. for(baseUrl in config.packagePaths){
  517. forEach(config.packagePaths[baseUrl], function(packageInfo){
  518. var location = baseUrl + "/" + packageInfo;
  519. if(isString(packageInfo)){
  520. packageInfo = {name:packageInfo};
  521. }
  522. packageInfo.location = location;
  523. fixupPackageInfo(packageInfo);
  524. });
  525. }
  526. // notice that computeMapProg treats the dest as a reference; therefore, if/when that variable
  527. // is published (see dojo-publish-privates), the published variable will always hold a valid value.
  528. // this must come after all package processing since package processing may mutate map
  529. computeMapProg(mix(map, config.map), mapProgs);
  530. forEach(mapProgs, function(item){
  531. item[1] = computeMapProg(item[1], []);
  532. if(item[0]=="*"){
  533. mapProgs.star = item[1];
  534. }
  535. });
  536. // push in any paths and recompute the internal pathmap
  537. computeMapProg(mix(paths, config.paths), pathsMapProg);
  538. // aliases
  539. forEach(config.aliases, function(pair){
  540. if(isString(pair[0])){
  541. pair[0] = new RegExp("^" + escapeString(pair[0]) + "$");
  542. }
  543. aliases.push(pair);
  544. });
  545. if(booting){
  546. delayedModuleConfig.push({config:config.config});
  547. }else{
  548. for(p in config.config){
  549. var module = getModule(p, referenceModule);
  550. module.config = mix(module.config || {}, config.config[p]);
  551. }
  552. }
  553. // push in any new cache values
  554. if(config.cache){
  555. consumePendingCacheInsert();
  556. pendingCacheInsert = config.cache;
  557. if(config.cache["*noref"]){
  558. consumePendingCacheInsert();
  559. }
  560. }
  561. signal("config", [config, req.rawConfig]);
  562. };
  563. //
  564. // execute the various sniffs; userConfig can override and value
  565. //
  566. if(has("dojo-cdn") || 1 ){
  567. // the sniff regex looks for a src attribute ending in dojo.js, optionally preceeded with a path.
  568. // match[3] returns the path to dojo.js (if any) without the trailing slash. This is used for the
  569. // dojo location on CDN deployments and baseUrl when either/both of these are not provided
  570. // explicitly in the config data; this is the 1.6- behavior.
  571. var scripts = doc.getElementsByTagName("script"),
  572. i = 0,
  573. script, dojoDir, src, match;
  574. while(i < scripts.length){
  575. script = scripts[i++];
  576. if((src = script.getAttribute("src")) && (match = src.match(/(((.*)\/)|^)dojo\.js(\W|$)/i))){
  577. // sniff dojoDir and baseUrl
  578. dojoDir = match[3] || "";
  579. defaultConfig.baseUrl = defaultConfig.baseUrl || dojoDir;
  580. // sniff configuration on attribute in script element
  581. src = (script.getAttribute("data-dojo-config") || script.getAttribute("djConfig"));
  582. if(src){
  583. dojoSniffConfig = req.eval("({ " + src + " })", "data-dojo-config");
  584. }
  585. // sniff requirejs attribute
  586. if( 0 ){
  587. var dataMain = script.getAttribute("data-main");
  588. if(dataMain){
  589. dojoSniffConfig.deps = dojoSniffConfig.deps || [dataMain];
  590. }
  591. }
  592. break;
  593. }
  594. }
  595. }
  596. if( 0 ){
  597. // pass down doh.testConfig from parent as if it were a data-dojo-config
  598. try{
  599. if(window.parent != window && window.parent.require){
  600. var doh = window.parent.require("doh");
  601. doh && mix(dojoSniffConfig, doh.testConfig);
  602. }
  603. }catch(e){}
  604. }
  605. // configure the loader; let the user override defaults
  606. req.rawConfig = {};
  607. config(defaultConfig, 1);
  608. // do this before setting userConfig/sniffConfig to allow userConfig/sniff overrides
  609. if(has("dojo-cdn")){
  610. packs.dojo.location = dojoDir;
  611. if(dojoDir){
  612. dojoDir += "/";
  613. }
  614. packs.dijit.location = dojoDir + "../dijit/";
  615. packs.dojox.location = dojoDir + "../dojox/";
  616. }
  617. config(userConfig, 1);
  618. config(dojoSniffConfig, 1);
  619. }else{
  620. // no config API, assume defaultConfig has everything the loader needs...for the entire lifetime of the application
  621. paths = defaultConfig.paths;
  622. pathsMapProg = defaultConfig.pathsMapProg;
  623. packs = defaultConfig.packs;
  624. aliases = defaultConfig.aliases;
  625. mapProgs = defaultConfig.mapProgs;
  626. modules = defaultConfig.modules;
  627. cache = defaultConfig.cache;
  628. cacheBust = defaultConfig.cacheBust;
  629. // remember the default config for other processes (e.g., dojo/config)
  630. req.rawConfig = defaultConfig;
  631. }
  632. if( 0 ){
  633. req.combo = req.combo || {add:noop};
  634. var comboPending = 0,
  635. combosPending = [],
  636. comboPendingTimer = null;
  637. }
  638. // build the loader machinery iaw configuration, including has feature tests
  639. var injectDependencies = function(module){
  640. // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies
  641. guardCheckComplete(function(){
  642. forEach(module.deps, injectModule);
  643. if( 0 && comboPending && !comboPendingTimer){
  644. comboPendingTimer = setTimeout(function() {
  645. comboPending = 0;
  646. comboPendingTimer = null;
  647. req.combo.done(function(mids, url) {
  648. var onLoadCallback= function(){
  649. // defQ is a vector of module definitions 1-to-1, onto mids
  650. runDefQ(0, mids);
  651. checkComplete();
  652. };
  653. combosPending.push(mids);
  654. injectingModule = mids;
  655. req.injectUrl(url, onLoadCallback, mids);
  656. injectingModule = 0;
  657. }, req);
  658. }, 0);
  659. }
  660. });
  661. },
  662. contextRequire = function(a1, a2, a3, referenceModule, contextRequire){
  663. var module, syntheticMid;
  664. if(isString(a1)){
  665. // signature is (moduleId)
  666. module = getModule(a1, referenceModule, true);
  667. if(module && module.executed){
  668. return module.result;
  669. }
  670. throw makeError("undefinedModule", a1);
  671. }
  672. if(!isArray(a1)){
  673. // a1 is a configuration
  674. config(a1, 0, referenceModule);
  675. // juggle args; (a2, a3) may be (dependencies, callback)
  676. a1 = a2;
  677. a2 = a3;
  678. }
  679. if(isArray(a1)){
  680. // signature is (requestList [,callback])
  681. if(!a1.length){
  682. a2 && a2();
  683. }else{
  684. syntheticMid = "require*" + uid();
  685. // resolve the request list with respect to the reference module
  686. for(var mid, deps = [], i = 0; i < a1.length;){
  687. mid = a1[i++];
  688. deps.push(getModule(mid, referenceModule));
  689. }
  690. // construct a synthetic module to control execution of the requestList, and, optionally, callback
  691. module = mix(makeModuleInfo("", syntheticMid, 0, ""), {
  692. injected: arrived,
  693. deps: deps,
  694. def: a2 || noop,
  695. require: referenceModule ? referenceModule.require : req,
  696. gc: 1 //garbage collect
  697. });
  698. modules[module.mid] = module;
  699. // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies
  700. injectDependencies(module);
  701. // try to immediately execute
  702. // if already traversing a factory tree, then strict causes circular dependency to abort the execution; maybe
  703. // it's possible to execute this require later after the current traversal completes and avoid the circular dependency.
  704. // ...but *always* insist on immediate in synch mode
  705. var strict = checkCompleteGuard && legacyMode!=sync;
  706. guardCheckComplete(function(){
  707. execModule(module, strict);
  708. });
  709. if(!module.executed){
  710. // some deps weren't on board or circular dependency detected and strict; therefore, push into the execQ
  711. execQ.push(module);
  712. }
  713. checkComplete();
  714. }
  715. }
  716. return contextRequire;
  717. },
  718. createRequire = function(module){
  719. if(!module){
  720. return req;
  721. }
  722. var result = module.require;
  723. if(!result){
  724. result = function(a1, a2, a3){
  725. return contextRequire(a1, a2, a3, module, result);
  726. };
  727. module.require = mix(result, req);
  728. result.module = module;
  729. result.toUrl = function(name){
  730. return toUrl(name, module);
  731. };
  732. result.toAbsMid = function(mid){
  733. return toAbsMid(mid, module);
  734. };
  735. if( 0 ){
  736. result.undef = function(mid){
  737. req.undef(mid, module);
  738. };
  739. }
  740. if( 1 ){
  741. result.syncLoadNls = function(mid){
  742. var nlsModuleInfo = getModuleInfo(mid, module),
  743. nlsModule = modules[nlsModuleInfo.mid];
  744. if(!nlsModule || !nlsModule.executed){
  745. cached = cache[nlsModuleInfo.mid] || cache[urlKeyPrefix + nlsModuleInfo.url];
  746. if(cached){
  747. evalModuleText(cached);
  748. nlsModule = modules[nlsModuleInfo.mid];
  749. }
  750. }
  751. return nlsModule && nlsModule.executed && nlsModule.result;
  752. };
  753. }
  754. }
  755. return result;
  756. },
  757. execQ =
  758. // The list of modules that need to be evaluated.
  759. [],
  760. defQ =
  761. // The queue of define arguments sent to loader.
  762. [],
  763. waiting =
  764. // The set of modules upon which the loader is waiting for definition to arrive
  765. {},
  766. setRequested = function(module){
  767. module.injected = requested;
  768. waiting[module.mid] = 1;
  769. if(module.url){
  770. waiting[module.url] = module.pack || 1;
  771. }
  772. startTimer();
  773. },
  774. setArrived = function(module){
  775. module.injected = arrived;
  776. delete waiting[module.mid];
  777. if(module.url){
  778. delete waiting[module.url];
  779. }
  780. if(isEmpty(waiting)){
  781. clearTimer();
  782. 1 && legacyMode==xd && (legacyMode = sync);
  783. }
  784. },
  785. execComplete = req.idle =
  786. // says the loader has completed (or not) its work
  787. function(){
  788. return !defQ.length && isEmpty(waiting) && !execQ.length && !checkCompleteGuard;
  789. },
  790. runMapProg = function(targetMid, map){
  791. // search for targetMid in map; return the map item if found; falsy otherwise
  792. if(map){
  793. for(var i = 0; i < map.length; i++){
  794. if(map[i][2].test(targetMid)){
  795. return map[i];
  796. }
  797. }
  798. }
  799. return 0;
  800. },
  801. compactPath = function(path){
  802. var result = [],
  803. segment, lastSegment;
  804. path = path.replace(/\\/g, '/').split('/');
  805. while(path.length){
  806. segment = path.shift();
  807. if(segment==".." && result.length && lastSegment!=".."){
  808. result.pop();
  809. lastSegment = result[result.length - 1];
  810. }else if(segment!="."){
  811. result.push(lastSegment= segment);
  812. } // else ignore "."
  813. }
  814. return result.join("/");
  815. },
  816. makeModuleInfo = function(pid, mid, pack, url){
  817. if( 1 ){
  818. var xd= req.isXdUrl(url);
  819. return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0, isXd:xd, isAmd:!!(xd || (packs[pid] && packs[pid].isAmd))};
  820. }else{
  821. return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0};
  822. }
  823. },
  824. getModuleInfo_ = function(mid, referenceModule, packs, modules, baseUrl, mapProgs, pathsMapProg, alwaysCreate){
  825. // arguments are passed instead of using lexical variables so that this function my be used independent of the loader (e.g., the builder)
  826. // alwaysCreate is useful in this case so that getModuleInfo never returns references to real modules owned by the loader
  827. var pid, pack, midInPackage, mapProg, mapItem, url, result, isRelative, requestedMid;
  828. requestedMid = mid;
  829. isRelative = /^\./.test(mid);
  830. if(/(^\/)|(\:)|(\.js$)/.test(mid) || (isRelative && !referenceModule)){
  831. // absolute path or protocol of .js filetype, or relative path but no reference module and therefore relative to page
  832. // whatever it is, it's not a module but just a URL of some sort
  833. // note: pid===0 indicates the routine is returning an unmodified mid
  834. return makeModuleInfo(0, mid, 0, mid);
  835. }else{
  836. // relative module ids are relative to the referenceModule; get rid of any dots
  837. mid = compactPath(isRelative ? (referenceModule.mid + "/../" + mid) : mid);
  838. if(/^\./.test(mid)){
  839. throw makeError("irrationalPath", mid);
  840. }
  841. // at this point, mid is an absolute mid
  842. // map the mid
  843. if(referenceModule){
  844. mapItem = runMapProg(referenceModule.mid, mapProgs);
  845. }
  846. mapItem = mapItem || mapProgs.star;
  847. mapItem = mapItem && runMapProg(mid, mapItem[1]);
  848. if(mapItem){
  849. mid = mapItem[1] + mid.substring(mapItem[3]);
  850. }
  851. match = mid.match(/^([^\/]+)(\/(.+))?$/);
  852. pid = match ? match[1] : "";
  853. if((pack = packs[pid])){
  854. mid = pid + "/" + (midInPackage = (match[3] || pack.main));
  855. }else{
  856. pid = "";
  857. }
  858. // search aliases
  859. var candidateLength = 0,
  860. candidate = 0;
  861. forEach(aliases, function(pair){
  862. var match = mid.match(pair[0]);
  863. if(match && match.length>candidateLength){
  864. candidate = isFunction(pair[1]) ? mid.replace(pair[0], pair[1]) : pair[1];
  865. }
  866. });
  867. if(candidate){
  868. return getModuleInfo_(candidate, 0, packs, modules, baseUrl, mapProgs, pathsMapProg, alwaysCreate);
  869. }
  870. result = modules[mid];
  871. if(result){
  872. return alwaysCreate ? makeModuleInfo(result.pid, result.mid, result.pack, result.url) : modules[mid];
  873. }
  874. }
  875. // get here iff the sought-after module does not yet exist; therefore, we need to compute the URL given the
  876. // fully resolved (i.e., all relative indicators and package mapping resolved) module id
  877. // note: pid!==0 indicates the routine is returning a url that has .js appended unmodified mid
  878. mapItem = runMapProg(mid, pathsMapProg);
  879. if(mapItem){
  880. url = mapItem[1] + mid.substring(mapItem[3]);
  881. }else if(pid){
  882. url = pack.location + "/" + midInPackage;
  883. }else if(has("config-tlmSiblingOfDojo")){
  884. url = "../" + mid;
  885. }else{
  886. url = mid;
  887. }
  888. // if result is not absolute, add baseUrl
  889. if(!(/(^\/)|(\:)/.test(url))){
  890. url = baseUrl + url;
  891. }
  892. url += ".js";
  893. return makeModuleInfo(pid, mid, pack, compactPath(url));
  894. },
  895. getModuleInfo = function(mid, referenceModule){
  896. return getModuleInfo_(mid, referenceModule, packs, modules, req.baseUrl, mapProgs, pathsMapProg);
  897. },
  898. resolvePluginResourceId = function(plugin, prid, referenceModule){
  899. return plugin.normalize ? plugin.normalize(prid, function(mid){return toAbsMid(mid, referenceModule);}) : toAbsMid(prid, referenceModule);
  900. },
  901. dynamicPluginUidGenerator = 0,
  902. getModule = function(mid, referenceModule, immediate){
  903. // compute and optionally construct (if necessary) the module implied by the mid with respect to referenceModule
  904. var match, plugin, prid, result;
  905. match = mid.match(/^(.+?)\!(.*)$/);
  906. if(match){
  907. // name was <plugin-module>!<plugin-resource-id>
  908. plugin = getModule(match[1], referenceModule, immediate);
  909. if( 1 && legacyMode == sync && !plugin.executed){
  910. injectModule(plugin);
  911. if(plugin.injected===arrived && !plugin.executed){
  912. guardCheckComplete(function(){
  913. execModule(plugin);
  914. });
  915. }
  916. if(plugin.executed){
  917. promoteModuleToPlugin(plugin);
  918. }else{
  919. // we are in xdomain mode for some reason
  920. execQ.unshift(plugin);
  921. }
  922. }
  923. if(plugin.executed === executed && !plugin.load){
  924. // executed the module not knowing it was a plugin
  925. promoteModuleToPlugin(plugin);
  926. }
  927. // if the plugin has not been loaded, then can't resolve the prid and must assume this plugin is dynamic until we find out otherwise
  928. if(plugin.load){
  929. prid = resolvePluginResourceId(plugin, match[2], referenceModule);
  930. mid = (plugin.mid + "!" + (plugin.dynamic ? ++dynamicPluginUidGenerator + "!" : "") + prid);
  931. }else{
  932. prid = match[2];
  933. mid = plugin.mid + "!" + (++dynamicPluginUidGenerator) + "!waitingForPlugin";
  934. }
  935. result = {plugin:plugin, mid:mid, req:createRequire(referenceModule), prid:prid};
  936. }else{
  937. result = getModuleInfo(mid, referenceModule);
  938. }
  939. return modules[result.mid] || (!immediate && (modules[result.mid] = result));
  940. },
  941. toAbsMid = req.toAbsMid = function(mid, referenceModule){
  942. return getModuleInfo(mid, referenceModule).mid;
  943. },
  944. toUrl = req.toUrl = function(name, referenceModule){
  945. var moduleInfo = getModuleInfo(name+"/x", referenceModule),
  946. url= moduleInfo.url;
  947. return fixupUrl(moduleInfo.pid===0 ?
  948. // if pid===0, then name had a protocol or absolute path; either way, toUrl is the identify function in such cases
  949. name :
  950. // "/x.js" since getModuleInfo automatically appends ".js" and we appended "/x" to make name look likde a module id
  951. url.substring(0, url.length-5)
  952. );
  953. },
  954. nonModuleProps = {
  955. injected: arrived,
  956. executed: executed,
  957. def: nonmodule,
  958. result: nonmodule
  959. },
  960. makeCjs = function(mid){
  961. return modules[mid] = mix({mid:mid}, nonModuleProps);
  962. },
  963. cjsRequireModule = makeCjs("require"),
  964. cjsExportsModule = makeCjs("exports"),
  965. cjsModuleModule = makeCjs("module"),
  966. runFactory = function(module, args){
  967. req.trace("loader-run-factory", [module.mid]);
  968. var factory = module.def,
  969. result;
  970. 1 && syncExecStack.unshift(module);
  971. if(has("config-dojo-loader-catches")){
  972. try{
  973. result= isFunction(factory) ? factory.apply(null, args) : factory;
  974. }catch(e){
  975. signal(error, module.result = makeError("factoryThrew", [module, e]));
  976. }
  977. }else{
  978. result= isFunction(factory) ? factory.apply(null, args) : factory;
  979. }
  980. module.result = result===undefined && module.cjs ? module.cjs.exports : result;
  981. 1 && syncExecStack.shift(module);
  982. },
  983. abortExec = {},
  984. defOrder = 0,
  985. promoteModuleToPlugin = function(pluginModule){
  986. var plugin = pluginModule.result;
  987. pluginModule.dynamic = plugin.dynamic;
  988. pluginModule.normalize = plugin.normalize;
  989. pluginModule.load = plugin.load;
  990. return pluginModule;
  991. },
  992. resolvePluginLoadQ = function(plugin){
  993. // plugins is a newly executed module that has a loadQ waiting to run
  994. // step 1: traverse the loadQ and fixup the mid and prid; remember the map from original mid to new mid
  995. // recall the original mid was created before the plugin was on board and therefore it was impossible to
  996. // compute the final mid; accordingly, prid may or may not change, but the mid will definitely change
  997. var map = {};
  998. forEach(plugin.loadQ, function(pseudoPluginResource){
  999. // manufacture and insert the real module in modules
  1000. var prid = resolvePluginResourceId(plugin, pseudoPluginResource.prid, pseudoPluginResource.req.module),
  1001. mid = plugin.dynamic ? pseudoPluginResource.mid.replace(/waitingForPlugin$/, prid) : (plugin.mid + "!" + prid),
  1002. pluginResource = mix(mix({}, pseudoPluginResource), {mid:mid, prid:prid, injected:0});
  1003. if(!modules[mid]){
  1004. // create a new (the real) plugin resource and inject it normally now that the plugin is on board
  1005. injectPlugin(modules[mid] = pluginResource);
  1006. } // else this was a duplicate request for the same (plugin, rid) for a nondynamic plugin
  1007. // pluginResource is really just a placeholder with the wrong mid (because we couldn't calculate it until the plugin was on board)
  1008. // mark is as arrived and delete it from modules; the real module was requested above
  1009. map[pseudoPluginResource.mid] = modules[mid];
  1010. setArrived(pseudoPluginResource);
  1011. delete modules[pseudoPluginResource.mid];
  1012. });
  1013. plugin.loadQ = 0;
  1014. // step2: replace all references to any placeholder modules with real modules
  1015. var substituteModules = function(module){
  1016. for(var replacement, deps = module.deps || [], i = 0; i<deps.length; i++){
  1017. replacement = map[deps[i].mid];
  1018. if(replacement){
  1019. deps[i] = replacement;
  1020. }
  1021. }
  1022. };
  1023. for(var p in modules){
  1024. substituteModules(modules[p]);
  1025. }
  1026. forEach(execQ, substituteModules);
  1027. },
  1028. finishExec = function(module){
  1029. req.trace("loader-finish-exec", [module.mid]);
  1030. module.executed = executed;
  1031. module.defOrder = defOrder++;
  1032. 1 && forEach(module.provides, function(cb){ cb(); });
  1033. if(module.loadQ){
  1034. // the module was a plugin
  1035. promoteModuleToPlugin(module);
  1036. resolvePluginLoadQ(module);
  1037. }
  1038. // remove all occurences of this module from the execQ
  1039. for(i = 0; i < execQ.length;){
  1040. if(execQ[i] === module){
  1041. execQ.splice(i, 1);
  1042. }else{
  1043. i++;
  1044. }
  1045. }
  1046. // delete references to synthetic modules
  1047. if (/^require\*/.test(module.mid)) {
  1048. delete modules[module.mid];
  1049. }
  1050. },
  1051. circleTrace = [],
  1052. execModule = function(module, strict){
  1053. // run the dependency vector, then run the factory for module
  1054. if(module.executed === executing){
  1055. req.trace("loader-circular-dependency", [circleTrace.concat(module.mid).join("->")]);
  1056. return (!module.def || strict) ? abortExec : (module.cjs && module.cjs.exports);
  1057. }
  1058. // at this point the module is either not executed or fully executed
  1059. if(!module.executed){
  1060. if(!module.def){
  1061. return abortExec;
  1062. }
  1063. var mid = module.mid,
  1064. deps = module.deps || [],
  1065. arg, argResult,
  1066. args = [],
  1067. i = 0;
  1068. if( 0 ){
  1069. circleTrace.push(mid);
  1070. req.trace("loader-exec-module", ["exec", circleTrace.length, mid]);
  1071. }
  1072. // for circular dependencies, assume the first module encountered was executed OK
  1073. // modules that circularly depend on a module that has not run its factory will get
  1074. // the premade cjs.exports===module.result. They can take a reference to this object and/or
  1075. // add properties to it. When the module finally runs its factory, the factory can
  1076. // read/write/replace this object. Notice that so long as the object isn't replaced, any
  1077. // reference taken earlier while walking the deps list is still valid.
  1078. module.executed = executing;
  1079. while(i < deps.length){
  1080. arg = deps[i++];
  1081. argResult = ((arg === cjsRequireModule) ? createRequire(module) :
  1082. ((arg === cjsExportsModule) ? module.cjs.exports :
  1083. ((arg === cjsModuleModule) ? module.cjs :
  1084. execModule(arg, strict))));
  1085. if(argResult === abortExec){
  1086. module.executed = 0;
  1087. req.trace("loader-exec-module", ["abort", mid]);
  1088. 0 && circleTrace.pop();
  1089. return abortExec;
  1090. }
  1091. args.push(argResult);
  1092. }
  1093. runFactory(module, args);
  1094. finishExec(module);
  1095. 0 && circleTrace.pop();
  1096. }
  1097. // at this point the module is guaranteed fully executed
  1098. return module.result;
  1099. },
  1100. checkCompleteGuard = 0,
  1101. guardCheckComplete = function(proc){
  1102. try{
  1103. checkCompleteGuard++;
  1104. proc();
  1105. }finally{
  1106. checkCompleteGuard--;
  1107. }
  1108. if(execComplete()){
  1109. signal("idle", []);
  1110. }
  1111. },
  1112. checkComplete = function(){
  1113. // keep going through the execQ as long as at least one factory is executed
  1114. // plugins, recursion, cached modules all make for many execution path possibilities
  1115. if(checkCompleteGuard){
  1116. return;
  1117. }
  1118. guardCheckComplete(function(){
  1119. checkDojoRequirePlugin();
  1120. for(var currentDefOrder, module, i = 0; i < execQ.length;){
  1121. currentDefOrder = defOrder;
  1122. module = execQ[i];
  1123. execModule(module);
  1124. if(currentDefOrder!=defOrder){
  1125. // defOrder was bumped one or more times indicating something was executed (note, this indicates
  1126. // the execQ was modified, maybe a lot (for example a later module causes an earlier module to execute)
  1127. checkDojoRequirePlugin();
  1128. i = 0;
  1129. }else{
  1130. // nothing happened; check the next module in the exec queue
  1131. i++;
  1132. }
  1133. }
  1134. });
  1135. };
  1136. if( 0 ){
  1137. req.undef = function(moduleId, referenceModule){
  1138. // In order to reload a module, it must be undefined (this routine) and then re-requested.
  1139. // This is useful for testing frameworks (at least).
  1140. var module = getModule(moduleId, referenceModule);
  1141. setArrived(module);
  1142. delete modules[module.mid];
  1143. };
  1144. }
  1145. if( 1 ){
  1146. if(has("dojo-loader-eval-hint-url")===undefined){
  1147. has.add("dojo-loader-eval-hint-url", 1);
  1148. }
  1149. var fixupUrl= function(url){
  1150. url += ""; // make sure url is a Javascript string (some paths may be a Java string)
  1151. return url + (cacheBust ? ((/\?/.test(url) ? "&" : "?") + cacheBust) : "");
  1152. },
  1153. injectPlugin = function(
  1154. module
  1155. ){
  1156. // injects the plugin module given by module; may have to inject the plugin itself
  1157. var plugin = module.plugin;
  1158. if(plugin.executed === executed && !plugin.load){
  1159. // executed the module not knowing it was a plugin
  1160. promoteModuleToPlugin(plugin);
  1161. }
  1162. var onLoad = function(def){
  1163. module.result = def;
  1164. setArrived(module);
  1165. finishExec(module);
  1166. checkComplete();
  1167. };
  1168. if(plugin.load){
  1169. plugin.load(module.prid, module.req, onLoad);
  1170. }else if(plugin.loadQ){
  1171. plugin.loadQ.push(module);
  1172. }else{
  1173. // the unshift instead of push is important: we don't want plugins to execute as
  1174. // dependencies of some other module because this may cause circles when the plugin
  1175. // loadQ is run; also, generally, we want plugins to run early since they may load
  1176. // several other modules and therefore can potentially unblock many modules
  1177. plugin.loadQ = [module];
  1178. execQ.unshift(plugin);
  1179. injectModule(plugin);
  1180. }
  1181. },
  1182. // for IE, injecting a module may result in a recursive execution if the module is in the cache
  1183. cached = 0,
  1184. injectingModule = 0,
  1185. injectingCachedModule = 0,
  1186. evalModuleText = function(text, module){
  1187. // see def() for the injectingCachedModule bracket; it simply causes a short, safe curcuit
  1188. if(has("config-stripStrict")){
  1189. text = text.replace(/"use strict"/g, '');
  1190. }
  1191. injectingCachedModule = 1;
  1192. if(has("config-dojo-loader-catches")){
  1193. try{
  1194. if(text===cached){
  1195. cached.call(null);
  1196. }else{
  1197. req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid);
  1198. }
  1199. }catch(e){
  1200. signal(error, makeError("evalModuleThrew", module));
  1201. }
  1202. }else{
  1203. if(text===cached){
  1204. cached.call(null);
  1205. }else{
  1206. req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid);
  1207. }
  1208. }
  1209. injectingCachedModule = 0;
  1210. },
  1211. injectModule = function(module){
  1212. // Inject the module. In the browser environment, this means appending a script element into
  1213. // the document; in other environments, it means loading a file.
  1214. //
  1215. // If in synchronous mode, then get the module synchronously if it's not xdomainLoading.
  1216. var mid = module.mid,
  1217. url = module.url;
  1218. if(module.executed || module.injected || waiting[mid] || (module.url && ((module.pack && waiting[module.url]===module.pack) || waiting[module.url]==1))){
  1219. return;
  1220. }
  1221. setRequested(module);
  1222. if( 0 ){
  1223. var viaCombo = 0;
  1224. if(module.plugin && module.plugin.isCombo){
  1225. // a combo plugin; therefore, must be handled by combo service
  1226. // the prid should have already been converted to a URL (if required by the plugin) during
  1227. // the normalze process; in any event, there is no way for the loader to know how to
  1228. // to the conversion; therefore the third argument is zero
  1229. req.combo.add(module.plugin.mid, module.prid, 0, req);
  1230. viaCombo = 1;
  1231. }else if(!module.plugin){
  1232. viaCombo = req.combo.add(0, module.mid, module.url, req);
  1233. }
  1234. if(viaCombo){
  1235. comboPending= 1;
  1236. return;
  1237. }
  1238. }
  1239. if(module.plugin){
  1240. injectPlugin(module);
  1241. return;
  1242. } // else a normal module (not a plugin)
  1243. var onLoadCallback = function(){
  1244. runDefQ(module);
  1245. if(module.injected !== arrived){
  1246. // the script that contained the module arrived and has been executed yet
  1247. // nothing was added to the defQ (so it wasn't an AMD module) and the module
  1248. // wasn't marked as arrived by dojo.provide (so it wasn't a v1.6- module);
  1249. // therefore, it must not have been a module; adjust state accordingly
  1250. setArrived(module);
  1251. mix(module, nonModuleProps);
  1252. req.trace("loader-define-nonmodule", [module.url]);
  1253. }
  1254. if( 1 && legacyMode){
  1255. // must call checkComplete even in for sync loader because we may be in xdomainLoading mode;
  1256. // but, if xd loading, then don't call checkComplete until out of the current sync traversal
  1257. // in order to preserve order of execution of the dojo.required modules
  1258. !syncExecStack.length && checkComplete();
  1259. }else{
  1260. checkComplete();
  1261. }
  1262. };
  1263. cached = cache[mid] || cache[urlKeyPrefix + module.url];
  1264. if(cached){
  1265. req.trace("loader-inject", ["cache", module.mid, url]);
  1266. evalModuleText(cached, module);
  1267. onLoadCallback();
  1268. return;
  1269. }
  1270. if( 1 && legacyMode){
  1271. if(module.isXd){
  1272. // switch to async mode temporarily; if current legacyMode!=sync, then is must be one of {legacyAsync, xd, false}
  1273. legacyMode==sync && (legacyMode = xd);
  1274. // fall through and load via script injection
  1275. }else if(module.isAmd && legacyMode!=sync){
  1276. // fall through and load via script injection
  1277. }else{
  1278. // mode may be sync, xd/legacyAsync, or async; module may be AMD or legacy; but module is always located on the same domain
  1279. var xhrCallback = function(text){
  1280. if(legacyMode==sync){
  1281. // the top of syncExecStack gives the current synchronously executing module; the loader needs
  1282. // to know this if it has to switch to async loading in the middle of evaluating a legacy module
  1283. // this happens when a modules dojo.require's a module that must be loaded async because it's xdomain
  1284. // (using unshift/shift because there is no back() methods for Javascript arrays)
  1285. syncExecStack.unshift(module);
  1286. evalModuleText(text, module);
  1287. syncExecStack.shift();
  1288. // maybe the module was an AMD module
  1289. runDefQ(module);
  1290. // legacy modules never get to defineModule() => cjs and injected never set; also evaluation implies executing
  1291. if(!module.cjs){
  1292. setArrived(module);
  1293. finishExec(module);
  1294. }
  1295. if(module.finish){
  1296. // while synchronously evaluating this module, dojo.require was applied referencing a module
  1297. // that had to be loaded async; therefore, the loader stopped answering all dojo.require
  1298. // requests so they could be answered completely in the correct sequence; module.finish gives
  1299. // the list of dojo.requires that must be re-applied once all target modules are available;
  1300. // make a synthetic module to execute the dojo.require's in the correct order
  1301. // compute a guarnateed-unique mid for the synthetic finish module; remember the finish vector; remove it from the reference module
  1302. // TODO: can we just leave the module.finish...what's it hurting?
  1303. var finishMid = mid + "*finish",
  1304. finish = module.finish;
  1305. delete module.finish;
  1306. def(finishMid, ["dojo", ("dojo/require!" + finish.join(",")).replace(/\./g, "/")], function(dojo){
  1307. forEach(finish, function(mid){ dojo.require(mid); });
  1308. });
  1309. // unshift, not push, which causes the current traversal to be reattempted from the top
  1310. execQ.unshift(getModule(finishMid));
  1311. }
  1312. onLoadCallback();
  1313. }else{
  1314. text = transformToAmd(module, text);
  1315. if(text){
  1316. evalModuleText(text, module);
  1317. onLoadCallback();
  1318. }else{
  1319. // if transformToAmd returned falsy, then the module was already AMD and it can be script-injected
  1320. // do so to improve debugability(even though it means another download...which probably won't happen with a good browser cache)
  1321. injectingModule = module;
  1322. req.injectUrl(fixupUrl(url), onLoadCallback, module);
  1323. injectingModule = 0;
  1324. }
  1325. }
  1326. };
  1327. req.trace("loader-inject", ["xhr", module.mid, url, legacyMode!=sync]);
  1328. if(has("config-dojo-loader-catches")){
  1329. try{
  1330. req.getText(url, legacyMode!=sync, xhrCallback);
  1331. }catch(e){
  1332. signal(error, makeError("xhrInjectFailed", [module, e]));
  1333. }
  1334. }else{
  1335. req.getText(url, legacyMode!=sync, xhrCallback);
  1336. }
  1337. return;
  1338. }
  1339. } // else async mode or fell through in xdomain loading mode; either way, load by script injection
  1340. req.trace("loader-inject", ["script", module.mid, url]);
  1341. injectingModule = module;
  1342. req.injectUrl(fixupUrl(url), onLoadCallback, module);
  1343. injectingModule = 0;
  1344. },
  1345. defineModule = function(module, deps, def){
  1346. req.trace("loader-define-module", [module.mid, deps]);
  1347. if( 0 && module.plugin && module.plugin.isCombo){
  1348. // the module is a plugin resource loaded by the combo service
  1349. // note: check for module.plugin should be enough since normal plugin resources should
  1350. // not follow this path; module.plugin.isCombo is future-proofing belt and suspenders
  1351. module.result = isFunction(def) ? def() : def;
  1352. setArrived(module);
  1353. finishExec(module);
  1354. return module;
  1355. };
  1356. var mid = module.mid;
  1357. if(module.injected === arrived){
  1358. signal(error, makeError("multipleDefine", module));
  1359. return module;
  1360. }
  1361. mix(module, {
  1362. deps: deps,
  1363. def: def,
  1364. cjs: {
  1365. id: module.mid,
  1366. uri: module.url,
  1367. exports: (module.result = {}),
  1368. setExports: function(exports){
  1369. module.cjs.exports = exports;
  1370. },
  1371. config:function(){
  1372. return module.config;
  1373. }
  1374. }
  1375. });
  1376. // resolve deps with respect to this module
  1377. for(var i = 0; i < deps.length; i++){
  1378. deps[i] = getModule(deps[i], module);
  1379. }
  1380. if( 1 && legacyMode && !waiting[mid]){
  1381. // the module showed up without being asked for; it was probably in a <script> element
  1382. injectDependencies(module);
  1383. execQ.push(module);
  1384. checkComplete();
  1385. }
  1386. setArrived(module);
  1387. if(!isFunction(def) && !deps.length){
  1388. module.result = def;
  1389. finishExec(module);
  1390. }
  1391. return module;
  1392. },
  1393. runDefQ = function(referenceModule, mids){
  1394. // defQ is an array of [id, dependencies, factory]
  1395. // mids (if any) is a vector of mids given by a combo service
  1396. var definedModules = [],
  1397. module, args;
  1398. while(defQ.length){
  1399. args = defQ.shift();
  1400. mids && (args[0]= mids.shift());
  1401. // explicit define indicates possible multiple modules in a single file; delay injecting dependencies until defQ fully
  1402. // processed since modules earlier in the queue depend on already-arrived modules that are later in the queue
  1403. // TODO: what if no args[0] and no referenceModule
  1404. module = (args[0] && getModule(args[0])) || referenceModule;
  1405. definedModules.push([module, args[1], args[2]]);
  1406. }
  1407. consumePendingCacheInsert(referenceModule);
  1408. forEach(definedModules, function(args){
  1409. injectDependencies(defineModule.apply(null, args));
  1410. });
  1411. };
  1412. }
  1413. var timerId = 0,
  1414. clearTimer = noop,
  1415. startTimer = noop;
  1416. if( 1 ){
  1417. // Timer machinery that monitors how long the loader is waiting and signals an error when the timer runs out.
  1418. clearTimer = function(){
  1419. timerId && clearTimeout(timerId);
  1420. timerId = 0;
  1421. },
  1422. startTimer = function(){
  1423. clearTimer();
  1424. if(req.waitms){
  1425. timerId = window.setTimeout(function(){
  1426. clearTimer();
  1427. signal(error, makeError("timeout", waiting));
  1428. }, req.waitms);
  1429. }
  1430. };
  1431. }
  1432. if( 1 ){
  1433. // the typically unnecessary !! in front of doc.attachEvent is due to an opera bug; see #15096
  1434. has.add("ie-event-behavior", !!doc.attachEvent && (typeof opera === "undefined" || opera.toString() != "[object Opera]"));
  1435. }
  1436. if( 1 && ( 1 || 1 )){
  1437. var domOn = function(node, eventName, ieEventName, handler){
  1438. // Add an event listener to a DOM node using the API appropriate for the current browser;
  1439. // return a function that will disconnect the listener.
  1440. if(!has("ie-event-behavior")){
  1441. node.addEventListener(eventName, handler, false);
  1442. return function(){
  1443. node.removeEventListener(eventName, handler, false);
  1444. };
  1445. }else{
  1446. node.attachEvent(ieEventName, handler);
  1447. return function(){
  1448. node.detachEvent(ieEventName, handler);
  1449. };
  1450. }
  1451. },
  1452. windowOnLoadListener = domOn(window, "load", "onload", function(){
  1453. req.pageLoaded = 1;
  1454. doc.readyState!="complete" && (doc.readyState = "complete");
  1455. windowOnLoadListener();
  1456. });
  1457. if( 1 ){
  1458. // if the loader is on the page, there must be at least one script element
  1459. // getting its parent and then doing insertBefore solves the "Operation Aborted"
  1460. // error in IE from appending to a node that isn't properly closed; see
  1461. // dojo/tests/_base/loader/requirejs/simple-badbase.html for an example
  1462. var sibling = doc.getElementsByTagName("script")[0],
  1463. insertPoint= sibling.parentNode;
  1464. req.injectUrl = function(url, callback, owner){
  1465. // insert a script element to the insert-point element with src=url;
  1466. // apply callback upon detecting the script has loaded.
  1467. var node = owner.node = doc.createElement("script"),
  1468. onLoad = function(e){
  1469. e = e || window.event;
  1470. var node = e.target || e.srcElement;
  1471. if(e.type === "load" || /complete|loaded/.test(node.readyState)){
  1472. loadDisconnector();
  1473. errorDisconnector();
  1474. callback && callback();
  1475. }
  1476. },
  1477. loadDisconnector = domOn(node, "load", "onreadystatechange", onLoad),
  1478. errorDisconnector = domOn(node, "error", "onerror", function(e){
  1479. loadDisconnector();
  1480. errorDisconnector();
  1481. signal(error, makeError("scriptError", [url, e]));
  1482. });
  1483. node.type = "text/javascript";
  1484. node.charset = "utf-8";
  1485. node.src = url;
  1486. insertPoint.insertBefore(node, sibling);
  1487. return node;
  1488. };
  1489. }
  1490. }
  1491. if( 1 ){
  1492. req.log = function(){
  1493. try{
  1494. for(var i = 0; i < arguments.length; i++){
  1495. console.log(arguments[i]);
  1496. }
  1497. }catch(e){}
  1498. };
  1499. }else{
  1500. req.log = noop;
  1501. }
  1502. if( 0 ){
  1503. var trace = req.trace = function(
  1504. group, // the trace group to which this application belongs
  1505. args // the contents of the trace
  1506. ){
  1507. ///
  1508. // Tracing interface by group.
  1509. //
  1510. // Sends the contents of args to the console iff (req.trace.on && req.trace[group])
  1511. if(trace.on && trace.group[group]){
  1512. signal("trace", [group, args]);
  1513. for(var arg, dump = [], text= "trace:" + group + (args.length ? (":" + args[0]) : ""), i= 1; i<args.length;){
  1514. arg = args[i++];
  1515. if(isString(arg)){
  1516. text += ", " + arg;
  1517. }else{
  1518. dump.push(arg);
  1519. }
  1520. }
  1521. req.log(text);
  1522. dump.length && dump.push(".");
  1523. req.log.apply(req, dump);
  1524. }
  1525. };
  1526. mix(trace, {
  1527. on:1,
  1528. group:{},
  1529. set:function(group, value){
  1530. if(isString(group)){
  1531. trace.group[group]= value;
  1532. }else{
  1533. mix(trace.group, group);
  1534. }
  1535. }
  1536. });
  1537. trace.set(mix(mix(mix({}, defaultConfig.trace), userConfig.trace), dojoSniffConfig.trace));
  1538. on("config", function(config){
  1539. config.trace && trace.set(config.trace);
  1540. });
  1541. }else{
  1542. req.trace = noop;
  1543. }
  1544. var def = function(
  1545. mid, //(commonjs.moduleId, optional) list of modules to be loaded before running factory
  1546. dependencies, //(array of commonjs.moduleId, optional)
  1547. factory //(any)
  1548. ){
  1549. ///
  1550. // Advises the loader of a module factory. //Implements http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition.
  1551. ///
  1552. //note
  1553. // CommonJS factory scan courtesy of http://requirejs.org
  1554. var arity = arguments.length,
  1555. defaultDeps = ["require", "exports", "module"],
  1556. // the predominate signature...
  1557. args = [0, mid, dependencies];
  1558. if(arity==1){
  1559. args = [0, (isFunction(mid) ? defaultDeps : []), mid];
  1560. }else if(arity==2 && isString(mid)){
  1561. args = [mid, (isFunction(dependencies) ? defaultDeps : []), dependencies];
  1562. }else if(arity==3){
  1563. args = [mid, dependencies, factory];
  1564. }
  1565. if( 0 && args[1]===defaultDeps){
  1566. args[2].toString()
  1567. .replace(/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg, "")
  1568. .replace(/require\(["']([\w\!\-_\.\/]+)["']\)/g, function(match, dep){
  1569. args[1].push(dep);
  1570. });
  1571. }
  1572. req.trace("loader-define", args.slice(0, 2));
  1573. var targetModule = args[0] && getModule(args[0]),
  1574. module;
  1575. if(targetModule && !waiting[targetModule.mid]){
  1576. // given a mid that hasn't been requested; therefore, defined through means other than injecting
  1577. // consequent to a require() or define() application; examples include defining modules on-the-fly
  1578. // due to some code path or including a module in a script element. In any case,
  1579. // there is no callback waiting to finish processing and nothing to trigger the defQ and the
  1580. // dependencies are never requested; therefore, do it here.
  1581. injectDependencies(defineModule(targetModule, args[1], args[2]));
  1582. }else if(!has("ie-event-behavior") || ! 1 || injectingCachedModule){
  1583. // not IE path: anonymous module and therefore must have been injected; therefore, onLoad will fire immediately
  1584. // after script finishes being evaluated and the defQ can be run from that callback to detect the module id
  1585. defQ.push(args);
  1586. }else{
  1587. // IE path: possibly anonymous module and therefore injected; therefore, cannot depend on 1-to-1,
  1588. // in-order exec of onLoad with script eval (since it's IE) and must manually detect here
  1589. targetModule = targetModule || injectingModule;
  1590. if(!targetModule){
  1591. for(mid in waiting){
  1592. module = modules[mid];
  1593. if(module && module.node && module.node.readyState === 'interactive'){
  1594. targetModule = module;
  1595. break;
  1596. }
  1597. }
  1598. if( 0 && !targetModule){
  1599. for(var i = 0; i<combosPending.length; i++){
  1600. targetModule = combosPending[i];
  1601. if(targetModule.node && targetModule.node.readyState === 'interactive'){
  1602. break;
  1603. }
  1604. targetModule= 0;
  1605. }
  1606. }
  1607. }
  1608. if( 0 && isArray(targetModule)){
  1609. injectDependencies(defineModule(getModule(targetModule.shift()), args[1], args[2]));
  1610. if(!targetModule.length){
  1611. combosPending.splice(i, 1);
  1612. }
  1613. }else if(targetModule){
  1614. consumePendingCacheInsert(targetModule);
  1615. injectDependencies(defineModule(targetModule, args[1], args[2]));
  1616. }else{
  1617. signal(error, makeError("ieDefineFailed", args[0]));
  1618. }
  1619. checkComplete();
  1620. }
  1621. };
  1622. def.amd = {
  1623. vendor:"dojotoolkit.org"
  1624. };
  1625. if( 0 ){
  1626. req.def = def;
  1627. }
  1628. // allow config to override default implemention of named functions; this is useful for
  1629. // non-browser environments, e.g., overriding injectUrl, getText, log, etc. in node.js, Rhino, etc.
  1630. // also useful for testing and monkey patching loader
  1631. mix(mix(req, defaultConfig.loaderPatch), userConfig.loaderPatch);
  1632. // now that req is fully initialized and won't change, we can hook it up to the error signal
  1633. on(error, function(arg){
  1634. try{
  1635. console.error(arg);
  1636. if(arg instanceof Error){
  1637. for(var p in arg){
  1638. console.log(p + ":", arg[p]);
  1639. }
  1640. console.log(".");
  1641. }
  1642. }catch(e){}
  1643. });
  1644. // always publish these
  1645. mix(req, {
  1646. uid:uid,
  1647. cache:cache,
  1648. packs:packs
  1649. });
  1650. if( 0 ){
  1651. mix(req, {
  1652. // these may be interesting to look at when debugging
  1653. paths:paths,
  1654. aliases:aliases,
  1655. modules:modules,
  1656. legacyMode:legacyMode,
  1657. execQ:execQ,
  1658. defQ:defQ,
  1659. waiting:waiting,
  1660. // these are used for testing
  1661. // TODO: move testing infrastructure to a different has feature
  1662. packs:packs,
  1663. mapProgs:mapProgs,
  1664. pathsMapProg:pathsMapProg,
  1665. listenerQueues:listenerQueues,
  1666. // these are used by the builder (at least)
  1667. computeMapProg:computeMapProg,
  1668. runMapProg:runMapProg,
  1669. compactPath:compactPath,
  1670. getModuleInfo:getModuleInfo_
  1671. });
  1672. }
  1673. // the loader can be defined exactly once; look for global define which is the symbol AMD loaders are
  1674. // *required* to define (as opposed to require, which is optional)
  1675. if(global.define){
  1676. if( 1 ){
  1677. signal(error, makeError("defineAlreadyDefined", 0));
  1678. }
  1679. return;
  1680. }else{
  1681. global.define = def;
  1682. global.require = req;
  1683. if( 0 ){
  1684. require= req;
  1685. }
  1686. }
  1687. if( 0 && req.combo && req.combo.plugins){
  1688. var plugins = req.combo.plugins,
  1689. pluginName;
  1690. for(pluginName in plugins){
  1691. mix(mix(getModule(pluginName), plugins[pluginName]), {isCombo:1, executed:"executed", load:1});
  1692. }
  1693. }
  1694. if( 1 ){
  1695. forEach(delayedModuleConfig, function(c){ config(c); });
  1696. var bootDeps = dojoSniffConfig.deps || userConfig.deps || defaultConfig.deps,
  1697. bootCallback = dojoSniffConfig.callback || userConfig.callback || defaultConfig.callback;
  1698. req.boot = (bootDeps || bootCallback) ? [bootDeps || [], bootCallback] : 0;
  1699. }
  1700. if(! 1 ){
  1701. !req.async && req(["dojo"]);
  1702. req.boot && req.apply(null, req.boot);
  1703. }
  1704. })
  1705. (this.dojoConfig || this.djConfig || this.require || {}, {
  1706. async:0,
  1707. hasCache:{
  1708. 'config-selectorEngine':"acme",
  1709. 'config-tlmSiblingOfDojo':1,
  1710. 'dojo-built':1,
  1711. 'dojo-loader':1,
  1712. dom:1,
  1713. 'host-browser':1
  1714. },
  1715. packages:[
  1716. {
  1717. location:"../dijit",
  1718. name:"dijit"
  1719. },
  1720. {
  1721. location:"../dojox",
  1722. name:"dojox"
  1723. },
  1724. {
  1725. location:".",
  1726. name:"dojo"
  1727. }
  1728. ]
  1729. });require({cache:{
  1730. 'dojo/_base/fx':function(){
  1731. define(["./kernel", "./config", /*===== "./declare", =====*/ "./lang", "../Evented", "./Color", "./connect", "./sniff", "../dom", "../dom-style"],
  1732. function(dojo, config, /*===== declare, =====*/ lang, Evented, Color, connect, has, dom, style){
  1733. // module:
  1734. // dojo/_base/fx
  1735. // notes:
  1736. // Animation loosely package based on Dan Pupius' work, contributed under CLA; see
  1737. // http://pupius.co.uk/js/Toolkit.Drawing.js
  1738. var _mixin = lang.mixin;
  1739. // Module export
  1740. var basefx = {
  1741. // summary:
  1742. // This module defines the base dojo/_base/fx implementation.
  1743. };
  1744. var _Line = basefx._Line = function(/*int*/ start, /*int*/ end){
  1745. // summary:
  1746. // Object used to generate values from a start value to an end value
  1747. // start: int
  1748. // Beginning value for range
  1749. // end: int
  1750. // Ending value for range
  1751. this.start = start;
  1752. this.end = end;
  1753. };
  1754. _Line.prototype.getValue = function(/*float*/ n){
  1755. // summary:
  1756. // Returns the point on the line
  1757. // n:
  1758. // a floating point number greater than 0 and less than 1
  1759. return ((this.end - this.start) * n) + this.start; // Decimal
  1760. };
  1761. var Animation = basefx.Animation = function(args){
  1762. // summary:
  1763. // A generic animation class that fires callbacks into its handlers
  1764. // object at various states.
  1765. // description:
  1766. // A generic animation class that fires callbacks into its handlers
  1767. // object at various states. Nearly all dojo animation functions
  1768. // return an instance of this method, usually without calling the
  1769. // .play() method beforehand. Therefore, you will likely need to
  1770. // call .play() on instances of `Animation` when one is
  1771. // returned.
  1772. // args: Object
  1773. // The 'magic argument', mixing all the properties into this
  1774. // animation instance.
  1775. _mixin(this, args);
  1776. if(lang.isArray(this.curve)){
  1777. this.curve = new _Line(this.curve[0], this.curve[1]);
  1778. }
  1779. };
  1780. Animation.prototype = new Evented();
  1781. lang.extend(Animation, {
  1782. // duration: Integer
  1783. // The time in milliseconds the animation will take to run
  1784. duration: 350,
  1785. /*=====
  1786. // curve: _Line|Array
  1787. // A two element array of start and end values, or a `_Line` instance to be
  1788. // used in the Animation.
  1789. curve: null,
  1790. // easing: Function?
  1791. // A Function to adjust the acceleration (or deceleration) of the progress
  1792. // across a _Line
  1793. easing: null,
  1794. =====*/
  1795. // repeat: Integer?
  1796. // The number of times to loop the animation
  1797. repeat: 0,
  1798. // rate: Integer?
  1799. // the time in milliseconds to wait before advancing to next frame
  1800. // (used as a fps timer: 1000/rate = fps)
  1801. rate: 20 /* 50 fps */,
  1802. /*=====
  1803. // delay: Integer?
  1804. // The time in milliseconds to wait before starting animation after it
  1805. // has been .play()'ed
  1806. delay: null,
  1807. // beforeBegin: Event?
  1808. // Synthetic event fired before a Animation begins playing (synchronous)
  1809. beforeBegin: null,
  1810. // onBegin: Event?
  1811. // Synthetic event fired as a Animation begins playing (useful?)
  1812. onBegin: null,
  1813. // onAnimate: Event?
  1814. // Synthetic event fired at each interval of the Animation
  1815. onAnimate: null,
  1816. // onEnd: Event?
  1817. // Synthetic event fired after the final frame of the Animation
  1818. onEnd: null,
  1819. // onPlay: Event?
  1820. // Synthetic event fired any time the Animation is play()'ed
  1821. onPlay: null,
  1822. // onPause: Event?
  1823. // Synthetic event fired when the Animation is paused
  1824. onPause: null,
  1825. // onStop: Event
  1826. // Synthetic event fires when the Animation is stopped
  1827. onStop: null,
  1828. =====*/
  1829. _percent: 0,
  1830. _startRepeatCount: 0,
  1831. _getStep: function(){
  1832. var _p = this._percent,
  1833. _e = this.easing
  1834. ;
  1835. return _e ? _e(_p) : _p;
  1836. },
  1837. _fire: function(/*Event*/ evt, /*Array?*/ args){
  1838. // summary:
  1839. // Convenience function. Fire event "evt" and pass it the
  1840. // arguments specified in "args".
  1841. // description:
  1842. // Convenience function. Fire event "evt" and pass it the
  1843. // arguments specified in "args".
  1844. // Fires the callback in the scope of this Animation
  1845. // instance.
  1846. // evt:
  1847. // The event to fire.
  1848. // args:
  1849. // The arguments to pass to the event.
  1850. var a = args||[];
  1851. if(this[evt]){
  1852. if(config.debugAtAllCosts){
  1853. this[evt].apply(this, a);
  1854. }else{
  1855. try{
  1856. this[evt].apply(this, a);
  1857. }catch(e){
  1858. // squelch and log because we shouldn't allow exceptions in
  1859. // synthetic event handlers to cause the internal timer to run
  1860. // amuck, potentially pegging the CPU. I'm not a fan of this
  1861. // squelch, but hopefully logging will make it clear what's
  1862. // going on
  1863. console.error("exception in animation handler for:", evt);
  1864. console.error(e);
  1865. }
  1866. }
  1867. }
  1868. return this; // Animation
  1869. },
  1870. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  1871. // summary:
  1872. // Start the animation.
  1873. // delay:
  1874. // How many milliseconds to delay before starting.
  1875. // gotoStart:
  1876. // If true, starts the animation from the beginning; otherwise,
  1877. // starts it from its current position.
  1878. // returns: Animation
  1879. // The instance to allow chaining.
  1880. var _t = this;
  1881. if(_t._delayTimer){ _t._clearTimer(); }
  1882. if(gotoStart){
  1883. _t._stopTimer();
  1884. _t._active = _t._paused = false;
  1885. _t._percent = 0;
  1886. }else if(_t._active && !_t._paused){
  1887. return _t;
  1888. }
  1889. _t._fire("beforeBegin", [_t.node]);
  1890. var de = delay || _t.delay,
  1891. _p = lang.hitch(_t, "_play", gotoStart);
  1892. if(de > 0){
  1893. _t._delayTimer = setTimeout(_p, de);
  1894. return _t;
  1895. }
  1896. _p();
  1897. return _t; // Animation
  1898. },
  1899. _play: function(gotoStart){
  1900. var _t = this;
  1901. if(_t._delayTimer){ _t._clearTimer(); }
  1902. _t._startTime = new Date().valueOf();
  1903. if(_t._paused){
  1904. _t._startTime -= _t.duration * _t._percent;
  1905. }
  1906. _t._active = true;
  1907. _t._paused = false;
  1908. var value = _t.curve.getValue(_t._getStep());
  1909. if(!_t._percent){
  1910. if(!_t._startRepeatCount){
  1911. _t._startRepeatCount = _t.repeat;
  1912. }
  1913. _t._fire("onBegin", [value]);
  1914. }
  1915. _t._fire("onPlay", [value]);
  1916. _t._cycle();
  1917. return _t; // Animation
  1918. },
  1919. pause: function(){
  1920. // summary:
  1921. // Pauses a running animation.
  1922. var _t = this;
  1923. if(_t._delayTimer){ _t._clearTimer(); }
  1924. _t._stopTimer();
  1925. if(!_t._active){ return _t; /*Animation*/ }
  1926. _t._paused = true;
  1927. _t._fire("onPause", [_t.curve.getValue(_t._getStep())]);
  1928. return _t; // Animation
  1929. },
  1930. gotoPercent: function(/*Decimal*/ percent, /*Boolean?*/ andPlay){
  1931. // summary:
  1932. // Sets the progress of the animation.
  1933. // percent:
  1934. // A percentage in decimal notation (between and including 0.0 and 1.0).
  1935. // andPlay:
  1936. // If true, play the animation after setting the progress.
  1937. var _t = this;
  1938. _t._stopTimer();
  1939. _t._active = _t._paused = true;
  1940. _t._percent = percent;
  1941. if(andPlay){ _t.play(); }
  1942. return _t; // Animation
  1943. },
  1944. stop: function(/*boolean?*/ gotoEnd){
  1945. // summary:
  1946. // Stops a running animation.
  1947. // gotoEnd:
  1948. // If true, the animation will end.
  1949. var _t = this;
  1950. if(_t._delayTimer){ _t._clearTimer(); }
  1951. if(!_t._timer){ return _t; /* Animation */ }
  1952. _t._stopTimer();
  1953. if(gotoEnd){
  1954. _t._percent = 1;
  1955. }
  1956. _t._fire("onStop", [_t.curve.getValue(_t._getStep())]);
  1957. _t._active = _t._paused = false;
  1958. return _t; // Animation
  1959. },
  1960. status: function(){
  1961. // summary:
  1962. // Returns a string token representation of the status of
  1963. // the animation, one of: "paused", "playing", "stopped"
  1964. if(this._active){
  1965. return this._paused ? "paused" : "playing"; // String
  1966. }
  1967. return "stopped"; // String
  1968. },
  1969. _cycle: function(){
  1970. var _t = this;
  1971. if(_t._active){
  1972. var curr = new Date().valueOf();
  1973. // Allow durations of 0 (instant) by setting step to 1 - see #13798
  1974. var step = _t.duration === 0 ? 1 : (curr - _t._startTime) / (_t.duration);
  1975. if(step >= 1){
  1976. step = 1;
  1977. }
  1978. _t._percent = step;
  1979. // Perform easing
  1980. if(_t.easing){
  1981. step = _t.easing(step);
  1982. }
  1983. _t._fire("onAnimate", [_t.curve.getValue(step)]);
  1984. if(_t._percent < 1){
  1985. _t._startTimer();
  1986. }else{
  1987. _t._active = false;
  1988. if(_t.repeat > 0){
  1989. _t.repeat--;
  1990. _t.play(null, true);
  1991. }else if(_t.repeat == -1){
  1992. _t.play(null, true);
  1993. }else{
  1994. if(_t._startRepeatCount){
  1995. _t.repeat = _t._startRepeatCount;
  1996. _t._startRepeatCount = 0;
  1997. }
  1998. }
  1999. _t._percent = 0;
  2000. _t._fire("onEnd", [_t.node]);
  2001. !_t.repeat && _t._stopTimer();
  2002. }
  2003. }
  2004. return _t; // Animation
  2005. },
  2006. _clearTimer: function(){
  2007. // summary:
  2008. // Clear the play delay timer
  2009. clearTimeout(this._delayTimer);
  2010. delete this._delayTimer;
  2011. }
  2012. });
  2013. // the local timer, stubbed into all Animation instances
  2014. var ctr = 0,
  2015. timer = null,
  2016. runner = {
  2017. run: function(){}
  2018. };
  2019. lang.extend(Animation, {
  2020. _startTimer: function(){
  2021. if(!this._timer){
  2022. this._timer = connect.connect(runner, "run", this, "_cycle");
  2023. ctr++;
  2024. }
  2025. if(!timer){
  2026. timer = setInterval(lang.hitch(runner, "run"), this.rate);
  2027. }
  2028. },
  2029. _stopTimer: function(){
  2030. if(this._timer){
  2031. connect.disconnect(this._timer);
  2032. this._timer = null;
  2033. ctr--;
  2034. }
  2035. if(ctr <= 0){
  2036. clearInterval(timer);
  2037. timer = null;
  2038. ctr = 0;
  2039. }
  2040. }
  2041. });
  2042. var _makeFadeable =
  2043. has("ie") ? function(node){
  2044. // only set the zoom if the "tickle" value would be the same as the
  2045. // default
  2046. var ns = node.style;
  2047. // don't set the width to auto if it didn't already cascade that way.
  2048. // We don't want to f anyones designs
  2049. if(!ns.width.length && style.get(node, "width") == "auto"){
  2050. ns.width = "auto";
  2051. }
  2052. } :
  2053. function(){};
  2054. basefx._fade = function(/*Object*/ args){
  2055. // summary:
  2056. // Returns an animation that will fade the node defined by
  2057. // args.node from the start to end values passed (args.start
  2058. // args.end) (end is mandatory, start is optional)
  2059. args.node = dom.byId(args.node);
  2060. var fArgs = _mixin({ properties: {} }, args),
  2061. props = (fArgs.properties.opacity = {});
  2062. props.start = !("start" in fArgs) ?
  2063. function(){
  2064. return +style.get(fArgs.node, "opacity")||0;
  2065. } : fArgs.start;
  2066. props.end = fArgs.end;
  2067. var anim = basefx.animateProperty(fArgs);
  2068. connect.connect(anim, "beforeBegin", lang.partial(_makeFadeable, fArgs.node));
  2069. return anim; // Animation
  2070. };
  2071. /*=====
  2072. var __FadeArgs = declare(null, {
  2073. // node: DOMNode|String
  2074. // The node referenced in the animation
  2075. // duration: Integer?
  2076. // Duration of the animation in milliseconds.
  2077. // easing: Function?
  2078. // An easing function.
  2079. });
  2080. =====*/
  2081. basefx.fadeIn = function(/*__FadeArgs*/ args){
  2082. // summary:
  2083. // Returns an animation that will fade node defined in 'args' from
  2084. // its current opacity to fully opaque.
  2085. return basefx._fade(_mixin({ end: 1 }, args)); // Animation
  2086. };
  2087. basefx.fadeOut = function(/*__FadeArgs*/ args){
  2088. // summary:
  2089. // Returns an animation that will fade node defined in 'args'
  2090. // from its current opacity to fully transparent.
  2091. return basefx._fade(_mixin({ end: 0 }, args)); // Animation
  2092. };
  2093. basefx._defaultEasing = function(/*Decimal?*/ n){
  2094. // summary:
  2095. // The default easing function for Animation(s)
  2096. return 0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2); // Decimal
  2097. };
  2098. var PropLine = function(properties){
  2099. // PropLine is an internal class which is used to model the values of
  2100. // an a group of CSS properties across an animation lifecycle. In
  2101. // particular, the "getValue" function handles getting interpolated
  2102. // values between start and end for a particular CSS value.
  2103. this._properties = properties;
  2104. for(var p in properties){
  2105. var prop = properties[p];
  2106. if(prop.start instanceof Color){
  2107. // create a reusable temp color object to keep intermediate results
  2108. prop.tempColor = new Color();
  2109. }
  2110. }
  2111. };
  2112. PropLine.prototype.getValue = function(r){
  2113. var ret = {};
  2114. for(var p in this._properties){
  2115. var prop = this._properties[p],
  2116. start = prop.start;
  2117. if(start instanceof Color){
  2118. ret[p] = Color.blendColors(start, prop.end, r, prop.tempColor).toCss();
  2119. }else if(!lang.isArray(start)){
  2120. ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units || "px" : 0);
  2121. }
  2122. }
  2123. return ret;
  2124. };
  2125. /*=====
  2126. var __AnimArgs = declare(__FadeArgs, {
  2127. // properties: Object?
  2128. // A hash map of style properties to Objects describing the transition,
  2129. // such as the properties of _Line with an additional 'units' property
  2130. properties: {}
  2131. //TODOC: add event callbacks
  2132. });
  2133. =====*/
  2134. basefx.animateProperty = function(/*__AnimArgs*/ args){
  2135. // summary:
  2136. // Returns an animation that will transition the properties of
  2137. // node defined in `args` depending how they are defined in
  2138. // `args.properties`
  2139. //
  2140. // description:
  2141. // Foundation of most `dojo/_base/fx`
  2142. // animations. It takes an object of "properties" corresponding to
  2143. // style properties, and animates them in parallel over a set
  2144. // duration.
  2145. //
  2146. // example:
  2147. // A simple animation that changes the width of the specified node.
  2148. // | basefx.animateProperty({
  2149. // | node: "nodeId",
  2150. // | properties: { width: 400 },
  2151. // | }).play();
  2152. // Dojo figures out the start value for the width and converts the
  2153. // integer specified for the width to the more expressive but
  2154. // verbose form `{ width: { end: '400', units: 'px' } }` which you
  2155. // can also specify directly. Defaults to 'px' if omitted.
  2156. //
  2157. // example:
  2158. // Animate width, height, and padding over 2 seconds... the
  2159. // pedantic way:
  2160. // | basefx.animateProperty({ node: node, duration:2000,
  2161. // | properties: {
  2162. // | width: { start: '200', end: '400', units:"px" },
  2163. // | height: { start:'200', end: '400', units:"px" },
  2164. // | paddingTop: { start:'5', end:'50', units:"px" }
  2165. // | }
  2166. // | }).play();
  2167. // Note 'paddingTop' is used over 'padding-top'. Multi-name CSS properties
  2168. // are written using "mixed case", as the hyphen is illegal as an object key.
  2169. //
  2170. // example:
  2171. // Plug in a different easing function and register a callback for
  2172. // when the animation ends. Easing functions accept values between
  2173. // zero and one and return a value on that basis. In this case, an
  2174. // exponential-in curve.
  2175. // | basefx.animateProperty({
  2176. // | node: "nodeId",
  2177. // | // dojo figures out the start value
  2178. // | properties: { width: { end: 400 } },
  2179. // | easing: function(n){
  2180. // | return (n==0) ? 0 : Math.pow(2, 10 * (n - 1));
  2181. // | },
  2182. // | onEnd: function(node){
  2183. // | // called when the animation finishes. The animation
  2184. // | // target is passed to this function
  2185. // | }
  2186. // | }).play(500); // delay playing half a second
  2187. //
  2188. // example:
  2189. // Like all `Animation`s, animateProperty returns a handle to the
  2190. // Animation instance, which fires the events common to Dojo FX. Use `aspect.after`
  2191. // to access these events outside of the Animation definition:
  2192. // | var anim = basefx.animateProperty({
  2193. // | node:"someId",
  2194. // | properties:{
  2195. // | width:400, height:500
  2196. // | }
  2197. // | });
  2198. // | aspect.after(anim, "onEnd", function(){
  2199. // | console.log("animation ended");
  2200. // | }, true);
  2201. // | // play the animation now:
  2202. // | anim.play();
  2203. //
  2204. // example:
  2205. // Each property can be a function whose return value is substituted along.
  2206. // Additionally, each measurement (eg: start, end) can be a function. The node
  2207. // reference is passed directly to callbacks.
  2208. // | basefx.animateProperty({
  2209. // | node:"mine",
  2210. // | properties:{
  2211. // | height:function(node){
  2212. // | // shrink this node by 50%
  2213. // | return domGeom.position(node).h / 2
  2214. // | },
  2215. // | width:{
  2216. // | start:function(node){ return 100; },
  2217. // | end:function(node){ return 200; }
  2218. // | }
  2219. // | }
  2220. // | }).play();
  2221. //
  2222. var n = args.node = dom.byId(args.node);
  2223. if(!args.easing){ args.easing = dojo._defaultEasing; }
  2224. var anim = new Animation(args);
  2225. connect.connect(anim, "beforeBegin", anim, function(){
  2226. var pm = {};
  2227. for(var p in this.properties){
  2228. // Make shallow copy of properties into pm because we overwrite
  2229. // some values below. In particular if start/end are functions
  2230. // we don't want to overwrite them or the functions won't be
  2231. // called if the animation is reused.
  2232. if(p == "width" || p == "height"){
  2233. this.node.display = "block";
  2234. }
  2235. var prop = this.properties[p];
  2236. if(lang.isFunction(prop)){
  2237. prop = prop(n);
  2238. }
  2239. prop = pm[p] = _mixin({}, (lang.isObject(prop) ? prop: { end: prop }));
  2240. if(lang.isFunction(prop.start)){
  2241. prop.start = prop.start(n);
  2242. }
  2243. if(lang.isFunction(prop.end)){
  2244. prop.end = prop.end(n);
  2245. }
  2246. var isColor = (p.toLowerCase().indexOf("color") >= 0);
  2247. function getStyle(node, p){
  2248. // domStyle.get(node, "height") can return "auto" or "" on IE; this is more reliable:
  2249. var v = { height: node.offsetHeight, width: node.offsetWidth }[p];
  2250. if(v !== undefined){ return v; }
  2251. v = style.get(node, p);
  2252. return (p == "opacity") ? +v : (isColor ? v : parseFloat(v));
  2253. }
  2254. if(!("end" in prop)){
  2255. prop.end = getStyle(n, p);
  2256. }else if(!("start" in prop)){
  2257. prop.start = getStyle(n, p);
  2258. }
  2259. if(isColor){
  2260. prop.start = new Color(prop.start);
  2261. prop.end = new Color(prop.end);
  2262. }else{
  2263. prop.start = (p == "opacity") ? +prop.start : parseFloat(prop.start);
  2264. }
  2265. }
  2266. this.curve = new PropLine(pm);
  2267. });
  2268. connect.connect(anim, "onAnimate", lang.hitch(style, "set", anim.node));
  2269. return anim; // Animation
  2270. };
  2271. basefx.anim = function( /*DOMNode|String*/ node,
  2272. /*Object*/ properties,
  2273. /*Integer?*/ duration,
  2274. /*Function?*/ easing,
  2275. /*Function?*/ onEnd,
  2276. /*Integer?*/ delay){
  2277. // summary:
  2278. // A simpler interface to `animateProperty()`, also returns
  2279. // an instance of `Animation` but begins the animation
  2280. // immediately, unlike nearly every other Dojo animation API.
  2281. // description:
  2282. // Simpler (but somewhat less powerful) version
  2283. // of `animateProperty`. It uses defaults for many basic properties
  2284. // and allows for positional parameters to be used in place of the
  2285. // packed "property bag" which is used for other Dojo animation
  2286. // methods.
  2287. //
  2288. // The `Animation` object returned will be already playing, so
  2289. // calling play() on it again is (usually) a no-op.
  2290. // node:
  2291. // a DOM node or the id of a node to animate CSS properties on
  2292. // duration:
  2293. // The number of milliseconds over which the animation
  2294. // should run. Defaults to the global animation default duration
  2295. // (350ms).
  2296. // easing:
  2297. // An easing function over which to calculate acceleration
  2298. // and deceleration of the animation through its duration.
  2299. // A default easing algorithm is provided, but you may
  2300. // plug in any you wish. A large selection of easing algorithms
  2301. // are available in `dojo/fx/easing`.
  2302. // onEnd:
  2303. // A function to be called when the animation finishes
  2304. // running.
  2305. // delay:
  2306. // The number of milliseconds to delay beginning the
  2307. // animation by. The default is 0.
  2308. // example:
  2309. // Fade out a node
  2310. // | basefx.anim("id", { opacity: 0 });
  2311. // example:
  2312. // Fade out a node over a full second
  2313. // | basefx.anim("id", { opacity: 0 }, 1000);
  2314. return basefx.animateProperty({ // Animation
  2315. node: node,
  2316. duration: duration || Animation.prototype.duration,
  2317. properties: properties,
  2318. easing: easing,
  2319. onEnd: onEnd
  2320. }).play(delay || 0);
  2321. };
  2322. if( 1 ){
  2323. _mixin(dojo, basefx);
  2324. // Alias to drop come 2.0:
  2325. dojo._Animation = Animation;
  2326. }
  2327. return basefx;
  2328. });
  2329. },
  2330. 'dojo/dom-form':function(){
  2331. define(["./_base/lang", "./dom", "./io-query", "./json"], function(lang, dom, ioq, json){
  2332. // module:
  2333. // dojo/dom-form
  2334. function setValue(/*Object*/ obj, /*String*/ name, /*String*/ value){
  2335. // summary:
  2336. // For the named property in object, set the value. If a value
  2337. // already exists and it is a string, convert the value to be an
  2338. // array of values.
  2339. // Skip it if there is no value
  2340. if(value === null){
  2341. return;
  2342. }
  2343. var val = obj[name];
  2344. if(typeof val == "string"){ // inline'd type check
  2345. obj[name] = [val, value];
  2346. }else if(lang.isArray(val)){
  2347. val.push(value);
  2348. }else{
  2349. obj[name] = value;
  2350. }
  2351. }
  2352. var exclude = "file|submit|image|reset|button";
  2353. var form = {
  2354. // summary:
  2355. // This module defines form-processing functions.
  2356. fieldToObject: function fieldToObject(/*DOMNode|String*/ inputNode){
  2357. // summary:
  2358. // Serialize a form field to a JavaScript object.
  2359. // description:
  2360. // Returns the value encoded in a form field as
  2361. // as a string or an array of strings. Disabled form elements
  2362. // and unchecked radio and checkboxes are skipped. Multi-select
  2363. // elements are returned as an array of string values.
  2364. // inputNode: DOMNode|String
  2365. // returns: Object
  2366. var ret = null;
  2367. inputNode = dom.byId(inputNode);
  2368. if(inputNode){
  2369. var _in = inputNode.name, type = (inputNode.type || "").toLowerCase();
  2370. if(_in && type && !inputNode.disabled){
  2371. if(type == "radio" || type == "checkbox"){
  2372. if(inputNode.checked){
  2373. ret = inputNode.value;
  2374. }
  2375. }else if(inputNode.multiple){
  2376. ret = [];
  2377. var nodes = [inputNode.firstChild];
  2378. while(nodes.length){
  2379. for(var node = nodes.pop(); node; node = node.nextSibling){
  2380. if(node.nodeType == 1 && node.tagName.toLowerCase() == "option"){
  2381. if(node.selected){
  2382. ret.push(node.value);
  2383. }
  2384. }else{
  2385. if(node.nextSibling){
  2386. nodes.push(node.nextSibling);
  2387. }
  2388. if(node.firstChild){
  2389. nodes.push(node.firstChild);
  2390. }
  2391. break;
  2392. }
  2393. }
  2394. }
  2395. }else{
  2396. ret = inputNode.value;
  2397. }
  2398. }
  2399. }
  2400. return ret; // Object
  2401. },
  2402. toObject: function formToObject(/*DOMNode|String*/ formNode){
  2403. // summary:
  2404. // Serialize a form node to a JavaScript object.
  2405. // description:
  2406. // Returns the values encoded in an HTML form as
  2407. // string properties in an object which it then returns. Disabled form
  2408. // elements, buttons, and other non-value form elements are skipped.
  2409. // Multi-select elements are returned as an array of string values.
  2410. // formNode: DOMNode|String
  2411. // example:
  2412. // This form:
  2413. // | <form id="test_form">
  2414. // | <input type="text" name="blah" value="blah">
  2415. // | <input type="text" name="no_value" value="blah" disabled>
  2416. // | <input type="button" name="no_value2" value="blah">
  2417. // | <select type="select" multiple name="multi" size="5">
  2418. // | <option value="blah">blah</option>
  2419. // | <option value="thud" selected>thud</option>
  2420. // | <option value="thonk" selected>thonk</option>
  2421. // | </select>
  2422. // | </form>
  2423. //
  2424. // yields this object structure as the result of a call to
  2425. // formToObject():
  2426. //
  2427. // | {
  2428. // | blah: "blah",
  2429. // | multi: [
  2430. // | "thud",
  2431. // | "thonk"
  2432. // | ]
  2433. // | };
  2434. var ret = {}, elems = dom.byId(formNode).elements;
  2435. for(var i = 0, l = elems.length; i < l; ++i){
  2436. var item = elems[i], _in = item.name, type = (item.type || "").toLowerCase();
  2437. if(_in && type && exclude.indexOf(type) < 0 && !item.disabled){
  2438. setValue(ret, _in, form.fieldToObject(item));
  2439. if(type == "image"){
  2440. ret[_in + ".x"] = ret[_in + ".y"] = ret[_in].x = ret[_in].y = 0;
  2441. }
  2442. }
  2443. }
  2444. return ret; // Object
  2445. },
  2446. toQuery: function formToQuery(/*DOMNode|String*/ formNode){
  2447. // summary:
  2448. // Returns a URL-encoded string representing the form passed as either a
  2449. // node or string ID identifying the form to serialize
  2450. // formNode: DOMNode|String
  2451. // returns: String
  2452. return ioq.objectToQuery(form.toObject(formNode)); // String
  2453. },
  2454. toJson: function formToJson(/*DOMNode|String*/ formNode, /*Boolean?*/ prettyPrint){
  2455. // summary:
  2456. // Create a serialized JSON string from a form node or string
  2457. // ID identifying the form to serialize
  2458. // formNode: DOMNode|String
  2459. // prettyPrint: Boolean?
  2460. // returns: String
  2461. return json.stringify(form.toObject(formNode), null, prettyPrint ? 4 : 0); // String
  2462. }
  2463. };
  2464. return form;
  2465. });
  2466. },
  2467. 'dojo/i18n':function(){
  2468. define(["./_base/kernel", "require", "./has", "./_base/array", "./_base/config", "./_base/lang", "./_base/xhr", "./json", "module"],
  2469. function(dojo, require, has, array, config, lang, xhr, json, module){
  2470. // module:
  2471. // dojo/i18n
  2472. has.add("dojo-preload-i18n-Api",
  2473. // if true, define the preload localizations machinery
  2474. 1
  2475. );
  2476. 1 || has.add("dojo-v1x-i18n-Api",
  2477. // if true, define the v1.x i18n functions
  2478. 1
  2479. );
  2480. var
  2481. thisModule = dojo.i18n =
  2482. {
  2483. // summary:
  2484. // This module implements the dojo/i18n! plugin and the v1.6- i18n API
  2485. // description:
  2486. // We choose to include our own plugin to leverage functionality already contained in dojo
  2487. // and thereby reduce the size of the plugin compared to various loader implementations. Also, this
  2488. // allows foreign AMD loaders to be used without their plugins.
  2489. },
  2490. nlsRe =
  2491. // regexp for reconstructing the master bundle name from parts of the regexp match
  2492. // nlsRe.exec("foo/bar/baz/nls/en-ca/foo") gives:
  2493. // ["foo/bar/baz/nls/en-ca/foo", "foo/bar/baz/nls/", "/", "/", "en-ca", "foo"]
  2494. // nlsRe.exec("foo/bar/baz/nls/foo") gives:
  2495. // ["foo/bar/baz/nls/foo", "foo/bar/baz/nls/", "/", "/", "foo", ""]
  2496. // so, if match[5] is blank, it means this is the top bundle definition.
  2497. // courtesy of http://requirejs.org
  2498. /(^.*(^|\/)nls)(\/|$)([^\/]*)\/?([^\/]*)/,
  2499. getAvailableLocales = function(
  2500. root,
  2501. locale,
  2502. bundlePath,
  2503. bundleName
  2504. ){
  2505. // summary:
  2506. // return a vector of module ids containing all available locales with respect to the target locale
  2507. // For example, assuming:
  2508. //
  2509. // - the root bundle indicates specific bundles for "fr" and "fr-ca",
  2510. // - bundlePath is "myPackage/nls"
  2511. // - bundleName is "myBundle"
  2512. //
  2513. // Then a locale argument of "fr-ca" would return
  2514. //
  2515. // ["myPackage/nls/myBundle", "myPackage/nls/fr/myBundle", "myPackage/nls/fr-ca/myBundle"]
  2516. //
  2517. // Notice that bundles are returned least-specific to most-specific, starting with the root.
  2518. //
  2519. // If root===false indicates we're working with a pre-AMD i18n bundle that doesn't tell about the available locales;
  2520. // therefore, assume everything is available and get 404 errors that indicate a particular localization is not available
  2521. for(var result = [bundlePath + bundleName], localeParts = locale.split("-"), current = "", i = 0; i<localeParts.length; i++){
  2522. current += (current ? "-" : "") + localeParts[i];
  2523. if(!root || root[current]){
  2524. result.push(bundlePath + current + "/" + bundleName);
  2525. }
  2526. }
  2527. return result;
  2528. },
  2529. cache = {},
  2530. getBundleName = function(moduleName, bundleName, locale){
  2531. locale = locale ? locale.toLowerCase() : dojo.locale;
  2532. moduleName = moduleName.replace(/\./g, "/");
  2533. bundleName = bundleName.replace(/\./g, "/");
  2534. return (/root/i.test(locale)) ?
  2535. (moduleName + "/nls/" + bundleName) :
  2536. (moduleName + "/nls/" + locale + "/" + bundleName);
  2537. },
  2538. getL10nName = dojo.getL10nName = function(moduleName, bundleName, locale){
  2539. return moduleName = module.id + "!" + getBundleName(moduleName, bundleName, locale);
  2540. },
  2541. doLoad = function(require, bundlePathAndName, bundlePath, bundleName, locale, load){
  2542. // summary:
  2543. // get the root bundle which instructs which other bundles are required to construct the localized bundle
  2544. require([bundlePathAndName], function(root){
  2545. var current = lang.clone(root.root),
  2546. availableLocales = getAvailableLocales(!root._v1x && root, locale, bundlePath, bundleName);
  2547. require(availableLocales, function(){
  2548. for (var i = 1; i<availableLocales.length; i++){
  2549. current = lang.mixin(lang.clone(current), arguments[i]);
  2550. }
  2551. // target may not have been resolve (e.g., maybe only "fr" exists when "fr-ca" was requested)
  2552. var target = bundlePathAndName + "/" + locale;
  2553. cache[target] = current;
  2554. load();
  2555. });
  2556. });
  2557. },
  2558. normalize = function(id, toAbsMid){
  2559. // summary:
  2560. // id may be relative.
  2561. // preload has form `*preload*<path>/nls/<module>*<flattened locales>` and
  2562. // therefore never looks like a relative
  2563. return /^\./.test(id) ? toAbsMid(id) : id;
  2564. },
  2565. getLocalesToLoad = function(targetLocale){
  2566. var list = config.extraLocale || [];
  2567. list = lang.isArray(list) ? list : [list];
  2568. list.push(targetLocale);
  2569. return list;
  2570. },
  2571. load = function(id, require, load){
  2572. // summary:
  2573. // id is in one of the following formats
  2574. //
  2575. // 1. <path>/nls/<bundle>
  2576. // => load the bundle, localized to config.locale; load all bundles localized to
  2577. // config.extraLocale (if any); return the loaded bundle localized to config.locale.
  2578. //
  2579. // 2. <path>/nls/<locale>/<bundle>
  2580. // => load then return the bundle localized to <locale>
  2581. //
  2582. // 3. *preload*<path>/nls/<module>*<JSON array of available locales>
  2583. // => for config.locale and all config.extraLocale, load all bundles found
  2584. // in the best-matching bundle rollup. A value of 1 is returned, which
  2585. // is meaningless other than to say the plugin is executing the requested
  2586. // preloads
  2587. //
  2588. // In cases 1 and 2, <path> is always normalized to an absolute module id upon entry; see
  2589. // normalize. In case 3, it <path> is assumed to be absolute; this is arranged by the builder.
  2590. //
  2591. // To load a bundle means to insert the bundle into the plugin's cache and publish the bundle
  2592. // value to the loader. Given <path>, <bundle>, and a particular <locale>, the cache key
  2593. //
  2594. // <path>/nls/<bundle>/<locale>
  2595. //
  2596. // will hold the value. Similarly, then plugin will publish this value to the loader by
  2597. //
  2598. // define("<path>/nls/<bundle>/<locale>", <bundle-value>);
  2599. //
  2600. // Given this algorithm, other machinery can provide fast load paths be preplacing
  2601. // values in the plugin's cache, which is public. When a load is demanded the
  2602. // cache is inspected before starting any loading. Explicitly placing values in the plugin
  2603. // cache is an advanced/experimental feature that should not be needed; use at your own risk.
  2604. //
  2605. // For the normal AMD algorithm, the root bundle is loaded first, which instructs the
  2606. // plugin what additional localized bundles are required for a particular locale. These
  2607. // additional locales are loaded and a mix of the root and each progressively-specific
  2608. // locale is returned. For example:
  2609. //
  2610. // 1. The client demands "dojo/i18n!some/path/nls/someBundle
  2611. //
  2612. // 2. The loader demands load(some/path/nls/someBundle)
  2613. //
  2614. // 3. This plugin require's "some/path/nls/someBundle", which is the root bundle.
  2615. //
  2616. // 4. Assuming config.locale is "ab-cd-ef" and the root bundle indicates that localizations
  2617. // are available for "ab" and "ab-cd-ef" (note the missing "ab-cd", then the plugin
  2618. // requires "some/path/nls/ab/someBundle" and "some/path/nls/ab-cd-ef/someBundle"
  2619. //
  2620. // 5. Upon receiving all required bundles, the plugin constructs the value of the bundle
  2621. // ab-cd-ef as...
  2622. //
  2623. // mixin(mixin(mixin({}, require("some/path/nls/someBundle"),
  2624. // require("some/path/nls/ab/someBundle")),
  2625. // require("some/path/nls/ab-cd-ef/someBundle"));
  2626. //
  2627. // This value is inserted into the cache and published to the loader at the
  2628. // key/module-id some/path/nls/someBundle/ab-cd-ef.
  2629. //
  2630. // The special preload signature (case 3) instructs the plugin to stop servicing all normal requests
  2631. // (further preload requests will be serviced) until all ongoing preloading has completed.
  2632. //
  2633. // The preload signature instructs the plugin that a special rollup module is available that contains
  2634. // one or more flattened, localized bundles. The JSON array of available locales indicates which locales
  2635. // are available. Here is an example:
  2636. //
  2637. // *preload*some/path/nls/someModule*["root", "ab", "ab-cd-ef"]
  2638. //
  2639. // This indicates the following rollup modules are available:
  2640. //
  2641. // some/path/nls/someModule_ROOT
  2642. // some/path/nls/someModule_ab
  2643. // some/path/nls/someModule_ab-cd-ef
  2644. //
  2645. // Each of these modules is a normal AMD module that contains one or more flattened bundles in a hash.
  2646. // For example, assume someModule contained the bundles some/bundle/path/someBundle and
  2647. // some/bundle/path/someOtherBundle, then some/path/nls/someModule_ab would be expressed as follows:
  2648. //
  2649. // define({
  2650. // some/bundle/path/someBundle:<value of someBundle, flattened with respect to locale ab>,
  2651. // some/bundle/path/someOtherBundle:<value of someOtherBundle, flattened with respect to locale ab>,
  2652. // });
  2653. //
  2654. // E.g., given this design, preloading for locale=="ab" can execute the following algorithm:
  2655. //
  2656. // require(["some/path/nls/someModule_ab"], function(rollup){
  2657. // for(var p in rollup){
  2658. // var id = p + "/ab",
  2659. // cache[id] = rollup[p];
  2660. // define(id, rollup[p]);
  2661. // }
  2662. // });
  2663. //
  2664. // Similarly, if "ab-cd" is requested, the algorithm can determine that "ab" is the best available and
  2665. // load accordingly.
  2666. //
  2667. // The builder will write such rollups for every layer if a non-empty localeList profile property is
  2668. // provided. Further, the builder will include the following cache entry in the cache associated with
  2669. // any layer.
  2670. //
  2671. // "*now":function(r){r(['dojo/i18n!*preload*<path>/nls/<module>*<JSON array of available locales>']);}
  2672. //
  2673. // The *now special cache module instructs the loader to apply the provided function to context-require
  2674. // with respect to the particular layer being defined. This causes the plugin to hold all normal service
  2675. // requests until all preloading is complete.
  2676. //
  2677. // Notice that this algorithm is rarely better than the standard AMD load algorithm. Consider the normal case
  2678. // where the target locale has a single segment and a layer depends on a single bundle:
  2679. //
  2680. // Without Preloads:
  2681. //
  2682. // 1. Layer loads root bundle.
  2683. // 2. bundle is demanded; plugin loads single localized bundle.
  2684. //
  2685. // With Preloads:
  2686. //
  2687. // 1. Layer causes preloading of target bundle.
  2688. // 2. bundle is demanded; service is delayed until preloading complete; bundle is returned.
  2689. //
  2690. // In each case a single transaction is required to load the target bundle. In cases where multiple bundles
  2691. // are required and/or the locale has multiple segments, preloads still requires a single transaction whereas
  2692. // the normal path requires an additional transaction for each additional bundle/locale-segment. However all
  2693. // of these additional transactions can be done concurrently. Owing to this analysis, the entire preloading
  2694. // algorithm can be discard during a build by setting the has feature dojo-preload-i18n-Api to false.
  2695. if(has("dojo-preload-i18n-Api")){
  2696. var split = id.split("*"),
  2697. preloadDemand = split[1] == "preload";
  2698. if(preloadDemand){
  2699. if(!cache[id]){
  2700. // use cache[id] to prevent multiple preloads of the same preload; this shouldn't happen, but
  2701. // who knows what over-aggressive human optimizers may attempt
  2702. cache[id] = 1;
  2703. preloadL10n(split[2], json.parse(split[3]), 1, require);
  2704. }
  2705. // don't stall the loader!
  2706. load(1);
  2707. }
  2708. if(preloadDemand || waitForPreloads(id, require, load)){
  2709. return;
  2710. }
  2711. }
  2712. var match = nlsRe.exec(id),
  2713. bundlePath = match[1] + "/",
  2714. bundleName = match[5] || match[4],
  2715. bundlePathAndName = bundlePath + bundleName,
  2716. localeSpecified = (match[5] && match[4]),
  2717. targetLocale = localeSpecified || dojo.locale,
  2718. loadTarget = bundlePathAndName + "/" + targetLocale,
  2719. loadList = localeSpecified ? [targetLocale] : getLocalesToLoad(targetLocale),
  2720. remaining = loadList.length,
  2721. finish = function(){
  2722. if(!--remaining){
  2723. load(lang.delegate(cache[loadTarget]));
  2724. }
  2725. };
  2726. array.forEach(loadList, function(locale){
  2727. var target = bundlePathAndName + "/" + locale;
  2728. if(has("dojo-preload-i18n-Api")){
  2729. checkForLegacyModules(target);
  2730. }
  2731. if(!cache[target]){
  2732. doLoad(require, bundlePathAndName, bundlePath, bundleName, locale, finish);
  2733. }else{
  2734. finish();
  2735. }
  2736. });
  2737. };
  2738. if(has("dojo-unit-tests")){
  2739. var unitTests = thisModule.unitTests = [];
  2740. }
  2741. if(has("dojo-preload-i18n-Api") || 1 ){
  2742. var normalizeLocale = thisModule.normalizeLocale = function(locale){
  2743. var result = locale ? locale.toLowerCase() : dojo.locale;
  2744. return result == "root" ? "ROOT" : result;
  2745. },
  2746. isXd = function(mid, contextRequire){
  2747. return ( 1 && 1 ) ?
  2748. contextRequire.isXdUrl(require.toUrl(mid + ".js")) :
  2749. true;
  2750. },
  2751. preloading = 0,
  2752. preloadWaitQueue = [],
  2753. preloadL10n = thisModule._preloadLocalizations = function(/*String*/bundlePrefix, /*Array*/localesGenerated, /*boolean?*/ guaranteedAmdFormat, /*function?*/ contextRequire){
  2754. // summary:
  2755. // Load available flattened resource bundles associated with a particular module for dojo/locale and all dojo/config.extraLocale (if any)
  2756. // description:
  2757. // Only called by built layer files. The entire locale hierarchy is loaded. For example,
  2758. // if locale=="ab-cd", then ROOT, "ab", and "ab-cd" are loaded. This is different than v1.6-
  2759. // in that the v1.6- would only load ab-cd...which was *always* flattened.
  2760. //
  2761. // If guaranteedAmdFormat is true, then the module can be loaded with require thereby circumventing the detection algorithm
  2762. // and the extra possible extra transaction.
  2763. // If this function is called from legacy code, then guaranteedAmdFormat and contextRequire will be undefined. Since the function
  2764. // needs a require in order to resolve module ids, fall back to the context-require associated with this dojo/i18n module, which
  2765. // itself may have been mapped.
  2766. contextRequire = contextRequire || require;
  2767. function doRequire(mid, callback){
  2768. if(isXd(mid, contextRequire) || guaranteedAmdFormat){
  2769. contextRequire([mid], callback);
  2770. }else{
  2771. syncRequire([mid], callback, contextRequire);
  2772. }
  2773. }
  2774. function forEachLocale(locale, func){
  2775. // given locale= "ab-cd-ef", calls func on "ab-cd-ef", "ab-cd", "ab", "ROOT"; stops calling the first time func returns truthy
  2776. var parts = locale.split("-");
  2777. while(parts.length){
  2778. if(func(parts.join("-"))){
  2779. return;
  2780. }
  2781. parts.pop();
  2782. }
  2783. func("ROOT");
  2784. }
  2785. function preload(locale){
  2786. locale = normalizeLocale(locale);
  2787. forEachLocale(locale, function(loc){
  2788. if(array.indexOf(localesGenerated, loc)>=0){
  2789. var mid = bundlePrefix.replace(/\./g, "/")+"_"+loc;
  2790. preloading++;
  2791. doRequire(mid, function(rollup){
  2792. for(var p in rollup){
  2793. cache[require.toAbsMid(p) + "/" + loc] = rollup[p];
  2794. }
  2795. --preloading;
  2796. while(!preloading && preloadWaitQueue.length){
  2797. load.apply(null, preloadWaitQueue.shift());
  2798. }
  2799. });
  2800. return true;
  2801. }
  2802. return false;
  2803. });
  2804. }
  2805. preload();
  2806. array.forEach(dojo.config.extraLocale, preload);
  2807. },
  2808. waitForPreloads = function(id, require, load){
  2809. if(preloading){
  2810. preloadWaitQueue.push([id, require, load]);
  2811. }
  2812. return preloading;
  2813. },
  2814. checkForLegacyModules = function()
  2815. {};
  2816. }
  2817. if( 1 ){
  2818. // this code path assumes the dojo loader and won't work with a standard AMD loader
  2819. var amdValue = {},
  2820. evalBundle =
  2821. // use the function ctor to keep the minifiers away (also come close to global scope, but this is secondary)
  2822. new Function(
  2823. "__bundle", // the bundle to evalutate
  2824. "__checkForLegacyModules", // a function that checks if __bundle defined __mid in the global space
  2825. "__mid", // the mid that __bundle is intended to define
  2826. "__amdValue",
  2827. // returns one of:
  2828. // 1 => the bundle was an AMD bundle
  2829. // a legacy bundle object that is the value of __mid
  2830. // instance of Error => could not figure out how to evaluate bundle
  2831. // used to detect when __bundle calls define
  2832. "var define = function(mid, factory){define.called = 1; __amdValue.result = factory || mid;},"
  2833. + " require = function(){define.called = 1;};"
  2834. + "try{"
  2835. + "define.called = 0;"
  2836. + "eval(__bundle);"
  2837. + "if(define.called==1)"
  2838. // bundle called define; therefore signal it's an AMD bundle
  2839. + "return __amdValue;"
  2840. + "if((__checkForLegacyModules = __checkForLegacyModules(__mid)))"
  2841. // bundle was probably a v1.6- built NLS flattened NLS bundle that defined __mid in the global space
  2842. + "return __checkForLegacyModules;"
  2843. + "}catch(e){}"
  2844. // evaulating the bundle was *neither* an AMD *nor* a legacy flattened bundle
  2845. // either way, re-eval *after* surrounding with parentheses
  2846. + "try{"
  2847. + "return eval('('+__bundle+')');"
  2848. + "}catch(e){"
  2849. + "return e;"
  2850. + "}"
  2851. ),
  2852. syncRequire = function(deps, callback, require){
  2853. var results = [];
  2854. array.forEach(deps, function(mid){
  2855. var url = require.toUrl(mid + ".js");
  2856. function load(text){
  2857. var result = evalBundle(text, checkForLegacyModules, mid, amdValue);
  2858. if(result===amdValue){
  2859. // the bundle was an AMD module; re-inject it through the normal AMD path
  2860. // we gotta do this since it could be an anonymous module and simply evaluating
  2861. // the text here won't provide the loader with the context to know what
  2862. // module is being defined()'d. With browser caching, this should be free; further
  2863. // this entire code path can be circumvented by using the AMD format to begin with
  2864. results.push(cache[url] = amdValue.result);
  2865. }else{
  2866. if(result instanceof Error){
  2867. console.error("failed to evaluate i18n bundle; url=" + url, result);
  2868. result = {};
  2869. }
  2870. // nls/<locale>/<bundle-name> indicates not the root.
  2871. results.push(cache[url] = (/nls\/[^\/]+\/[^\/]+$/.test(url) ? result : {root:result, _v1x:1}));
  2872. }
  2873. }
  2874. if(cache[url]){
  2875. results.push(cache[url]);
  2876. }else{
  2877. var bundle = require.syncLoadNls(mid);
  2878. // don't need to check for legacy since syncLoadNls returns a module if the module
  2879. // (1) was already loaded, or (2) was in the cache. In case 1, if syncRequire is called
  2880. // from getLocalization --> load, then load will have called checkForLegacyModules() before
  2881. // calling syncRequire; if syncRequire is called from preloadLocalizations, then we
  2882. // don't care about checkForLegacyModules() because that will be done when a particular
  2883. // bundle is actually demanded. In case 2, checkForLegacyModules() is never relevant
  2884. // because cached modules are always v1.7+ built modules.
  2885. if(bundle){
  2886. results.push(bundle);
  2887. }else{
  2888. if(!xhr){
  2889. try{
  2890. require.getText(url, true, load);
  2891. }catch(e){
  2892. results.push(cache[url] = {});
  2893. }
  2894. }else{
  2895. xhr.get({
  2896. url:url,
  2897. sync:true,
  2898. load:load,
  2899. error:function(){
  2900. results.push(cache[url] = {});
  2901. }
  2902. });
  2903. }
  2904. }
  2905. }
  2906. });
  2907. callback && callback.apply(null, results);
  2908. };
  2909. checkForLegacyModules = function(target){
  2910. // legacy code may have already loaded [e.g] the raw bundle x/y/z at x.y.z; when true, push into the cache
  2911. for(var result, names = target.split("/"), object = dojo.global[names[0]], i = 1; object && i<names.length-1; object = object[names[i++]]){}
  2912. if(object){
  2913. result = object[names[i]];
  2914. if(!result){
  2915. // fallback for incorrect bundle build of 1.6
  2916. result = object[names[i].replace(/-/g,"_")];
  2917. }
  2918. if(result){
  2919. cache[target] = result;
  2920. }
  2921. }
  2922. return result;
  2923. };
  2924. thisModule.getLocalization = function(moduleName, bundleName, locale){
  2925. var result,
  2926. l10nName = getBundleName(moduleName, bundleName, locale);
  2927. load(
  2928. l10nName,
  2929. // isXd() and syncRequire() need a context-require in order to resolve the mid with respect to a reference module.
  2930. // Since this legacy function does not have the concept of a reference module, resolve with respect to this
  2931. // dojo/i18n module, which, itself may have been mapped.
  2932. (!isXd(l10nName, require) ? function(deps, callback){ syncRequire(deps, callback, require); } : require),
  2933. function(result_){ result = result_; }
  2934. );
  2935. return result;
  2936. };
  2937. if(has("dojo-unit-tests")){
  2938. unitTests.push(function(doh){
  2939. doh.register("tests.i18n.unit", function(t){
  2940. var check;
  2941. check = evalBundle("{prop:1}", checkForLegacyModules, "nonsense", amdValue);
  2942. t.is({prop:1}, check); t.is(undefined, check[1]);
  2943. check = evalBundle("({prop:1})", checkForLegacyModules, "nonsense", amdValue);
  2944. t.is({prop:1}, check); t.is(undefined, check[1]);
  2945. check = evalBundle("{'prop-x':1}", checkForLegacyModules, "nonsense", amdValue);
  2946. t.is({'prop-x':1}, check); t.is(undefined, check[1]);
  2947. check = evalBundle("({'prop-x':1})", checkForLegacyModules, "nonsense", amdValue);
  2948. t.is({'prop-x':1}, check); t.is(undefined, check[1]);
  2949. check = evalBundle("define({'prop-x':1})", checkForLegacyModules, "nonsense", amdValue);
  2950. t.is(amdValue, check); t.is({'prop-x':1}, amdValue.result);
  2951. check = evalBundle("define('some/module', {'prop-x':1})", checkForLegacyModules, "nonsense", amdValue);
  2952. t.is(amdValue, check); t.is({'prop-x':1}, amdValue.result);
  2953. check = evalBundle("this is total nonsense and should throw an error", checkForLegacyModules, "nonsense", amdValue);
  2954. t.is(check instanceof Error, true);
  2955. });
  2956. });
  2957. }
  2958. }
  2959. return lang.mixin(thisModule, {
  2960. dynamic:true,
  2961. normalize:normalize,
  2962. load:load,
  2963. cache:cache
  2964. });
  2965. });
  2966. },
  2967. 'dojo/promise/tracer':function(){
  2968. define([
  2969. "../_base/lang",
  2970. "./Promise",
  2971. "../Evented"
  2972. ], function(lang, Promise, Evented){
  2973. "use strict";
  2974. // module:
  2975. // dojo/promise/tracer
  2976. /*=====
  2977. return {
  2978. // summary:
  2979. // Trace promise fulfillment.
  2980. // description:
  2981. // Trace promise fulfillment. Calling `.trace()` or `.traceError()` on a
  2982. // promise enables tracing. Will emit `resolved`, `rejected` or `progress`
  2983. // events.
  2984. on: function(type, listener){
  2985. // summary:
  2986. // Subscribe to traces.
  2987. // description:
  2988. // See `dojo/Evented#on()`.
  2989. // type: String
  2990. // `resolved`, `rejected`, or `progress`
  2991. // listener: Function
  2992. // The listener is passed the traced value and any arguments
  2993. // that were used with the `.trace()` call.
  2994. }
  2995. };
  2996. =====*/
  2997. var evented = new Evented;
  2998. var emit = evented.emit;
  2999. evented.emit = null;
  3000. // Emit events asynchronously since they should not change the promise state.
  3001. function emitAsync(args){
  3002. setTimeout(function(){
  3003. emit.apply(evented, args);
  3004. }, 0);
  3005. }
  3006. Promise.prototype.trace = function(){
  3007. // summary:
  3008. // Trace the promise.
  3009. // description:
  3010. // Tracing allows you to transparently log progress,
  3011. // resolution and rejection of promises, without affecting the
  3012. // promise itself. Any arguments passed to `trace()` are
  3013. // emitted in trace events. See `dojo/promise/tracer` on how
  3014. // to handle traces.
  3015. // returns: dojo/promise/Promise
  3016. // The promise instance `trace()` is called on.
  3017. var args = lang._toArray(arguments);
  3018. this.then(
  3019. function(value){ emitAsync(["resolved", value].concat(args)); },
  3020. function(error){ emitAsync(["rejected", error].concat(args)); },
  3021. function(update){ emitAsync(["progress", update].concat(args)); }
  3022. );
  3023. return this;
  3024. };
  3025. Promise.prototype.traceRejected = function(){
  3026. // summary:
  3027. // Trace rejection of the promise.
  3028. // description:
  3029. // Tracing allows you to transparently log progress,
  3030. // resolution and rejection of promises, without affecting the
  3031. // promise itself. Any arguments passed to `trace()` are
  3032. // emitted in trace events. See `dojo/promise/tracer` on how
  3033. // to handle traces.
  3034. // returns: dojo/promise/Promise
  3035. // The promise instance `traceRejected()` is called on.
  3036. var args = lang._toArray(arguments);
  3037. this.otherwise(function(error){
  3038. emitAsync(["rejected", error].concat(args));
  3039. });
  3040. return this;
  3041. };
  3042. return evented;
  3043. });
  3044. },
  3045. 'dojo/errors/RequestError':function(){
  3046. define(['./create'], function(create){
  3047. // module:
  3048. // dojo/errors/RequestError
  3049. /*=====
  3050. return function(){
  3051. // summary:
  3052. // TODOC
  3053. };
  3054. =====*/
  3055. return create("RequestError", function(message, response){
  3056. this.response = response;
  3057. });
  3058. });
  3059. },
  3060. 'dojo/_base/html':function(){
  3061. define("dojo/_base/html", ["./kernel", "../dom", "../dom-style", "../dom-attr", "../dom-prop", "../dom-class", "../dom-construct", "../dom-geometry"], function(dojo, dom, style, attr, prop, cls, ctr, geom){
  3062. // module:
  3063. // dojo/dom
  3064. /*=====
  3065. return {
  3066. // summary:
  3067. // This module is a stub for the core dojo DOM API.
  3068. };
  3069. =====*/
  3070. // mix-in dom
  3071. dojo.byId = dom.byId;
  3072. dojo.isDescendant = dom.isDescendant;
  3073. dojo.setSelectable = dom.setSelectable;
  3074. // mix-in dom-attr
  3075. dojo.getAttr = attr.get;
  3076. dojo.setAttr = attr.set;
  3077. dojo.hasAttr = attr.has;
  3078. dojo.removeAttr = attr.remove;
  3079. dojo.getNodeProp = attr.getNodeProp;
  3080. dojo.attr = function(node, name, value){
  3081. // summary:
  3082. // Gets or sets an attribute on an HTML element.
  3083. // description:
  3084. // Handles normalized getting and setting of attributes on DOM
  3085. // Nodes. If 2 arguments are passed, and a the second argument is a
  3086. // string, acts as a getter.
  3087. //
  3088. // If a third argument is passed, or if the second argument is a
  3089. // map of attributes, acts as a setter.
  3090. //
  3091. // When passing functions as values, note that they will not be
  3092. // directly assigned to slots on the node, but rather the default
  3093. // behavior will be removed and the new behavior will be added
  3094. // using `dojo.connect()`, meaning that event handler properties
  3095. // will be normalized and that some caveats with regards to
  3096. // non-standard behaviors for onsubmit apply. Namely that you
  3097. // should cancel form submission using `dojo.stopEvent()` on the
  3098. // passed event object instead of returning a boolean value from
  3099. // the handler itself.
  3100. // node: DOMNode|String
  3101. // id or reference to the element to get or set the attribute on
  3102. // name: String|Object
  3103. // the name of the attribute to get or set.
  3104. // value: String?
  3105. // The value to set for the attribute
  3106. // returns:
  3107. // when used as a getter, the value of the requested attribute
  3108. // or null if that attribute does not have a specified or
  3109. // default value;
  3110. //
  3111. // when used as a setter, the DOM node
  3112. //
  3113. // example:
  3114. // | // get the current value of the "foo" attribute on a node
  3115. // | dojo.attr(dojo.byId("nodeId"), "foo");
  3116. // | // or we can just pass the id:
  3117. // | dojo.attr("nodeId", "foo");
  3118. //
  3119. // example:
  3120. // | // use attr() to set the tab index
  3121. // | dojo.attr("nodeId", "tabIndex", 3);
  3122. // |
  3123. //
  3124. // example:
  3125. // Set multiple values at once, including event handlers:
  3126. // | dojo.attr("formId", {
  3127. // | "foo": "bar",
  3128. // | "tabIndex": -1,
  3129. // | "method": "POST",
  3130. // | "onsubmit": function(e){
  3131. // | // stop submitting the form. Note that the IE behavior
  3132. // | // of returning true or false will have no effect here
  3133. // | // since our handler is connect()ed to the built-in
  3134. // | // onsubmit behavior and so we need to use
  3135. // | // dojo.stopEvent() to ensure that the submission
  3136. // | // doesn't proceed.
  3137. // | dojo.stopEvent(e);
  3138. // |
  3139. // | // submit the form with Ajax
  3140. // | dojo.xhrPost({ form: "formId" });
  3141. // | }
  3142. // | });
  3143. //
  3144. // example:
  3145. // Style is s special case: Only set with an object hash of styles
  3146. // | dojo.attr("someNode",{
  3147. // | id:"bar",
  3148. // | style:{
  3149. // | width:"200px", height:"100px", color:"#000"
  3150. // | }
  3151. // | });
  3152. //
  3153. // example:
  3154. // Again, only set style as an object hash of styles:
  3155. // | var obj = { color:"#fff", backgroundColor:"#000" };
  3156. // | dojo.attr("someNode", "style", obj);
  3157. // |
  3158. // | // though shorter to use `dojo.style()` in this case:
  3159. // | dojo.style("someNode", obj);
  3160. if(arguments.length == 2){
  3161. return attr[typeof name == "string" ? "get" : "set"](node, name);
  3162. }
  3163. return attr.set(node, name, value);
  3164. };
  3165. // mix-in dom-class
  3166. dojo.hasClass = cls.contains;
  3167. dojo.addClass = cls.add;
  3168. dojo.removeClass = cls.remove;
  3169. dojo.toggleClass = cls.toggle;
  3170. dojo.replaceClass = cls.replace;
  3171. // mix-in dom-construct
  3172. dojo._toDom = dojo.toDom = ctr.toDom;
  3173. dojo.place = ctr.place;
  3174. dojo.create = ctr.create;
  3175. dojo.empty = function(node){ ctr.empty(node); };
  3176. dojo._destroyElement = dojo.destroy = function(node){ ctr.destroy(node); };
  3177. // mix-in dom-geometry
  3178. dojo._getPadExtents = dojo.getPadExtents = geom.getPadExtents;
  3179. dojo._getBorderExtents = dojo.getBorderExtents = geom.getBorderExtents;
  3180. dojo._getPadBorderExtents = dojo.getPadBorderExtents = geom.getPadBorderExtents;
  3181. dojo._getMarginExtents = dojo.getMarginExtents = geom.getMarginExtents;
  3182. dojo._getMarginSize = dojo.getMarginSize = geom.getMarginSize;
  3183. dojo._getMarginBox = dojo.getMarginBox = geom.getMarginBox;
  3184. dojo.setMarginBox = geom.setMarginBox;
  3185. dojo._getContentBox = dojo.getContentBox = geom.getContentBox;
  3186. dojo.setContentSize = geom.setContentSize;
  3187. dojo._isBodyLtr = dojo.isBodyLtr = geom.isBodyLtr;
  3188. dojo._docScroll = dojo.docScroll = geom.docScroll;
  3189. dojo._getIeDocumentElementOffset = dojo.getIeDocumentElementOffset = geom.getIeDocumentElementOffset;
  3190. dojo._fixIeBiDiScrollLeft = dojo.fixIeBiDiScrollLeft = geom.fixIeBiDiScrollLeft;
  3191. dojo.position = geom.position;
  3192. dojo.marginBox = function marginBox(/*DomNode|String*/node, /*Object?*/box){
  3193. // summary:
  3194. // Getter/setter for the margin-box of node.
  3195. // description:
  3196. // Getter/setter for the margin-box of node.
  3197. // Returns an object in the expected format of box (regardless
  3198. // if box is passed). The object might look like:
  3199. // `{ l: 50, t: 200, w: 300: h: 150 }`
  3200. // for a node offset from its parent 50px to the left, 200px from
  3201. // the top with a margin width of 300px and a margin-height of
  3202. // 150px.
  3203. // node:
  3204. // id or reference to DOM Node to get/set box for
  3205. // box:
  3206. // If passed, denotes that dojo.marginBox() should
  3207. // update/set the margin box for node. Box is an object in the
  3208. // above format. All properties are optional if passed.
  3209. // example:
  3210. // Retrieve the margin box of a passed node
  3211. // | var box = dojo.marginBox("someNodeId");
  3212. // | console.dir(box);
  3213. //
  3214. // example:
  3215. // Set a node's margin box to the size of another node
  3216. // | var box = dojo.marginBox("someNodeId");
  3217. // | dojo.marginBox("someOtherNode", box);
  3218. return box ? geom.setMarginBox(node, box) : geom.getMarginBox(node); // Object
  3219. };
  3220. dojo.contentBox = function contentBox(/*DomNode|String*/node, /*Object?*/box){
  3221. // summary:
  3222. // Getter/setter for the content-box of node.
  3223. // description:
  3224. // Returns an object in the expected format of box (regardless if box is passed).
  3225. // The object might look like:
  3226. // `{ l: 50, t: 200, w: 300: h: 150 }`
  3227. // for a node offset from its parent 50px to the left, 200px from
  3228. // the top with a content width of 300px and a content-height of
  3229. // 150px. Note that the content box may have a much larger border
  3230. // or margin box, depending on the box model currently in use and
  3231. // CSS values set/inherited for node.
  3232. // While the getter will return top and left values, the
  3233. // setter only accepts setting the width and height.
  3234. // node:
  3235. // id or reference to DOM Node to get/set box for
  3236. // box:
  3237. // If passed, denotes that dojo.contentBox() should
  3238. // update/set the content box for node. Box is an object in the
  3239. // above format, but only w (width) and h (height) are supported.
  3240. // All properties are optional if passed.
  3241. return box ? geom.setContentSize(node, box) : geom.getContentBox(node); // Object
  3242. };
  3243. dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
  3244. // summary:
  3245. // Deprecated: Use position() for border-box x/y/w/h
  3246. // or marginBox() for margin-box w/h/l/t.
  3247. //
  3248. // Returns an object that measures margin-box (w)idth/(h)eight
  3249. // and absolute position x/y of the border-box. Also returned
  3250. // is computed (l)eft and (t)op values in pixels from the
  3251. // node's offsetParent as returned from marginBox().
  3252. // Return value will be in the form:
  3253. //| { l: 50, t: 200, w: 300: h: 150, x: 100, y: 300 }
  3254. // Does not act as a setter. If includeScroll is passed, the x and
  3255. // y params are affected as one would expect in dojo.position().
  3256. dojo.deprecated("dojo.coords()", "Use dojo.position() or dojo.marginBox().");
  3257. node = dom.byId(node);
  3258. var s = style.getComputedStyle(node), mb = geom.getMarginBox(node, s);
  3259. var abs = geom.position(node, includeScroll);
  3260. mb.x = abs.x;
  3261. mb.y = abs.y;
  3262. return mb; // Object
  3263. };
  3264. // mix-in dom-prop
  3265. dojo.getProp = prop.get;
  3266. dojo.setProp = prop.set;
  3267. dojo.prop = function(/*DomNode|String*/node, /*String|Object*/name, /*String?*/value){
  3268. // summary:
  3269. // Gets or sets a property on an HTML element.
  3270. // description:
  3271. // Handles normalized getting and setting of properties on DOM
  3272. // Nodes. If 2 arguments are passed, and a the second argument is a
  3273. // string, acts as a getter.
  3274. //
  3275. // If a third argument is passed, or if the second argument is a
  3276. // map of attributes, acts as a setter.
  3277. //
  3278. // When passing functions as values, note that they will not be
  3279. // directly assigned to slots on the node, but rather the default
  3280. // behavior will be removed and the new behavior will be added
  3281. // using `dojo.connect()`, meaning that event handler properties
  3282. // will be normalized and that some caveats with regards to
  3283. // non-standard behaviors for onsubmit apply. Namely that you
  3284. // should cancel form submission using `dojo.stopEvent()` on the
  3285. // passed event object instead of returning a boolean value from
  3286. // the handler itself.
  3287. // node:
  3288. // id or reference to the element to get or set the property on
  3289. // name:
  3290. // the name of the property to get or set.
  3291. // value:
  3292. // The value to set for the property
  3293. // returns:
  3294. // when used as a getter, the value of the requested property
  3295. // or null if that attribute does not have a specified or
  3296. // default value;
  3297. //
  3298. // when used as a setter, the DOM node
  3299. //
  3300. // example:
  3301. // | // get the current value of the "foo" property on a node
  3302. // | dojo.prop(dojo.byId("nodeId"), "foo");
  3303. // | // or we can just pass the id:
  3304. // | dojo.prop("nodeId", "foo");
  3305. //
  3306. // example:
  3307. // | // use prop() to set the tab index
  3308. // | dojo.prop("nodeId", "tabIndex", 3);
  3309. // |
  3310. //
  3311. // example:
  3312. // Set multiple values at once, including event handlers:
  3313. // | dojo.prop("formId", {
  3314. // | "foo": "bar",
  3315. // | "tabIndex": -1,
  3316. // | "method": "POST",
  3317. // | "onsubmit": function(e){
  3318. // | // stop submitting the form. Note that the IE behavior
  3319. // | // of returning true or false will have no effect here
  3320. // | // since our handler is connect()ed to the built-in
  3321. // | // onsubmit behavior and so we need to use
  3322. // | // dojo.stopEvent() to ensure that the submission
  3323. // | // doesn't proceed.
  3324. // | dojo.stopEvent(e);
  3325. // |
  3326. // | // submit the form with Ajax
  3327. // | dojo.xhrPost({ form: "formId" });
  3328. // | }
  3329. // | });
  3330. //
  3331. // example:
  3332. // Style is s special case: Only set with an object hash of styles
  3333. // | dojo.prop("someNode",{
  3334. // | id:"bar",
  3335. // | style:{
  3336. // | width:"200px", height:"100px", color:"#000"
  3337. // | }
  3338. // | });
  3339. //
  3340. // example:
  3341. // Again, only set style as an object hash of styles:
  3342. // | var obj = { color:"#fff", backgroundColor:"#000" };
  3343. // | dojo.prop("someNode", "style", obj);
  3344. // |
  3345. // | // though shorter to use `dojo.style()` in this case:
  3346. // | dojo.style("someNode", obj);
  3347. if(arguments.length == 2){
  3348. return prop[typeof name == "string" ? "get" : "set"](node, name);
  3349. }
  3350. // setter
  3351. return prop.set(node, name, value);
  3352. };
  3353. // mix-in dom-style
  3354. dojo.getStyle = style.get;
  3355. dojo.setStyle = style.set;
  3356. dojo.getComputedStyle = style.getComputedStyle;
  3357. dojo.__toPixelValue = dojo.toPixelValue = style.toPixelValue;
  3358. dojo.style = function(node, name, value){
  3359. // summary:
  3360. // Accesses styles on a node. If 2 arguments are
  3361. // passed, acts as a getter. If 3 arguments are passed, acts
  3362. // as a setter.
  3363. // description:
  3364. // Getting the style value uses the computed style for the node, so the value
  3365. // will be a calculated value, not just the immediate node.style value.
  3366. // Also when getting values, use specific style names,
  3367. // like "borderBottomWidth" instead of "border" since compound values like
  3368. // "border" are not necessarily reflected as expected.
  3369. // If you want to get node dimensions, use `dojo.marginBox()`,
  3370. // `dojo.contentBox()` or `dojo.position()`.
  3371. // node: DOMNode|String
  3372. // id or reference to node to get/set style for
  3373. // name: String|Object?
  3374. // the style property to set in DOM-accessor format
  3375. // ("borderWidth", not "border-width") or an object with key/value
  3376. // pairs suitable for setting each property.
  3377. // value: String?
  3378. // If passed, sets value on the node for style, handling
  3379. // cross-browser concerns. When setting a pixel value,
  3380. // be sure to include "px" in the value. For instance, top: "200px".
  3381. // Otherwise, in some cases, some browsers will not apply the style.
  3382. // returns:
  3383. // when used as a getter, return the computed style of the node if passing in an ID or node,
  3384. // or return the normalized, computed value for the property when passing in a node and a style property
  3385. // example:
  3386. // Passing only an ID or node returns the computed style object of
  3387. // the node:
  3388. // | dojo.style("thinger");
  3389. // example:
  3390. // Passing a node and a style property returns the current
  3391. // normalized, computed value for that property:
  3392. // | dojo.style("thinger", "opacity"); // 1 by default
  3393. //
  3394. // example:
  3395. // Passing a node, a style property, and a value changes the
  3396. // current display of the node and returns the new computed value
  3397. // | dojo.style("thinger", "opacity", 0.5); // == 0.5
  3398. //
  3399. // example:
  3400. // Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
  3401. // | dojo.style("thinger", {
  3402. // | "opacity": 0.5,
  3403. // | "border": "3px solid black",
  3404. // | "height": "300px"
  3405. // | });
  3406. //
  3407. // example:
  3408. // When the CSS style property is hyphenated, the JavaScript property is camelCased.
  3409. // font-size becomes fontSize, and so on.
  3410. // | dojo.style("thinger",{
  3411. // | fontSize:"14pt",
  3412. // | letterSpacing:"1.2em"
  3413. // | });
  3414. //
  3415. // example:
  3416. // dojo/NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
  3417. // dojo.style() on every element of the list. See: `dojo/query` and `dojo/NodeList`
  3418. // | dojo.query(".someClassName").style("visibility","hidden");
  3419. // | // or
  3420. // | dojo.query("#baz > div").style({
  3421. // | opacity:0.75,
  3422. // | fontSize:"13pt"
  3423. // | });
  3424. switch(arguments.length){
  3425. case 1:
  3426. return style.get(node);
  3427. case 2:
  3428. return style[typeof name == "string" ? "get" : "set"](node, name);
  3429. }
  3430. // setter
  3431. return style.set(node, name, value);
  3432. };
  3433. return dojo;
  3434. });
  3435. },
  3436. 'dojo/_base/kernel':function(){
  3437. define(["../has", "./config", "require", "module"], function(has, config, require, module){
  3438. // module:
  3439. // dojo/_base/kernel
  3440. // This module is the foundational module of the dojo boot sequence; it defines the dojo object.
  3441. var
  3442. // loop variables for this module
  3443. i, p,
  3444. // create dojo, dijit, and dojox
  3445. // FIXME: in 2.0 remove dijit, dojox being created by dojo
  3446. dijit = {},
  3447. dojox = {},
  3448. dojo = {
  3449. // summary:
  3450. // This module is the foundational module of the dojo boot sequence; it defines the dojo object.
  3451. // notice dojo takes ownership of the value of the config module
  3452. config:config,
  3453. global:this,
  3454. dijit:dijit,
  3455. dojox:dojox
  3456. };
  3457. // Configure the scope map. For a 100% AMD application, the scope map is not needed other than to provide
  3458. // a _scopeName property for the dojo, dijit, and dojox root object so those packages can create
  3459. // unique names in the global space.
  3460. //
  3461. // Built, legacy modules use the scope map to allow those modules to be expressed as if dojo, dijit, and dojox,
  3462. // where global when in fact they are either global under different names or not global at all. In v1.6-, the
  3463. // config variable "scopeMap" was used to map names as used within a module to global names. This has been
  3464. // subsumed by the AMD map configuration variable which can relocate packages to different names. For backcompat,
  3465. // only the "*" mapping is supported. See http://livedocs.dojotoolkit.org/developer/design/loader#legacy-cross-domain-mode for details.
  3466. //
  3467. // The following computations contort the packageMap for this dojo instance into a scopeMap.
  3468. var scopeMap =
  3469. // a map from a name used in a legacy module to the (global variable name, object addressed by that name)
  3470. // always map dojo, dijit, and dojox
  3471. {
  3472. dojo:["dojo", dojo],
  3473. dijit:["dijit", dijit],
  3474. dojox:["dojox", dojox]
  3475. },
  3476. packageMap =
  3477. // the package map for this dojo instance; note, a foreign loader or no pacakgeMap results in the above default config
  3478. (require.map && require.map[module.id.match(/[^\/]+/)[0]]),
  3479. item;
  3480. // process all mapped top-level names for this instance of dojo
  3481. for(p in packageMap){
  3482. if(scopeMap[p]){
  3483. // mapped dojo, dijit, or dojox
  3484. scopeMap[p][0] = packageMap[p];
  3485. }else{
  3486. // some other top-level name
  3487. scopeMap[p] = [packageMap[p], {}];
  3488. }
  3489. }
  3490. // publish those names to _scopeName and, optionally, the global namespace
  3491. for(p in scopeMap){
  3492. item = scopeMap[p];
  3493. item[1]._scopeName = item[0];
  3494. if(!config.noGlobals){
  3495. this[item[0]] = item[1];
  3496. }
  3497. }
  3498. dojo.scopeMap = scopeMap;
  3499. /*===== dojo.__docParserConfigureScopeMap(scopeMap); =====*/
  3500. // FIXME: dojo.baseUrl and dojo.config.baseUrl should be deprecated
  3501. dojo.baseUrl = dojo.config.baseUrl = require.baseUrl;
  3502. dojo.isAsync = ! 1 || require.async;
  3503. dojo.locale = config.locale;
  3504. var rev = "$Rev: 29801 $".match(/\d+/);
  3505. dojo.version = {
  3506. // summary:
  3507. // Version number of the Dojo Toolkit
  3508. // description:
  3509. // Hash about the version, including
  3510. //
  3511. // - major: Integer: Major version. If total version is "1.2.0beta1", will be 1
  3512. // - minor: Integer: Minor version. If total version is "1.2.0beta1", will be 2
  3513. // - patch: Integer: Patch version. If total version is "1.2.0beta1", will be 0
  3514. // - flag: String: Descriptor flag. If total version is "1.2.0beta1", will be "beta1"
  3515. // - revision: Number: The SVN rev from which dojo was pulled
  3516. major: 1, minor: 8, patch: 1, flag: "",
  3517. revision: rev ? +rev[0] : NaN,
  3518. toString: function(){
  3519. var v = dojo.version;
  3520. return v.major + "." + v.minor + "." + v.patch + v.flag + " (" + v.revision + ")"; // String
  3521. }
  3522. };
  3523. // If 1 is truthy, then as a dojo module is defined it should push it's definitions
  3524. // into the dojo object, and conversely. In 2.0, it will likely be unusual to augment another object
  3525. // as a result of defining a module. This has feature gives a way to force 2.0 behavior as the code
  3526. // is migrated. Absent specific advice otherwise, set extend-dojo to truthy.
  3527. 1 || has.add("extend-dojo", 1);
  3528. (Function("d", "d.eval = function(){return d.global.eval ? d.global.eval(arguments[0]) : eval(arguments[0]);}"))(dojo);
  3529. /*=====
  3530. dojo.eval = function(scriptText){
  3531. // summary:
  3532. // A legacy method created for use exclusively by internal Dojo methods. Do not use this method
  3533. // directly unless you understand its possibly-different implications on the platforms your are targeting.
  3534. // description:
  3535. // Makes an attempt to evaluate scriptText in the global scope. The function works correctly for browsers
  3536. // that support indirect eval.
  3537. //
  3538. // As usual, IE does not. On IE, the only way to implement global eval is to
  3539. // use execScript. Unfortunately, execScript does not return a value and breaks some current usages of dojo.eval.
  3540. // This implementation uses the technique of executing eval in the scope of a function that is a single scope
  3541. // frame below the global scope; thereby coming close to the global scope. Note carefully that
  3542. //
  3543. // dojo.eval("var pi = 3.14;");
  3544. //
  3545. // will define global pi in non-IE environments, but define pi only in a temporary local scope for IE. If you want
  3546. // to define a global variable using dojo.eval, write something like
  3547. //
  3548. // dojo.eval("window.pi = 3.14;")
  3549. // scriptText:
  3550. // The text to evaluation.
  3551. // returns:
  3552. // The result of the evaluation. Often `undefined`
  3553. };
  3554. =====*/
  3555. if( 0 ){
  3556. dojo.exit = function(exitcode){
  3557. quit(exitcode);
  3558. };
  3559. }else{
  3560. dojo.exit = function(){
  3561. };
  3562. }
  3563. 1 || has.add("dojo-guarantee-console",
  3564. // ensure that console.log, console.warn, etc. are defined
  3565. 1
  3566. );
  3567. if( 1 ){
  3568. typeof console != "undefined" || (console = {});
  3569. // Be careful to leave 'log' always at the end
  3570. var cn = [
  3571. "assert", "count", "debug", "dir", "dirxml", "error", "group",
  3572. "groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
  3573. "trace", "warn", "log"
  3574. ];
  3575. var tn;
  3576. i = 0;
  3577. while((tn = cn[i++])){
  3578. if(!console[tn]){
  3579. (function(){
  3580. var tcn = tn + "";
  3581. console[tcn] = ('log' in console) ? function(){
  3582. var a = Array.apply({}, arguments);
  3583. a.unshift(tcn + ":");
  3584. console["log"](a.join(" "));
  3585. } : function(){};
  3586. console[tcn]._fake = true;
  3587. })();
  3588. }
  3589. }
  3590. }
  3591. has.add("dojo-debug-messages",
  3592. // include dojo.deprecated/dojo.experimental implementations
  3593. !!config.isDebug
  3594. );
  3595. dojo.deprecated = dojo.experimental = function(){};
  3596. if(has("dojo-debug-messages")){
  3597. dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){
  3598. // summary:
  3599. // Log a debug message to indicate that a behavior has been
  3600. // deprecated.
  3601. // behaviour: String
  3602. // The API or behavior being deprecated. Usually in the form
  3603. // of "myApp.someFunction()".
  3604. // extra: String?
  3605. // Text to append to the message. Often provides advice on a
  3606. // new function or facility to achieve the same goal during
  3607. // the deprecation period.
  3608. // removal: String?
  3609. // Text to indicate when in the future the behavior will be
  3610. // removed. Usually a version number.
  3611. // example:
  3612. // | dojo.deprecated("myApp.getTemp()", "use myApp.getLocaleTemp() instead", "1.0");
  3613. var message = "DEPRECATED: " + behaviour;
  3614. if(extra){ message += " " + extra; }
  3615. if(removal){ message += " -- will be removed in version: " + removal; }
  3616. console.warn(message);
  3617. };
  3618. dojo.experimental = function(/* String */ moduleName, /* String? */ extra){
  3619. // summary:
  3620. // Marks code as experimental.
  3621. // description:
  3622. // This can be used to mark a function, file, or module as
  3623. // experimental. Experimental code is not ready to be used, and the
  3624. // APIs are subject to change without notice. Experimental code may be
  3625. // completed deleted without going through the normal deprecation
  3626. // process.
  3627. // moduleName: String
  3628. // The name of a module, or the name of a module file or a specific
  3629. // function
  3630. // extra: String?
  3631. // some additional message for the user
  3632. // example:
  3633. // | dojo.experimental("dojo.data.Result");
  3634. // example:
  3635. // | dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA");
  3636. var message = "EXPERIMENTAL: " + moduleName + " -- APIs subject to change without notice.";
  3637. if(extra){ message += " " + extra; }
  3638. console.warn(message);
  3639. };
  3640. }
  3641. 1 || has.add("dojo-modulePaths",
  3642. // consume dojo.modulePaths processing
  3643. 1
  3644. );
  3645. if( 1 ){
  3646. // notice that modulePaths won't be applied to any require's before the dojo/_base/kernel factory is run;
  3647. // this is the v1.6- behavior.
  3648. if(config.modulePaths){
  3649. dojo.deprecated("dojo.modulePaths", "use paths configuration");
  3650. var paths = {};
  3651. for(p in config.modulePaths){
  3652. paths[p.replace(/\./g, "/")] = config.modulePaths[p];
  3653. }
  3654. require({paths:paths});
  3655. }
  3656. }
  3657. 1 || has.add("dojo-moduleUrl",
  3658. // include dojo.moduleUrl
  3659. 1
  3660. );
  3661. if( 1 ){
  3662. dojo.moduleUrl = function(/*String*/module, /*String?*/url){
  3663. // summary:
  3664. // Returns a URL relative to a module.
  3665. // example:
  3666. // | var pngPath = dojo.moduleUrl("acme","images/small.png");
  3667. // | console.dir(pngPath); // list the object properties
  3668. // | // create an image and set it's source to pngPath's value:
  3669. // | var img = document.createElement("img");
  3670. // | img.src = pngPath;
  3671. // | // add our image to the document
  3672. // | dojo.body().appendChild(img);
  3673. // example:
  3674. // you may de-reference as far as you like down the package
  3675. // hierarchy. This is sometimes handy to avoid lenghty relative
  3676. // urls or for building portable sub-packages. In this example,
  3677. // the `acme.widget` and `acme.util` directories may be located
  3678. // under different roots (see `dojo.registerModulePath`) but the
  3679. // the modules which reference them can be unaware of their
  3680. // relative locations on the filesystem:
  3681. // | // somewhere in a configuration block
  3682. // | dojo.registerModulePath("acme.widget", "../../acme/widget");
  3683. // | dojo.registerModulePath("acme.util", "../../util");
  3684. // |
  3685. // | // ...
  3686. // |
  3687. // | // code in a module using acme resources
  3688. // | var tmpltPath = dojo.moduleUrl("acme.widget","templates/template.html");
  3689. // | var dataPath = dojo.moduleUrl("acme.util","resources/data.json");
  3690. dojo.deprecated("dojo.moduleUrl()", "use require.toUrl", "2.0");
  3691. // require.toUrl requires a filetype; therefore, just append the suffix "/*.*" to guarantee a filetype, then
  3692. // remove the suffix from the result. This way clients can request a url w/out a filetype. This should be
  3693. // rare, but it maintains backcompat for the v1.x line (note: dojo.moduleUrl will be removed in v2.0).
  3694. // Notice * is an illegal filename so it won't conflict with any real path map that may exist the paths config.
  3695. var result = null;
  3696. if(module){
  3697. result = require.toUrl(module.replace(/\./g, "/") + (url ? ("/" + url) : "") + "/*.*").replace(/\/\*\.\*/, "") + (url ? "" : "/");
  3698. }
  3699. return result;
  3700. };
  3701. }
  3702. dojo._hasResource = {}; // for backward compatibility with layers built with 1.6 tooling
  3703. return dojo;
  3704. });
  3705. },
  3706. 'dojo/io-query':function(){
  3707. define(["./_base/lang"], function(lang){
  3708. // module:
  3709. // dojo/io-query
  3710. var backstop = {};
  3711. return {
  3712. // summary:
  3713. // This module defines query string processing functions.
  3714. objectToQuery: function objectToQuery(/*Object*/ map){
  3715. // summary:
  3716. // takes a name/value mapping object and returns a string representing
  3717. // a URL-encoded version of that object.
  3718. // example:
  3719. // this object:
  3720. //
  3721. // | {
  3722. // | blah: "blah",
  3723. // | multi: [
  3724. // | "thud",
  3725. // | "thonk"
  3726. // | ]
  3727. // | };
  3728. //
  3729. // yields the following query string:
  3730. //
  3731. // | "blah=blah&multi=thud&multi=thonk"
  3732. // FIXME: need to implement encodeAscii!!
  3733. var enc = encodeURIComponent, pairs = [];
  3734. for(var name in map){
  3735. var value = map[name];
  3736. if(value != backstop[name]){
  3737. var assign = enc(name) + "=";
  3738. if(lang.isArray(value)){
  3739. for(var i = 0, l = value.length; i < l; ++i){
  3740. pairs.push(assign + enc(value[i]));
  3741. }
  3742. }else{
  3743. pairs.push(assign + enc(value));
  3744. }
  3745. }
  3746. }
  3747. return pairs.join("&"); // String
  3748. },
  3749. queryToObject: function queryToObject(/*String*/ str){
  3750. // summary:
  3751. // Create an object representing a de-serialized query section of a
  3752. // URL. Query keys with multiple values are returned in an array.
  3753. //
  3754. // example:
  3755. // This string:
  3756. //
  3757. // | "foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
  3758. //
  3759. // results in this object structure:
  3760. //
  3761. // | {
  3762. // | foo: [ "bar", "baz" ],
  3763. // | thinger: " spaces =blah",
  3764. // | zonk: "blarg"
  3765. // | }
  3766. //
  3767. // Note that spaces and other urlencoded entities are correctly
  3768. // handled.
  3769. // FIXME: should we grab the URL string if we're not passed one?
  3770. var dec = decodeURIComponent, qp = str.split("&"), ret = {}, name, val;
  3771. for(var i = 0, l = qp.length, item; i < l; ++i){
  3772. item = qp[i];
  3773. if(item.length){
  3774. var s = item.indexOf("=");
  3775. if(s < 0){
  3776. name = dec(item);
  3777. val = "";
  3778. }else{
  3779. name = dec(item.slice(0, s));
  3780. val = dec(item.slice(s + 1));
  3781. }
  3782. if(typeof ret[name] == "string"){ // inline'd type check
  3783. ret[name] = [ret[name]];
  3784. }
  3785. if(lang.isArray(ret[name])){
  3786. ret[name].push(val);
  3787. }else{
  3788. ret[name] = val;
  3789. }
  3790. }
  3791. }
  3792. return ret; // Object
  3793. }
  3794. };
  3795. });
  3796. },
  3797. 'dojo/_base/Deferred':function(){
  3798. define([
  3799. "./kernel",
  3800. "../Deferred",
  3801. "../promise/Promise",
  3802. "../errors/CancelError",
  3803. "../has",
  3804. "./lang",
  3805. "../when"
  3806. ], function(dojo, NewDeferred, Promise, CancelError, has, lang, when){
  3807. // module:
  3808. // dojo/_base/Deferred
  3809. var mutator = function(){};
  3810. var freeze = Object.freeze || function(){};
  3811. // A deferred provides an API for creating and resolving a promise.
  3812. var Deferred = dojo.Deferred = function(/*Function?*/ canceller){
  3813. // summary:
  3814. // Deprecated. This module defines the legacy dojo/_base/Deferred API.
  3815. // New code should use dojo/Deferred instead.
  3816. // description:
  3817. // The Deferred API is based on the concept of promises that provide a
  3818. // generic interface into the eventual completion of an asynchronous action.
  3819. // The motivation for promises fundamentally is about creating a
  3820. // separation of concerns that allows one to achieve the same type of
  3821. // call patterns and logical data flow in asynchronous code as can be
  3822. // achieved in synchronous code. Promises allows one
  3823. // to be able to call a function purely with arguments needed for
  3824. // execution, without conflating the call with concerns of whether it is
  3825. // sync or async. One shouldn't need to alter a call's arguments if the
  3826. // implementation switches from sync to async (or vice versa). By having
  3827. // async functions return promises, the concerns of making the call are
  3828. // separated from the concerns of asynchronous interaction (which are
  3829. // handled by the promise).
  3830. //
  3831. // The Deferred is a type of promise that provides methods for fulfilling the
  3832. // promise with a successful result or an error. The most important method for
  3833. // working with Dojo's promises is the then() method, which follows the
  3834. // CommonJS proposed promise API. An example of using a Dojo promise:
  3835. //
  3836. // | var resultingPromise = someAsyncOperation.then(function(result){
  3837. // | ... handle result ...
  3838. // | },
  3839. // | function(error){
  3840. // | ... handle error ...
  3841. // | });
  3842. //
  3843. // The .then() call returns a new promise that represents the result of the
  3844. // execution of the callback. The callbacks will never affect the original promises value.
  3845. //
  3846. // The Deferred instances also provide the following functions for backwards compatibility:
  3847. //
  3848. // - addCallback(handler)
  3849. // - addErrback(handler)
  3850. // - callback(result)
  3851. // - errback(result)
  3852. //
  3853. // Callbacks are allowed to return promises themselves, so
  3854. // you can build complicated sequences of events with ease.
  3855. //
  3856. // The creator of the Deferred may specify a canceller. The canceller
  3857. // is a function that will be called if Deferred.cancel is called
  3858. // before the Deferred fires. You can use this to implement clean
  3859. // aborting of an XMLHttpRequest, etc. Note that cancel will fire the
  3860. // deferred with a CancelledError (unless your canceller returns
  3861. // another kind of error), so the errbacks should be prepared to
  3862. // handle that error for cancellable Deferreds.
  3863. // example:
  3864. // | var deferred = new Deferred();
  3865. // | setTimeout(function(){ deferred.callback({success: true}); }, 1000);
  3866. // | return deferred;
  3867. // example:
  3868. // Deferred objects are often used when making code asynchronous. It
  3869. // may be easiest to write functions in a synchronous manner and then
  3870. // split code using a deferred to trigger a response to a long-lived
  3871. // operation. For example, instead of register a callback function to
  3872. // denote when a rendering operation completes, the function can
  3873. // simply return a deferred:
  3874. //
  3875. // | // callback style:
  3876. // | function renderLotsOfData(data, callback){
  3877. // | var success = false
  3878. // | try{
  3879. // | for(var x in data){
  3880. // | renderDataitem(data[x]);
  3881. // | }
  3882. // | success = true;
  3883. // | }catch(e){ }
  3884. // | if(callback){
  3885. // | callback(success);
  3886. // | }
  3887. // | }
  3888. //
  3889. // | // using callback style
  3890. // | renderLotsOfData(someDataObj, function(success){
  3891. // | // handles success or failure
  3892. // | if(!success){
  3893. // | promptUserToRecover();
  3894. // | }
  3895. // | });
  3896. // | // NOTE: no way to add another callback here!!
  3897. // example:
  3898. // Using a Deferred doesn't simplify the sending code any, but it
  3899. // provides a standard interface for callers and senders alike,
  3900. // providing both with a simple way to service multiple callbacks for
  3901. // an operation and freeing both sides from worrying about details
  3902. // such as "did this get called already?". With Deferreds, new
  3903. // callbacks can be added at any time.
  3904. //
  3905. // | // Deferred style:
  3906. // | function renderLotsOfData(data){
  3907. // | var d = new Deferred();
  3908. // | try{
  3909. // | for(var x in data){
  3910. // | renderDataitem(data[x]);
  3911. // | }
  3912. // | d.callback(true);
  3913. // | }catch(e){
  3914. // | d.errback(new Error("rendering failed"));
  3915. // | }
  3916. // | return d;
  3917. // | }
  3918. //
  3919. // | // using Deferred style
  3920. // | renderLotsOfData(someDataObj).then(null, function(){
  3921. // | promptUserToRecover();
  3922. // | });
  3923. // | // NOTE: addErrback and addCallback both return the Deferred
  3924. // | // again, so we could chain adding callbacks or save the
  3925. // | // deferred for later should we need to be notified again.
  3926. // example:
  3927. // In this example, renderLotsOfData is synchronous and so both
  3928. // versions are pretty artificial. Putting the data display on a
  3929. // timeout helps show why Deferreds rock:
  3930. //
  3931. // | // Deferred style and async func
  3932. // | function renderLotsOfData(data){
  3933. // | var d = new Deferred();
  3934. // | setTimeout(function(){
  3935. // | try{
  3936. // | for(var x in data){
  3937. // | renderDataitem(data[x]);
  3938. // | }
  3939. // | d.callback(true);
  3940. // | }catch(e){
  3941. // | d.errback(new Error("rendering failed"));
  3942. // | }
  3943. // | }, 100);
  3944. // | return d;
  3945. // | }
  3946. //
  3947. // | // using Deferred style
  3948. // | renderLotsOfData(someDataObj).then(null, function(){
  3949. // | promptUserToRecover();
  3950. // | });
  3951. //
  3952. // Note that the caller doesn't have to change his code at all to
  3953. // handle the asynchronous case.
  3954. var result, finished, isError, head, nextListener;
  3955. var promise = (this.promise = new Promise());
  3956. function complete(value){
  3957. if(finished){
  3958. throw new Error("This deferred has already been resolved");
  3959. }
  3960. result = value;
  3961. finished = true;
  3962. notify();
  3963. }
  3964. function notify(){
  3965. var mutated;
  3966. while(!mutated && nextListener){
  3967. var listener = nextListener;
  3968. nextListener = nextListener.next;
  3969. if((mutated = (listener.progress == mutator))){ // assignment and check
  3970. finished = false;
  3971. }
  3972. var func = (isError ? listener.error : listener.resolved);
  3973. if(has("config-useDeferredInstrumentation")){
  3974. if(isError && NewDeferred.instrumentRejected){
  3975. NewDeferred.instrumentRejected(result, !!func);
  3976. }
  3977. }
  3978. if(func){
  3979. try{
  3980. var newResult = func(result);
  3981. if (newResult && typeof newResult.then === "function"){
  3982. newResult.then(lang.hitch(listener.deferred, "resolve"), lang.hitch(listener.deferred, "reject"), lang.hitch(listener.deferred, "progress"));
  3983. continue;
  3984. }
  3985. var unchanged = mutated && newResult === undefined;
  3986. if(mutated && !unchanged){
  3987. isError = newResult instanceof Error;
  3988. }
  3989. listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
  3990. }catch(e){
  3991. listener.deferred.reject(e);
  3992. }
  3993. }else{
  3994. if(isError){
  3995. listener.deferred.reject(result);
  3996. }else{
  3997. listener.deferred.resolve(result);
  3998. }
  3999. }
  4000. }
  4001. }
  4002. // calling resolve will resolve the promise
  4003. this.resolve = this.callback = function(value){
  4004. // summary:
  4005. // Fulfills the Deferred instance successfully with the provide value
  4006. this.fired = 0;
  4007. this.results = [value, null];
  4008. complete(value);
  4009. };
  4010. // calling error will indicate that the promise failed
  4011. this.reject = this.errback = function(error){
  4012. // summary:
  4013. // Fulfills the Deferred instance as an error with the provided error
  4014. isError = true;
  4015. this.fired = 1;
  4016. if(has("config-useDeferredInstrumentation")){
  4017. if(NewDeferred.instrumentRejected){
  4018. NewDeferred.instrumentRejected(error, !!nextListener);
  4019. }
  4020. }
  4021. complete(error);
  4022. this.results = [null, error];
  4023. };
  4024. // call progress to provide updates on the progress on the completion of the promise
  4025. this.progress = function(update){
  4026. // summary:
  4027. // Send progress events to all listeners
  4028. var listener = nextListener;
  4029. while(listener){
  4030. var progress = listener.progress;
  4031. progress && progress(update);
  4032. listener = listener.next;
  4033. }
  4034. };
  4035. this.addCallbacks = function(callback, errback){
  4036. // summary:
  4037. // Adds callback and error callback for this deferred instance.
  4038. // callback: Function?
  4039. // The callback attached to this deferred object.
  4040. // errback: Function?
  4041. // The error callback attached to this deferred object.
  4042. // returns:
  4043. // Returns this deferred object.
  4044. this.then(callback, errback, mutator);
  4045. return this; // Deferred
  4046. };
  4047. // provide the implementation of the promise
  4048. promise.then = this.then = function(/*Function?*/resolvedCallback, /*Function?*/errorCallback, /*Function?*/progressCallback){
  4049. // summary:
  4050. // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
  4051. // completion of a promise. The fulfilledHandler is called when the promise
  4052. // is fulfilled. The errorHandler is called when a promise fails. The
  4053. // progressHandler is called for progress events. All arguments are optional
  4054. // and non-function values are ignored. The progressHandler is not only an
  4055. // optional argument, but progress events are purely optional. Promise
  4056. // providers are not required to ever create progress events.
  4057. //
  4058. // This function will return a new promise that is fulfilled when the given
  4059. // fulfilledHandler or errorHandler callback is finished. This allows promise
  4060. // operations to be chained together. The value returned from the callback
  4061. // handler is the fulfillment value for the returned promise. If the callback
  4062. // throws an error, the returned promise will be moved to failed state.
  4063. //
  4064. // returns:
  4065. // Returns a new promise that represents the result of the
  4066. // execution of the callback. The callbacks will never affect the original promises value.
  4067. // example:
  4068. // An example of using a CommonJS compliant promise:
  4069. // | asyncComputeTheAnswerToEverything().
  4070. // | then(addTwo).
  4071. // | then(printResult, onError);
  4072. // | >44
  4073. //
  4074. var returnDeferred = progressCallback == mutator ? this : new Deferred(promise.cancel);
  4075. var listener = {
  4076. resolved: resolvedCallback,
  4077. error: errorCallback,
  4078. progress: progressCallback,
  4079. deferred: returnDeferred
  4080. };
  4081. if(nextListener){
  4082. head = head.next = listener;
  4083. }
  4084. else{
  4085. nextListener = head = listener;
  4086. }
  4087. if(finished){
  4088. notify();
  4089. }
  4090. return returnDeferred.promise; // Promise
  4091. };
  4092. var deferred = this;
  4093. promise.cancel = this.cancel = function(){
  4094. // summary:
  4095. // Cancels the asynchronous operation
  4096. if(!finished){
  4097. var error = canceller && canceller(deferred);
  4098. if(!finished){
  4099. if (!(error instanceof Error)){
  4100. error = new CancelError(error);
  4101. }
  4102. error.log = false;
  4103. deferred.reject(error);
  4104. }
  4105. }
  4106. };
  4107. freeze(promise);
  4108. };
  4109. lang.extend(Deferred, {
  4110. addCallback: function(/*Function*/ callback){
  4111. // summary:
  4112. // Adds successful callback for this deferred instance.
  4113. // returns:
  4114. // Returns this deferred object.
  4115. return this.addCallbacks(lang.hitch.apply(dojo, arguments)); // Deferred
  4116. },
  4117. addErrback: function(/*Function*/ errback){
  4118. // summary:
  4119. // Adds error callback for this deferred instance.
  4120. // returns:
  4121. // Returns this deferred object.
  4122. return this.addCallbacks(null, lang.hitch.apply(dojo, arguments)); // Deferred
  4123. },
  4124. addBoth: function(/*Function*/ callback){
  4125. // summary:
  4126. // Add handler as both successful callback and error callback for this deferred instance.
  4127. // returns:
  4128. // Returns this deferred object.
  4129. var enclosed = lang.hitch.apply(dojo, arguments);
  4130. return this.addCallbacks(enclosed, enclosed); // Deferred
  4131. },
  4132. fired: -1
  4133. });
  4134. Deferred.when = dojo.when = when;
  4135. return Deferred;
  4136. });
  4137. },
  4138. 'dojo/NodeList-dom':function(){
  4139. define(["./_base/kernel", "./query", "./_base/array", "./_base/lang", "./dom-class", "./dom-construct", "./dom-geometry", "./dom-attr", "./dom-style"], function(dojo, query, array, lang, domCls, domCtr, domGeom, domAttr, domStyle){
  4140. // module:
  4141. // dojo/NodeList-dom.js
  4142. /*=====
  4143. return function(){
  4144. // summary:
  4145. // Adds DOM related methods to NodeList, and returns NodeList constructor.
  4146. };
  4147. =====*/
  4148. var magicGuard = function(a){
  4149. // summary:
  4150. // the guard function for dojo.attr() and dojo.style()
  4151. return a.length == 1 && (typeof a[0] == "string"); // inline'd type check
  4152. };
  4153. var orphan = function(node){
  4154. // summary:
  4155. // function to orphan nodes
  4156. var p = node.parentNode;
  4157. if(p){
  4158. p.removeChild(node);
  4159. }
  4160. };
  4161. // FIXME: should we move orphan() to dojo.html?
  4162. var NodeList = query.NodeList,
  4163. awc = NodeList._adaptWithCondition,
  4164. aafe = NodeList._adaptAsForEach,
  4165. aam = NodeList._adaptAsMap;
  4166. function getSet(module){
  4167. return function(node, name, value){
  4168. if(arguments.length == 2){
  4169. return module[typeof name == "string" ? "get" : "set"](node, name);
  4170. }
  4171. // setter
  4172. return module.set(node, name, value);
  4173. };
  4174. }
  4175. lang.extend(NodeList, {
  4176. _normalize: function(/*String||Element||Object||NodeList*/content, /*DOMNode?*/refNode){
  4177. // summary:
  4178. // normalizes data to an array of items to insert.
  4179. // description:
  4180. // If content is an object, it can have special properties "template" and
  4181. // "parse". If "template" is defined, then the template value is run through
  4182. // dojo.string.substitute (if dojo/string.substitute() has been dojo.required elsewhere),
  4183. // or if templateFunc is a function on the content, that function will be used to
  4184. // transform the template into a final string to be used for for passing to dojo/dom-construct.toDom().
  4185. // If content.parse is true, then it is remembered for later, for when the content
  4186. // nodes are inserted into the DOM. At that point, the nodes will be parsed for widgets
  4187. // (if dojo.parser has been dojo.required elsewhere).
  4188. //Wanted to just use a DocumentFragment, but for the array/NodeList
  4189. //case that meant using cloneNode, but we may not want that.
  4190. //Cloning should only happen if the node operations span
  4191. //multiple refNodes. Also, need a real array, not a NodeList from the
  4192. //DOM since the node movements could change those NodeLists.
  4193. var parse = content.parse === true;
  4194. //Do we have an object that needs to be run through a template?
  4195. if(typeof content.template == "string"){
  4196. var templateFunc = content.templateFunc || (dojo.string && dojo.string.substitute);
  4197. content = templateFunc ? templateFunc(content.template, content) : content;
  4198. }
  4199. var type = (typeof content);
  4200. if(type == "string" || type == "number"){
  4201. content = domCtr.toDom(content, (refNode && refNode.ownerDocument));
  4202. if(content.nodeType == 11){
  4203. //DocumentFragment. It cannot handle cloneNode calls, so pull out the children.
  4204. content = lang._toArray(content.childNodes);
  4205. }else{
  4206. content = [content];
  4207. }
  4208. }else if(!lang.isArrayLike(content)){
  4209. content = [content];
  4210. }else if(!lang.isArray(content)){
  4211. //To get to this point, content is array-like, but
  4212. //not an array, which likely means a DOM NodeList. Convert it now.
  4213. content = lang._toArray(content);
  4214. }
  4215. //Pass around the parse info
  4216. if(parse){
  4217. content._runParse = true;
  4218. }
  4219. return content; //Array
  4220. },
  4221. _cloneNode: function(/*DOMNode*/ node){
  4222. // summary:
  4223. // private utility to clone a node. Not very interesting in the vanilla
  4224. // dojo/NodeList case, but delegates could do interesting things like
  4225. // clone event handlers if that is derivable from the node.
  4226. return node.cloneNode(true);
  4227. },
  4228. _place: function(/*Array*/ary, /*DOMNode*/refNode, /*String*/position, /*Boolean*/useClone){
  4229. // summary:
  4230. // private utility to handle placing an array of nodes relative to another node.
  4231. // description:
  4232. // Allows for cloning the nodes in the array, and for
  4233. // optionally parsing widgets, if ary._runParse is true.
  4234. //Avoid a disallowed operation if trying to do an innerHTML on a non-element node.
  4235. if(refNode.nodeType != 1 && position == "only"){
  4236. return;
  4237. }
  4238. var rNode = refNode, tempNode;
  4239. //Always cycle backwards in case the array is really a
  4240. //DOM NodeList and the DOM operations take it out of the live collection.
  4241. var length = ary.length;
  4242. for(var i = length - 1; i >= 0; i--){
  4243. var node = (useClone ? this._cloneNode(ary[i]) : ary[i]);
  4244. //If need widget parsing, use a temp node, instead of waiting after inserting into
  4245. //real DOM because we need to start widget parsing at one node up from current node,
  4246. //which could cause some already parsed widgets to be parsed again.
  4247. if(ary._runParse && dojo.parser && dojo.parser.parse){
  4248. if(!tempNode){
  4249. tempNode = rNode.ownerDocument.createElement("div");
  4250. }
  4251. tempNode.appendChild(node);
  4252. dojo.parser.parse(tempNode);
  4253. node = tempNode.firstChild;
  4254. while(tempNode.firstChild){
  4255. tempNode.removeChild(tempNode.firstChild);
  4256. }
  4257. }
  4258. if(i == length - 1){
  4259. domCtr.place(node, rNode, position);
  4260. }else{
  4261. rNode.parentNode.insertBefore(node, rNode);
  4262. }
  4263. rNode = node;
  4264. }
  4265. },
  4266. position: aam(domGeom.position),
  4267. /*=====
  4268. position: function(){
  4269. // summary:
  4270. // Returns border-box objects (x/y/w/h) of all elements in a node list
  4271. // as an Array (*not* a NodeList). Acts like `dojo.position`, though
  4272. // assumes the node passed is each node in this list.
  4273. return dojo.map(this, dojo.position); // Array
  4274. },
  4275. =====*/
  4276. attr: awc(getSet(domAttr), magicGuard),
  4277. /*=====
  4278. attr: function(property, value){
  4279. // summary:
  4280. // gets or sets the DOM attribute for every element in the
  4281. // NodeList. See also `dojo.attr`
  4282. // property: String
  4283. // the attribute to get/set
  4284. // value: String?
  4285. // optional. The value to set the property to
  4286. // returns:
  4287. // if no value is passed, the result is an array of attribute values
  4288. // If a value is passed, the return is this NodeList
  4289. // example:
  4290. // Make all nodes with a particular class focusable:
  4291. // | dojo.query(".focusable").attr("tabIndex", -1);
  4292. // example:
  4293. // Disable a group of buttons:
  4294. // | dojo.query("button.group").attr("disabled", true);
  4295. // example:
  4296. // innerHTML can be assigned or retrieved as well:
  4297. // | // get the innerHTML (as an array) for each list item
  4298. // | var ih = dojo.query("li.replaceable").attr("innerHTML");
  4299. return; // dojo/NodeList|Array
  4300. },
  4301. =====*/
  4302. style: awc(getSet(domStyle), magicGuard),
  4303. /*=====
  4304. style: function(property, value){
  4305. // summary:
  4306. // gets or sets the CSS property for every element in the NodeList
  4307. // property: String
  4308. // the CSS property to get/set, in JavaScript notation
  4309. // ("lineHieght" instead of "line-height")
  4310. // value: String?
  4311. // optional. The value to set the property to
  4312. // returns:
  4313. // if no value is passed, the result is an array of strings.
  4314. // If a value is passed, the return is this NodeList
  4315. return; // dojo/NodeList
  4316. return; // Array
  4317. },
  4318. =====*/
  4319. addClass: aafe(domCls.add),
  4320. /*=====
  4321. addClass: function(className){
  4322. // summary:
  4323. // adds the specified class to every node in the list
  4324. // className: String|Array
  4325. // A String class name to add, or several space-separated class names,
  4326. // or an array of class names.
  4327. return; // dojo/NodeList
  4328. },
  4329. =====*/
  4330. removeClass: aafe(domCls.remove),
  4331. /*=====
  4332. removeClass: function(className){
  4333. // summary:
  4334. // removes the specified class from every node in the list
  4335. // className: String|Array?
  4336. // An optional String class name to remove, or several space-separated
  4337. // class names, or an array of class names. If omitted, all class names
  4338. // will be deleted.
  4339. // returns:
  4340. // this list
  4341. return; // dojo/NodeList
  4342. },
  4343. =====*/
  4344. toggleClass: aafe(domCls.toggle),
  4345. /*=====
  4346. toggleClass: function(className, condition){
  4347. // summary:
  4348. // Adds a class to node if not present, or removes if present.
  4349. // Pass a boolean condition if you want to explicitly add or remove.
  4350. // condition: Boolean?
  4351. // If passed, true means to add the class, false means to remove.
  4352. // className: String
  4353. // the CSS class to add
  4354. return; // dojo/NodeList
  4355. },
  4356. =====*/
  4357. replaceClass: aafe(domCls.replace),
  4358. /*=====
  4359. replaceClass: function(addClassStr, removeClassStr){
  4360. // summary:
  4361. // Replaces one or more classes on a node if not present.
  4362. // Operates more quickly than calling `removeClass()` and `addClass()`
  4363. // addClassStr: String|Array
  4364. // A String class name to add, or several space-separated class names,
  4365. // or an array of class names.
  4366. // removeClassStr: String|Array?
  4367. // A String class name to remove, or several space-separated class names,
  4368. // or an array of class names.
  4369. return; // dojo/NodeList
  4370. },
  4371. =====*/
  4372. empty: aafe(domCtr.empty),
  4373. /*=====
  4374. empty: function(){
  4375. // summary:
  4376. // clears all content from each node in the list. Effectively
  4377. // equivalent to removing all child nodes from every item in
  4378. // the list.
  4379. return this.forEach("item.innerHTML='';"); // dojo/NodeList
  4380. // FIXME: should we be checking for and/or disposing of widgets below these nodes?
  4381. },
  4382. =====*/
  4383. removeAttr: aafe(domAttr.remove),
  4384. /*=====
  4385. removeAttr: function(name){
  4386. // summary:
  4387. // Removes an attribute from each node in the list.
  4388. // name: String
  4389. // the name of the attribute to remove
  4390. return; // dojo/NodeList
  4391. },
  4392. =====*/
  4393. marginBox: aam(domGeom.getMarginBox),
  4394. /*=====
  4395. marginBox: function(){
  4396. // summary:
  4397. // Returns margin-box size of nodes
  4398. return; // dojo/NodeList
  4399. },
  4400. =====*/
  4401. // FIXME: connectPublisher()? connectRunOnce()?
  4402. /*
  4403. destroy: function(){
  4404. // summary:
  4405. // destroys every item in the list.
  4406. this.forEach(d.destroy);
  4407. // FIXME: should we be checking for and/or disposing of widgets below these nodes?
  4408. },
  4409. */
  4410. place: function(/*String||Node*/ queryOrNode, /*String*/ position){
  4411. // summary:
  4412. // places elements of this node list relative to the first element matched
  4413. // by queryOrNode. Returns the original NodeList. See: `dojo.place`
  4414. // queryOrNode:
  4415. // may be a string representing any valid CSS3 selector or a DOM node.
  4416. // In the selector case, only the first matching element will be used
  4417. // for relative positioning.
  4418. // position:
  4419. // can be one of:
  4420. //
  4421. // - "last" (default)
  4422. // - "first"
  4423. // - "before"
  4424. // - "after"
  4425. // - "only"
  4426. // - "replace"
  4427. //
  4428. // or an offset in the childNodes property
  4429. var item = query(queryOrNode)[0];
  4430. return this.forEach(function(node){ domCtr.place(node, item, position); }); // dojo/NodeList
  4431. },
  4432. orphan: function(/*String?*/ filter){
  4433. // summary:
  4434. // removes elements in this list that match the filter
  4435. // from their parents and returns them as a new NodeList.
  4436. // filter:
  4437. // CSS selector like ".foo" or "div > span"
  4438. // returns:
  4439. // NodeList containing the orphaned elements
  4440. return (filter ? query._filterResult(this, filter) : this).forEach(orphan); // dojo/NodeList
  4441. },
  4442. adopt: function(/*String||Array||DomNode*/ queryOrListOrNode, /*String?*/ position){
  4443. // summary:
  4444. // places any/all elements in queryOrListOrNode at a
  4445. // position relative to the first element in this list.
  4446. // Returns a dojo/NodeList of the adopted elements.
  4447. // queryOrListOrNode:
  4448. // a DOM node or a query string or a query result.
  4449. // Represents the nodes to be adopted relative to the
  4450. // first element of this NodeList.
  4451. // position:
  4452. // can be one of:
  4453. //
  4454. // - "last" (default)
  4455. // - "first"
  4456. // - "before"
  4457. // - "after"
  4458. // - "only"
  4459. // - "replace"
  4460. //
  4461. // or an offset in the childNodes property
  4462. return query(queryOrListOrNode).place(this[0], position)._stash(this); // dojo/NodeList
  4463. },
  4464. // FIXME: do we need this?
  4465. query: function(/*String*/ queryStr){
  4466. // summary:
  4467. // Returns a new list whose members match the passed query,
  4468. // assuming elements of the current NodeList as the root for
  4469. // each search.
  4470. // example:
  4471. // assume a DOM created by this markup:
  4472. // | <div id="foo">
  4473. // | <p>
  4474. // | bacon is tasty, <span>dontcha think?</span>
  4475. // | </p>
  4476. // | </div>
  4477. // | <div id="bar">
  4478. // | <p>great comedians may not be funny <span>in person</span></p>
  4479. // | </div>
  4480. // If we are presented with the following definition for a NodeList:
  4481. // | var l = new NodeList(dojo.byId("foo"), dojo.byId("bar"));
  4482. // it's possible to find all span elements under paragraphs
  4483. // contained by these elements with this sub-query:
  4484. // | var spans = l.query("p span");
  4485. // FIXME: probably slow
  4486. if(!queryStr){ return this; }
  4487. var ret = new NodeList;
  4488. this.map(function(node){
  4489. // FIXME: why would we ever get undefined here?
  4490. query(queryStr, node).forEach(function(subNode){
  4491. if(subNode !== undefined){
  4492. ret.push(subNode);
  4493. }
  4494. });
  4495. });
  4496. return ret._stash(this); // dojo/NodeList
  4497. },
  4498. filter: function(/*String|Function*/ filter){
  4499. // summary:
  4500. // "masks" the built-in javascript filter() method (supported
  4501. // in Dojo via `dojo.filter`) to support passing a simple
  4502. // string filter in addition to supporting filtering function
  4503. // objects.
  4504. // filter:
  4505. // If a string, a CSS rule like ".thinger" or "div > span".
  4506. // example:
  4507. // "regular" JS filter syntax as exposed in dojo.filter:
  4508. // | dojo.query("*").filter(function(item){
  4509. // | // highlight every paragraph
  4510. // | return (item.nodeName == "p");
  4511. // | }).style("backgroundColor", "yellow");
  4512. // example:
  4513. // the same filtering using a CSS selector
  4514. // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
  4515. var a = arguments, items = this, start = 0;
  4516. if(typeof filter == "string"){ // inline'd type check
  4517. items = query._filterResult(this, a[0]);
  4518. if(a.length == 1){
  4519. // if we only got a string query, pass back the filtered results
  4520. return items._stash(this); // dojo/NodeList
  4521. }
  4522. // if we got a callback, run it over the filtered items
  4523. start = 1;
  4524. }
  4525. return this._wrap(array.filter(items, a[start], a[start + 1]), this); // dojo/NodeList
  4526. },
  4527. /*
  4528. // FIXME: should this be "copyTo" and include parenting info?
  4529. clone: function(){
  4530. // summary:
  4531. // creates node clones of each element of this list
  4532. // and returns a new list containing the clones
  4533. },
  4534. */
  4535. addContent: function(/*String||DomNode||Object||dojo/NodeList*/ content, /*String||Integer?*/ position){
  4536. // summary:
  4537. // add a node, NodeList or some HTML as a string to every item in the
  4538. // list. Returns the original list.
  4539. // description:
  4540. // a copy of the HTML content is added to each item in the
  4541. // list, with an optional position argument. If no position
  4542. // argument is provided, the content is appended to the end of
  4543. // each item.
  4544. // content:
  4545. // DOM node, HTML in string format, a NodeList or an Object. If a DOM node or
  4546. // NodeList, the content will be cloned if the current NodeList has more than one
  4547. // element. Only the DOM nodes are cloned, no event handlers. If it is an Object,
  4548. // it should be an object with at "template" String property that has the HTML string
  4549. // to insert. If dojo.string has already been dojo.required, then dojo.string.substitute
  4550. // will be used on the "template" to generate the final HTML string. Other allowed
  4551. // properties on the object are: "parse" if the HTML
  4552. // string should be parsed for widgets (dojo.require("dojo.parser") to get that
  4553. // option to work), and "templateFunc" if a template function besides dojo.string.substitute
  4554. // should be used to transform the "template".
  4555. // position:
  4556. // can be one of:
  4557. //
  4558. // - "last"||"end" (default)
  4559. // - "first||"start"
  4560. // - "before"
  4561. // - "after"
  4562. // - "replace" (replaces nodes in this NodeList with new content)
  4563. // - "only" (removes other children of the nodes so new content is the only child)
  4564. //
  4565. // or an offset in the childNodes property
  4566. // example:
  4567. // appends content to the end if the position is omitted
  4568. // | dojo.query("h3 > p").addContent("hey there!");
  4569. // example:
  4570. // add something to the front of each element that has a
  4571. // "thinger" property:
  4572. // | dojo.query("[thinger]").addContent("...", "first");
  4573. // example:
  4574. // adds a header before each element of the list
  4575. // | dojo.query(".note").addContent("<h4>NOTE:</h4>", "before");
  4576. // example:
  4577. // add a clone of a DOM node to the end of every element in
  4578. // the list, removing it from its existing parent.
  4579. // | dojo.query(".note").addContent(dojo.byId("foo"));
  4580. // example:
  4581. // Append nodes from a templatized string.
  4582. // | dojo.require("dojo.string");
  4583. // | dojo.query(".note").addContent({
  4584. // | template: '<b>${id}: </b><span>${name}</span>',
  4585. // | id: "user332",
  4586. // | name: "Mr. Anderson"
  4587. // | });
  4588. // example:
  4589. // Append nodes from a templatized string that also has widgets parsed.
  4590. // | dojo.require("dojo.string");
  4591. // | dojo.require("dojo.parser");
  4592. // | var notes = dojo.query(".note").addContent({
  4593. // | template: '<button dojoType="dijit/form/Button">${text}</button>',
  4594. // | parse: true,
  4595. // | text: "Send"
  4596. // | });
  4597. content = this._normalize(content, this[0]);
  4598. for(var i = 0, node; (node = this[i]); i++){
  4599. this._place(content, node, position, i > 0);
  4600. }
  4601. return this; // dojo/NodeList
  4602. }
  4603. });
  4604. return NodeList;
  4605. });
  4606. },
  4607. 'dojo/query':function(){
  4608. define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/lang", "./selector/_loader", "./selector/_loader!default"],
  4609. function(dojo, has, dom, on, array, lang, loader, defaultEngine){
  4610. "use strict";
  4611. has.add("array-extensible", function(){
  4612. // test to see if we can extend an array (not supported in old IE)
  4613. return lang.delegate([], {length: 1}).length == 1 && !has("bug-for-in-skips-shadowed");
  4614. });
  4615. var ap = Array.prototype, aps = ap.slice, apc = ap.concat, forEach = array.forEach;
  4616. var tnl = function(/*Array*/ a, /*dojo/NodeList?*/ parent, /*Function?*/ NodeListCtor){
  4617. // summary:
  4618. // decorate an array to make it look like a `dojo/NodeList`.
  4619. // a:
  4620. // Array of nodes to decorate.
  4621. // parent:
  4622. // An optional parent NodeList that generated the current
  4623. // list of nodes. Used to call _stash() so the parent NodeList
  4624. // can be accessed via end() later.
  4625. // NodeListCtor:
  4626. // An optional constructor function to use for any
  4627. // new NodeList calls. This allows a certain chain of
  4628. // NodeList calls to use a different object than dojo/NodeList.
  4629. var nodeList = new (NodeListCtor || this._NodeListCtor || nl)(a);
  4630. return parent ? nodeList._stash(parent) : nodeList;
  4631. };
  4632. var loopBody = function(f, a, o){
  4633. a = [0].concat(aps.call(a, 0));
  4634. o = o || dojo.global;
  4635. return function(node){
  4636. a[0] = node;
  4637. return f.apply(o, a);
  4638. };
  4639. };
  4640. // adapters
  4641. var adaptAsForEach = function(f, o){
  4642. // summary:
  4643. // adapts a single node function to be used in the forEach-type
  4644. // actions. The initial object is returned from the specialized
  4645. // function.
  4646. // f: Function
  4647. // a function to adapt
  4648. // o: Object?
  4649. // an optional context for f
  4650. return function(){
  4651. this.forEach(loopBody(f, arguments, o));
  4652. return this; // Object
  4653. };
  4654. };
  4655. var adaptAsMap = function(f, o){
  4656. // summary:
  4657. // adapts a single node function to be used in the map-type
  4658. // actions. The return is a new array of values, as via `dojo.map`
  4659. // f: Function
  4660. // a function to adapt
  4661. // o: Object?
  4662. // an optional context for f
  4663. return function(){
  4664. return this.map(loopBody(f, arguments, o));
  4665. };
  4666. };
  4667. var adaptAsFilter = function(f, o){
  4668. // summary:
  4669. // adapts a single node function to be used in the filter-type actions
  4670. // f: Function
  4671. // a function to adapt
  4672. // o: Object?
  4673. // an optional context for f
  4674. return function(){
  4675. return this.filter(loopBody(f, arguments, o));
  4676. };
  4677. };
  4678. var adaptWithCondition = function(f, g, o){
  4679. // summary:
  4680. // adapts a single node function to be used in the map-type
  4681. // actions, behaves like forEach() or map() depending on arguments
  4682. // f: Function
  4683. // a function to adapt
  4684. // g: Function
  4685. // a condition function, if true runs as map(), otherwise runs as forEach()
  4686. // o: Object?
  4687. // an optional context for f and g
  4688. return function(){
  4689. var a = arguments, body = loopBody(f, a, o);
  4690. if(g.call(o || dojo.global, a)){
  4691. return this.map(body); // self
  4692. }
  4693. this.forEach(body);
  4694. return this; // self
  4695. };
  4696. };
  4697. var NodeList = function(array){
  4698. // summary:
  4699. // Array-like object which adds syntactic
  4700. // sugar for chaining, common iteration operations, animation, and
  4701. // node manipulation. NodeLists are most often returned as the
  4702. // result of dojo.query() calls.
  4703. // description:
  4704. // NodeList instances provide many utilities that reflect
  4705. // core Dojo APIs for Array iteration and manipulation, DOM
  4706. // manipulation, and event handling. Instead of needing to dig up
  4707. // functions in the dojo.* namespace, NodeLists generally make the
  4708. // full power of Dojo available for DOM manipulation tasks in a
  4709. // simple, chainable way.
  4710. // example:
  4711. // create a node list from a node
  4712. // | new query.NodeList(dojo.byId("foo"));
  4713. // example:
  4714. // get a NodeList from a CSS query and iterate on it
  4715. // | var l = dojo.query(".thinger");
  4716. // | l.forEach(function(node, index, nodeList){
  4717. // | console.log(index, node.innerHTML);
  4718. // | });
  4719. // example:
  4720. // use native and Dojo-provided array methods to manipulate a
  4721. // NodeList without needing to use dojo.* functions explicitly:
  4722. // | var l = dojo.query(".thinger");
  4723. // | // since NodeLists are real arrays, they have a length
  4724. // | // property that is both readable and writable and
  4725. // | // push/pop/shift/unshift methods
  4726. // | console.log(l.length);
  4727. // | l.push(dojo.create("span"));
  4728. // |
  4729. // | // dojo's normalized array methods work too:
  4730. // | console.log( l.indexOf(dojo.byId("foo")) );
  4731. // | // ...including the special "function as string" shorthand
  4732. // | console.log( l.every("item.nodeType == 1") );
  4733. // |
  4734. // | // NodeLists can be [..] indexed, or you can use the at()
  4735. // | // function to get specific items wrapped in a new NodeList:
  4736. // | var node = l[3]; // the 4th element
  4737. // | var newList = l.at(1, 3); // the 2nd and 4th elements
  4738. // example:
  4739. // the style functions you expect are all there too:
  4740. // | // style() as a getter...
  4741. // | var borders = dojo.query(".thinger").style("border");
  4742. // | // ...and as a setter:
  4743. // | dojo.query(".thinger").style("border", "1px solid black");
  4744. // | // class manipulation
  4745. // | dojo.query("li:nth-child(even)").addClass("even");
  4746. // | // even getting the coordinates of all the items
  4747. // | var coords = dojo.query(".thinger").coords();
  4748. // example:
  4749. // DOM manipulation functions from the dojo.* namespace area also available:
  4750. // | // remove all of the elements in the list from their
  4751. // | // parents (akin to "deleting" them from the document)
  4752. // | dojo.query(".thinger").orphan();
  4753. // | // place all elements in the list at the front of #foo
  4754. // | dojo.query(".thinger").place("foo", "first");
  4755. // example:
  4756. // Event handling couldn't be easier. `dojo.connect` is mapped in,
  4757. // and shortcut handlers are provided for most DOM events:
  4758. // | // like dojo.connect(), but with implicit scope
  4759. // | dojo.query("li").connect("onclick", console, "log");
  4760. // |
  4761. // | // many common event handlers are already available directly:
  4762. // | dojo.query("li").onclick(console, "log");
  4763. // | var toggleHovered = dojo.hitch(dojo, "toggleClass", "hovered");
  4764. // | dojo.query("p")
  4765. // | .onmouseenter(toggleHovered)
  4766. // | .onmouseleave(toggleHovered);
  4767. // example:
  4768. // chainability is a key advantage of NodeLists:
  4769. // | dojo.query(".thinger")
  4770. // | .onclick(function(e){ /* ... */ })
  4771. // | .at(1, 3, 8) // get a subset
  4772. // | .style("padding", "5px")
  4773. // | .forEach(console.log);
  4774. var isNew = this instanceof nl && has("array-extensible");
  4775. if(typeof array == "number"){
  4776. array = Array(array);
  4777. }
  4778. var nodeArray = (array && "length" in array) ? array : arguments;
  4779. if(isNew || !nodeArray.sort){
  4780. // make sure it's a real array before we pass it on to be wrapped
  4781. var target = isNew ? this : [],
  4782. l = target.length = nodeArray.length;
  4783. for(var i = 0; i < l; i++){
  4784. target[i] = nodeArray[i];
  4785. }
  4786. if(isNew){
  4787. // called with new operator, this means we are going to use this instance and push
  4788. // the nodes on to it. This is usually much faster since the NodeList properties
  4789. // don't need to be copied (unless the list of nodes is extremely large).
  4790. return target;
  4791. }
  4792. nodeArray = target;
  4793. }
  4794. // called without new operator, use a real array and copy prototype properties,
  4795. // this is slower and exists for back-compat. Should be removed in 2.0.
  4796. lang._mixin(nodeArray, nlp);
  4797. nodeArray._NodeListCtor = function(array){
  4798. // call without new operator to preserve back-compat behavior
  4799. return nl(array);
  4800. };
  4801. return nodeArray;
  4802. };
  4803. var nl = NodeList, nlp = nl.prototype =
  4804. has("array-extensible") ? [] : {};// extend an array if it is extensible
  4805. // expose adapters and the wrapper as private functions
  4806. nl._wrap = nlp._wrap = tnl;
  4807. nl._adaptAsMap = adaptAsMap;
  4808. nl._adaptAsForEach = adaptAsForEach;
  4809. nl._adaptAsFilter = adaptAsFilter;
  4810. nl._adaptWithCondition = adaptWithCondition;
  4811. // mass assignment
  4812. // add array redirectors
  4813. forEach(["slice", "splice"], function(name){
  4814. var f = ap[name];
  4815. //Use a copy of the this array via this.slice() to allow .end() to work right in the splice case.
  4816. // CANNOT apply ._stash()/end() to splice since it currently modifies
  4817. // the existing this array -- it would break backward compatibility if we copy the array before
  4818. // the splice so that we can use .end(). So only doing the stash option to this._wrap for slice.
  4819. nlp[name] = function(){ return this._wrap(f.apply(this, arguments), name == "slice" ? this : null); };
  4820. });
  4821. // concat should be here but some browsers with native NodeList have problems with it
  4822. // add array.js redirectors
  4823. forEach(["indexOf", "lastIndexOf", "every", "some"], function(name){
  4824. var f = array[name];
  4825. nlp[name] = function(){ return f.apply(dojo, [this].concat(aps.call(arguments, 0))); };
  4826. });
  4827. lang.extend(NodeList, {
  4828. // copy the constructors
  4829. constructor: nl,
  4830. _NodeListCtor: nl,
  4831. toString: function(){
  4832. // Array.prototype.toString can't be applied to objects, so we use join
  4833. return this.join(",");
  4834. },
  4835. _stash: function(parent){
  4836. // summary:
  4837. // private function to hold to a parent NodeList. end() to return the parent NodeList.
  4838. //
  4839. // example:
  4840. // How to make a `dojo/NodeList` method that only returns the third node in
  4841. // the dojo/NodeList but allows access to the original NodeList by using this._stash:
  4842. // | dojo.extend(NodeList, {
  4843. // | third: function(){
  4844. // | var newNodeList = NodeList(this[2]);
  4845. // | return newNodeList._stash(this);
  4846. // | }
  4847. // | });
  4848. // | // then see how _stash applies a sub-list, to be .end()'ed out of
  4849. // | dojo.query(".foo")
  4850. // | .third()
  4851. // | .addClass("thirdFoo")
  4852. // | .end()
  4853. // | // access to the orig .foo list
  4854. // | .removeClass("foo")
  4855. // |
  4856. //
  4857. this._parent = parent;
  4858. return this; // dojo/NodeList
  4859. },
  4860. on: function(eventName, listener){
  4861. // summary:
  4862. // Listen for events on the nodes in the NodeList. Basic usage is:
  4863. // | query(".my-class").on("click", listener);
  4864. // This supports event delegation by using selectors as the first argument with the event names as
  4865. // pseudo selectors. For example:
  4866. // | dojo.query("#my-list").on("li:click", listener);
  4867. // This will listen for click events within `<li>` elements that are inside the `#my-list` element.
  4868. // Because on supports CSS selector syntax, we can use comma-delimited events as well:
  4869. // | dojo.query("#my-list").on("li button:mouseover, li:click", listener);
  4870. var handles = this.map(function(node){
  4871. return on(node, eventName, listener); // TODO: apply to the NodeList so the same selector engine is used for matches
  4872. });
  4873. handles.remove = function(){
  4874. for(var i = 0; i < handles.length; i++){
  4875. handles[i].remove();
  4876. }
  4877. };
  4878. return handles;
  4879. },
  4880. end: function(){
  4881. // summary:
  4882. // Ends use of the current `NodeList` by returning the previous NodeList
  4883. // that generated the current NodeList.
  4884. // description:
  4885. // Returns the `NodeList` that generated the current `NodeList`. If there
  4886. // is no parent NodeList, an empty NodeList is returned.
  4887. // example:
  4888. // | dojo.query("a")
  4889. // | .filter(".disabled")
  4890. // | // operate on the anchors that only have a disabled class
  4891. // | .style("color", "grey")
  4892. // | .end()
  4893. // | // jump back to the list of anchors
  4894. // | .style(...)
  4895. //
  4896. if(this._parent){
  4897. return this._parent;
  4898. }else{
  4899. //Just return empty list.
  4900. return new this._NodeListCtor(0);
  4901. }
  4902. },
  4903. // http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array#Methods
  4904. // FIXME: handle return values for #3244
  4905. // http://trac.dojotoolkit.org/ticket/3244
  4906. // FIXME:
  4907. // need to wrap or implement:
  4908. // join (perhaps w/ innerHTML/outerHTML overload for toString() of items?)
  4909. // reduce
  4910. // reduceRight
  4911. /*=====
  4912. slice: function(begin, end){
  4913. // summary:
  4914. // Returns a new NodeList, maintaining this one in place
  4915. // description:
  4916. // This method behaves exactly like the Array.slice method
  4917. // with the caveat that it returns a dojo/NodeList and not a
  4918. // raw Array. For more details, see Mozilla's [slice
  4919. // documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/slice)
  4920. // begin: Integer
  4921. // Can be a positive or negative integer, with positive
  4922. // integers noting the offset to begin at, and negative
  4923. // integers denoting an offset from the end (i.e., to the left
  4924. // of the end)
  4925. // end: Integer?
  4926. // Optional parameter to describe what position relative to
  4927. // the NodeList's zero index to end the slice at. Like begin,
  4928. // can be positive or negative.
  4929. return this._wrap(a.slice.apply(this, arguments));
  4930. },
  4931. splice: function(index, howmany, item){
  4932. // summary:
  4933. // Returns a new NodeList, manipulating this NodeList based on
  4934. // the arguments passed, potentially splicing in new elements
  4935. // at an offset, optionally deleting elements
  4936. // description:
  4937. // This method behaves exactly like the Array.splice method
  4938. // with the caveat that it returns a dojo/NodeList and not a
  4939. // raw Array. For more details, see Mozilla's [splice
  4940. // documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice)
  4941. // For backwards compatibility, calling .end() on the spliced NodeList
  4942. // does not return the original NodeList -- splice alters the NodeList in place.
  4943. // index: Integer
  4944. // begin can be a positive or negative integer, with positive
  4945. // integers noting the offset to begin at, and negative
  4946. // integers denoting an offset from the end (i.e., to the left
  4947. // of the end)
  4948. // howmany: Integer?
  4949. // Optional parameter to describe what position relative to
  4950. // the NodeList's zero index to end the slice at. Like begin,
  4951. // can be positive or negative.
  4952. // item: Object...?
  4953. // Any number of optional parameters may be passed in to be
  4954. // spliced into the NodeList
  4955. return this._wrap(a.splice.apply(this, arguments)); // dojo/NodeList
  4956. },
  4957. indexOf: function(value, fromIndex){
  4958. // summary:
  4959. // see dojo.indexOf(). The primary difference is that the acted-on
  4960. // array is implicitly this NodeList
  4961. // value: Object
  4962. // The value to search for.
  4963. // fromIndex: Integer?
  4964. // The location to start searching from. Optional. Defaults to 0.
  4965. // description:
  4966. // For more details on the behavior of indexOf, see Mozilla's
  4967. // [indexOf
  4968. // docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf)
  4969. // returns:
  4970. // Positive Integer or 0 for a match, -1 of not found.
  4971. return d.indexOf(this, value, fromIndex); // Integer
  4972. },
  4973. lastIndexOf: function(value, fromIndex){
  4974. // summary:
  4975. // see dojo.lastIndexOf(). The primary difference is that the
  4976. // acted-on array is implicitly this NodeList
  4977. // description:
  4978. // For more details on the behavior of lastIndexOf, see
  4979. // Mozilla's [lastIndexOf
  4980. // docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf)
  4981. // value: Object
  4982. // The value to search for.
  4983. // fromIndex: Integer?
  4984. // The location to start searching from. Optional. Defaults to 0.
  4985. // returns:
  4986. // Positive Integer or 0 for a match, -1 of not found.
  4987. return d.lastIndexOf(this, value, fromIndex); // Integer
  4988. },
  4989. every: function(callback, thisObject){
  4990. // summary:
  4991. // see `dojo.every()` and the [Array.every
  4992. // docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every).
  4993. // Takes the same structure of arguments and returns as
  4994. // dojo.every() with the caveat that the passed array is
  4995. // implicitly this NodeList
  4996. // callback: Function
  4997. // the callback
  4998. // thisObject: Object?
  4999. // the context
  5000. return d.every(this, callback, thisObject); // Boolean
  5001. },
  5002. some: function(callback, thisObject){
  5003. // summary:
  5004. // Takes the same structure of arguments and returns as
  5005. // `dojo.some()` with the caveat that the passed array is
  5006. // implicitly this NodeList. See `dojo.some()` and Mozilla's
  5007. // [Array.some
  5008. // documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some).
  5009. // callback: Function
  5010. // the callback
  5011. // thisObject: Object?
  5012. // the context
  5013. return d.some(this, callback, thisObject); // Boolean
  5014. },
  5015. =====*/
  5016. concat: function(item){
  5017. // summary:
  5018. // Returns a new NodeList comprised of items in this NodeList
  5019. // as well as items passed in as parameters
  5020. // description:
  5021. // This method behaves exactly like the Array.concat method
  5022. // with the caveat that it returns a `NodeList` and not a
  5023. // raw Array. For more details, see the [Array.concat
  5024. // docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/concat)
  5025. // item: Object?
  5026. // Any number of optional parameters may be passed in to be
  5027. // spliced into the NodeList
  5028. //return this._wrap(apc.apply(this, arguments));
  5029. // the line above won't work for the native NodeList, or for Dojo NodeLists either :-(
  5030. // implementation notes:
  5031. // Array.concat() doesn't recognize native NodeLists or Dojo NodeLists
  5032. // as arrays, and so does not inline them into a unioned array, but
  5033. // appends them as single entities. Both the original NodeList and the
  5034. // items passed in as parameters must be converted to raw Arrays
  5035. // and then the concatenation result may be re-_wrap()ed as a Dojo NodeList.
  5036. var t = aps.call(this, 0),
  5037. m = array.map(arguments, function(a){
  5038. return aps.call(a, 0);
  5039. });
  5040. return this._wrap(apc.apply(t, m), this); // dojo/NodeList
  5041. },
  5042. map: function(/*Function*/ func, /*Function?*/ obj){
  5043. // summary:
  5044. // see dojo.map(). The primary difference is that the acted-on
  5045. // array is implicitly this NodeList and the return is a
  5046. // NodeList (a subclass of Array)
  5047. return this._wrap(array.map(this, func, obj), this); // dojo/NodeList
  5048. },
  5049. forEach: function(callback, thisObj){
  5050. // summary:
  5051. // see `dojo.forEach()`. The primary difference is that the acted-on
  5052. // array is implicitly this NodeList. If you want the option to break out
  5053. // of the forEach loop, use every() or some() instead.
  5054. forEach(this, callback, thisObj);
  5055. // non-standard return to allow easier chaining
  5056. return this; // dojo/NodeList
  5057. },
  5058. filter: function(/*String|Function*/ filter){
  5059. // summary:
  5060. // "masks" the built-in javascript filter() method (supported
  5061. // in Dojo via `dojo.filter`) to support passing a simple
  5062. // string filter in addition to supporting filtering function
  5063. // objects.
  5064. // filter:
  5065. // If a string, a CSS rule like ".thinger" or "div > span".
  5066. // example:
  5067. // "regular" JS filter syntax as exposed in dojo.filter:
  5068. // | dojo.query("*").filter(function(item){
  5069. // | // highlight every paragraph
  5070. // | return (item.nodeName == "p");
  5071. // | }).style("backgroundColor", "yellow");
  5072. // example:
  5073. // the same filtering using a CSS selector
  5074. // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
  5075. var a = arguments, items = this, start = 0;
  5076. if(typeof filter == "string"){ // inline'd type check
  5077. items = query._filterResult(this, a[0]);
  5078. if(a.length == 1){
  5079. // if we only got a string query, pass back the filtered results
  5080. return items._stash(this); // dojo/NodeList
  5081. }
  5082. // if we got a callback, run it over the filtered items
  5083. start = 1;
  5084. }
  5085. return this._wrap(array.filter(items, a[start], a[start + 1]), this); // dojo/NodeList
  5086. },
  5087. instantiate: function(/*String|Object*/ declaredClass, /*Object?*/ properties){
  5088. // summary:
  5089. // Create a new instance of a specified class, using the
  5090. // specified properties and each node in the NodeList as a
  5091. // srcNodeRef.
  5092. // example:
  5093. // Grabs all buttons in the page and converts them to dijit/form/Button's.
  5094. // | var buttons = query("button").instantiate(Button, {showLabel: true});
  5095. var c = lang.isFunction(declaredClass) ? declaredClass : lang.getObject(declaredClass);
  5096. properties = properties || {};
  5097. return this.forEach(function(node){
  5098. new c(properties, node);
  5099. }); // dojo/NodeList
  5100. },
  5101. at: function(/*===== index =====*/){
  5102. // summary:
  5103. // Returns a new NodeList comprised of items in this NodeList
  5104. // at the given index or indices.
  5105. //
  5106. // index: Integer...
  5107. // One or more 0-based indices of items in the current
  5108. // NodeList. A negative index will start at the end of the
  5109. // list and go backwards.
  5110. //
  5111. // example:
  5112. // Shorten the list to the first, second, and third elements
  5113. // | query("a").at(0, 1, 2).forEach(fn);
  5114. //
  5115. // example:
  5116. // Retrieve the first and last elements of a unordered list:
  5117. // | query("ul > li").at(0, -1).forEach(cb);
  5118. //
  5119. // example:
  5120. // Do something for the first element only, but end() out back to
  5121. // the original list and continue chaining:
  5122. // | query("a").at(0).onclick(fn).end().forEach(function(n){
  5123. // | console.log(n); // all anchors on the page.
  5124. // | })
  5125. var t = new this._NodeListCtor(0);
  5126. forEach(arguments, function(i){
  5127. if(i < 0){ i = this.length + i; }
  5128. if(this[i]){ t.push(this[i]); }
  5129. }, this);
  5130. return t._stash(this); // dojo/NodeList
  5131. }
  5132. });
  5133. function queryForEngine(engine, NodeList){
  5134. var query = function(/*String*/ query, /*String|DOMNode?*/ root){
  5135. // summary:
  5136. // Returns nodes which match the given CSS selector, searching the
  5137. // entire document by default but optionally taking a node to scope
  5138. // the search by. Returns an instance of NodeList.
  5139. if(typeof root == "string"){
  5140. root = dom.byId(root);
  5141. if(!root){
  5142. return new NodeList([]);
  5143. }
  5144. }
  5145. var results = typeof query == "string" ? engine(query, root) : query ? query.orphan ? query : [query] : [];
  5146. if(results.orphan){
  5147. // already wrapped
  5148. return results;
  5149. }
  5150. return new NodeList(results);
  5151. };
  5152. query.matches = engine.match || function(node, selector, root){
  5153. // summary:
  5154. // Test to see if a node matches a selector
  5155. return query.filter([node], selector, root).length > 0;
  5156. };
  5157. // the engine provides a filtering function, use it to for matching
  5158. query.filter = engine.filter || function(nodes, selector, root){
  5159. // summary:
  5160. // Filters an array of nodes. Note that this does not guarantee to return a NodeList, just an array.
  5161. return query(selector, root).filter(function(node){
  5162. return array.indexOf(nodes, node) > -1;
  5163. });
  5164. };
  5165. if(typeof engine != "function"){
  5166. var search = engine.search;
  5167. engine = function(selector, root){
  5168. // Slick does it backwards (or everyone else does it backwards, probably the latter)
  5169. return search(root || document, selector);
  5170. };
  5171. }
  5172. return query;
  5173. }
  5174. var query = queryForEngine(defaultEngine, NodeList);
  5175. /*=====
  5176. query = function(selector, context){
  5177. // summary:
  5178. // This modules provides DOM querying functionality. The module export is a function
  5179. // that can be used to query for DOM nodes by CSS selector and returns a NodeList
  5180. // representing the matching nodes.
  5181. // selector: String
  5182. // A CSS selector to search for.
  5183. // context: String|DomNode?
  5184. // An optional context to limit the searching scope. Only nodes under `context` will be
  5185. // scanned.
  5186. // example:
  5187. // add an onclick handler to every submit button in the document
  5188. // which causes the form to be sent via Ajax instead:
  5189. // | require(["dojo/query"], function(query){
  5190. // | query("input[type='submit']").on("click", function(e){
  5191. // | dojo.stopEvent(e); // prevent sending the form
  5192. // | var btn = e.target;
  5193. // | dojo.xhrPost({
  5194. // | form: btn.form,
  5195. // | load: function(data){
  5196. // | // replace the form with the response
  5197. // | var div = dojo.doc.createElement("div");
  5198. // | dojo.place(div, btn.form, "after");
  5199. // | div.innerHTML = data;
  5200. // | dojo.style(btn.form, "display", "none");
  5201. // | }
  5202. // | });
  5203. // | });
  5204. // | });
  5205. //
  5206. // description:
  5207. // dojo/query is responsible for loading the appropriate query engine and wrapping
  5208. // its results with a `NodeList`. You can use dojo/query with a specific selector engine
  5209. // by using it as a plugin. For example, if you installed the sizzle package, you could
  5210. // use it as the selector engine with:
  5211. // | require(["dojo/query!sizzle"], function(query){
  5212. // | query("div")...
  5213. //
  5214. // The id after the ! can be a module id of the selector engine or one of the following values:
  5215. //
  5216. // - acme: This is the default engine used by Dojo base, and will ensure that the full
  5217. // Acme engine is always loaded.
  5218. //
  5219. // - css2: If the browser has a native selector engine, this will be used, otherwise a
  5220. // very minimal lightweight selector engine will be loaded that can do simple CSS2 selectors
  5221. // (by #id, .class, tag, and [name=value] attributes, with standard child or descendant (>)
  5222. // operators) and nothing more.
  5223. //
  5224. // - css2.1: If the browser has a native selector engine, this will be used, otherwise the
  5225. // full Acme engine will be loaded.
  5226. //
  5227. // - css3: If the browser has a native selector engine with support for CSS3 pseudo
  5228. // selectors (most modern browsers except IE8), this will be used, otherwise the
  5229. // full Acme engine will be loaded.
  5230. //
  5231. // - Or the module id of a selector engine can be used to explicitly choose the selector engine
  5232. //
  5233. // For example, if you are using CSS3 pseudo selectors in module, you can specify that
  5234. // you will need support them with:
  5235. // | require(["dojo/query!css3"], function(query){
  5236. // | query('#t > h3:nth-child(odd)')...
  5237. //
  5238. // You can also choose the selector engine/load configuration by setting the query-selector:
  5239. // For example:
  5240. // | <script data-dojo-config="query-selector:'css3'" src="dojo.js"></script>
  5241. //
  5242. return new NodeList(); // dojo/NodeList
  5243. };
  5244. =====*/
  5245. // the query that is returned from this module is slightly different than dojo.query,
  5246. // because dojo.query has to maintain backwards compatibility with returning a
  5247. // true array which has performance problems. The query returned from the module
  5248. // does not use true arrays, but rather inherits from Array, making it much faster to
  5249. // instantiate.
  5250. dojo.query = queryForEngine(defaultEngine, function(array){
  5251. // call it without the new operator to invoke the back-compat behavior that returns a true array
  5252. return NodeList(array); // dojo/NodeList
  5253. });
  5254. query.load = function(id, parentRequire, loaded){
  5255. // summary:
  5256. // can be used as AMD plugin to conditionally load new query engine
  5257. // example:
  5258. // | require(["dojo/query!custom"], function(qsa){
  5259. // | // loaded selector/custom.js as engine
  5260. // | qsa("#foobar").forEach(...);
  5261. // | });
  5262. loader.load(id, parentRequire, function(engine){
  5263. loaded(queryForEngine(engine, NodeList));
  5264. });
  5265. };
  5266. dojo._filterQueryResult = query._filterResult = function(nodes, selector, root){
  5267. return new NodeList(query.filter(nodes, selector, root));
  5268. };
  5269. dojo.NodeList = query.NodeList = NodeList;
  5270. return query;
  5271. });
  5272. },
  5273. 'dojo/has':function(){
  5274. define(["require", "module"], function(require, module){
  5275. // module:
  5276. // dojo/has
  5277. // summary:
  5278. // Defines the has.js API and several feature tests used by dojo.
  5279. // description:
  5280. // This module defines the has API as described by the project has.js with the following additional features:
  5281. //
  5282. // - the has test cache is exposed at has.cache.
  5283. // - the method has.add includes a forth parameter that controls whether or not existing tests are replaced
  5284. // - the loader's has cache may be optionally copied into this module's has cahce.
  5285. //
  5286. // This module adopted from https://github.com/phiggins42/has.js; thanks has.js team!
  5287. // try to pull the has implementation from the loader; both the dojo loader and bdLoad provide one
  5288. // if using a foreign loader, then the has cache may be initialized via the config object for this module
  5289. // WARNING: if a foreign loader defines require.has to be something other than the has.js API, then this implementation fail
  5290. var has = require.has || function(){};
  5291. if(! 1 ){
  5292. var
  5293. isBrowser =
  5294. // the most fundamental decision: are we in the browser?
  5295. typeof window != "undefined" &&
  5296. typeof location != "undefined" &&
  5297. typeof document != "undefined" &&
  5298. window.location == location && window.document == document,
  5299. // has API variables
  5300. global = this,
  5301. doc = isBrowser && document,
  5302. element = doc && doc.createElement("DiV"),
  5303. cache = (module.config && module.config()) || {};
  5304. has = function(name){
  5305. // summary:
  5306. // Return the current value of the named feature.
  5307. //
  5308. // name: String|Integer
  5309. // The name (if a string) or identifier (if an integer) of the feature to test.
  5310. //
  5311. // description:
  5312. // Returns the value of the feature named by name. The feature must have been
  5313. // previously added to the cache by has.add.
  5314. return typeof cache[name] == "function" ? (cache[name] = cache[name](global, doc, element)) : cache[name]; // Boolean
  5315. };
  5316. has.cache = cache;
  5317. has.add = function(name, test, now, force){
  5318. // summary:
  5319. // Register a new feature test for some named feature.
  5320. // name: String|Integer
  5321. // The name (if a string) or identifier (if an integer) of the feature to test.
  5322. // test: Function
  5323. // A test function to register. If a function, queued for testing until actually
  5324. // needed. The test function should return a boolean indicating
  5325. // the presence of a feature or bug.
  5326. // now: Boolean?
  5327. // Optional. Omit if `test` is not a function. Provides a way to immediately
  5328. // run the test and cache the result.
  5329. // force: Boolean?
  5330. // Optional. If the test already exists and force is truthy, then the existing
  5331. // test will be replaced; otherwise, add does not replace an existing test (that
  5332. // is, by default, the first test advice wins).
  5333. // example:
  5334. // A redundant test, testFn with immediate execution:
  5335. // | has.add("javascript", function(){ return true; }, true);
  5336. //
  5337. // example:
  5338. // Again with the redundantness. You can do this in your tests, but we should
  5339. // not be doing this in any internal has.js tests
  5340. // | has.add("javascript", true);
  5341. //
  5342. // example:
  5343. // Three things are passed to the testFunction. `global`, `document`, and a generic element
  5344. // from which to work your test should the need arise.
  5345. // | has.add("bug-byid", function(g, d, el){
  5346. // | // g == global, typically window, yadda yadda
  5347. // | // d == document object
  5348. // | // el == the generic element. a `has` element.
  5349. // | return false; // fake test, byid-when-form-has-name-matching-an-id is slightly longer
  5350. // | });
  5351. (typeof cache[name]=="undefined" || force) && (cache[name]= test);
  5352. return now && has(name);
  5353. };
  5354. // since we're operating under a loader that doesn't provide a has API, we must explicitly initialize
  5355. // has as it would have otherwise been initialized by the dojo loader; use has.add to the builder
  5356. // can optimize these away iff desired
  5357. 1 || has.add("host-browser", isBrowser);
  5358. 1 || has.add("dom", isBrowser);
  5359. 1 || has.add("dojo-dom-ready-api", 1);
  5360. 1 || has.add("dojo-sniff", 1);
  5361. }
  5362. if( 1 ){
  5363. // Common application level tests
  5364. has.add("dom-addeventlistener", !!document.addEventListener);
  5365. has.add("touch", "ontouchstart" in document);
  5366. // I don't know if any of these tests are really correct, just a rough guess
  5367. has.add("device-width", screen.availWidth || innerWidth);
  5368. // Tests for DOMNode.attributes[] behavior:
  5369. // - dom-attributes-explicit - attributes[] only lists explicitly user specified attributes
  5370. // - dom-attributes-specified-flag (IE8) - need to check attr.specified flag to skip attributes user didn't specify
  5371. // - Otherwise, in IE6-7. attributes[] will list hundreds of values, so need to do outerHTML to get attrs instead.
  5372. var form = document.createElement("form");
  5373. has.add("dom-attributes-explicit", form.attributes.length == 0); // W3C
  5374. has.add("dom-attributes-specified-flag", form.attributes.length > 0 && form.attributes.length < 40); // IE8
  5375. }
  5376. has.clearElement = function(element){
  5377. // summary:
  5378. // Deletes the contents of the element passed to test functions.
  5379. element.innerHTML= "";
  5380. return element;
  5381. };
  5382. has.normalize = function(id, toAbsMid){
  5383. // summary:
  5384. // Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
  5385. //
  5386. // toAbsMid: Function
  5387. // Resolves a relative module id into an absolute module id
  5388. var
  5389. tokens = id.match(/[\?:]|[^:\?]*/g), i = 0,
  5390. get = function(skip){
  5391. var term = tokens[i++];
  5392. if(term == ":"){
  5393. // empty string module name, resolves to 0
  5394. return 0;
  5395. }else{
  5396. // postfixed with a ? means it is a feature to branch on, the term is the name of the feature
  5397. if(tokens[i++] == "?"){
  5398. if(!skip && has(term)){
  5399. // matched the feature, get the first value from the options
  5400. return get();
  5401. }else{
  5402. // did not match, get the second value, passing over the first
  5403. get(true);
  5404. return get(skip);
  5405. }
  5406. }
  5407. // a module
  5408. return term || 0;
  5409. }
  5410. };
  5411. id = get();
  5412. return id && toAbsMid(id);
  5413. };
  5414. has.load = function(id, parentRequire, loaded){
  5415. // summary:
  5416. // Conditional loading of AMD modules based on a has feature test value.
  5417. // id: String
  5418. // Gives the resolved module id to load.
  5419. // parentRequire: Function
  5420. // The loader require function with respect to the module that contained the plugin resource in it's
  5421. // dependency list.
  5422. // loaded: Function
  5423. // Callback to loader that consumes result of plugin demand.
  5424. if(id){
  5425. parentRequire([id], loaded);
  5426. }else{
  5427. loaded();
  5428. }
  5429. };
  5430. return has;
  5431. });
  5432. },
  5433. 'dojo/_base/loader':function(){
  5434. define(["./kernel", "../has", "require", "module", "./json", "./lang", "./array"], function(dojo, has, require, thisModule, json, lang, array) {
  5435. // module:
  5436. // dojo/_base/loader
  5437. // This module defines the v1.x synchronous loader API.
  5438. // signal the loader in sync mode...
  5439. //>>pure-amd
  5440. if (! 1 ){
  5441. console.error("cannot load the Dojo v1.x loader with a foreign loader");
  5442. return 0;
  5443. }
  5444. 1 || has.add("dojo-fast-sync-require", 1);
  5445. var makeErrorToken = function(id){
  5446. return {src:thisModule.id, id:id};
  5447. },
  5448. slashName = function(name){
  5449. return name.replace(/\./g, "/");
  5450. },
  5451. buildDetectRe = /\/\/>>built/,
  5452. dojoRequireCallbacks = [],
  5453. dojoRequireModuleStack = [],
  5454. dojoRequirePlugin = function(mid, require, loaded){
  5455. dojoRequireCallbacks.push(loaded);
  5456. array.forEach(mid.split(","), function(mid){
  5457. var module = getModule(mid, require.module);
  5458. dojoRequireModuleStack.push(module);
  5459. injectModule(module);
  5460. });
  5461. checkDojoRequirePlugin();
  5462. },
  5463. checkDojoRequirePlugin = ( 1 ?
  5464. // This version of checkDojoRequirePlugin makes the observation that all dojoRequireCallbacks can be released
  5465. // when all *non-dojo/require!, dojo/loadInit!* modules are either executed, not requested, or arrived. This is
  5466. // the case since there are no more modules the loader is waiting for, therefore, dojo/require! must have
  5467. // everything it needs on board.
  5468. //
  5469. // The potential weakness of this algorithm is that dojo/require will not execute callbacks until *all* dependency
  5470. // trees are ready. It is possible that some trees may be ready earlier than others, and this extra wait is non-optimal.
  5471. // Still, for big projects, this seems better than the original algorithm below that proved slow in some cases.
  5472. // Note, however, the original algorithm had the potential to execute partial trees, but that potential was never enabled.
  5473. // There are also other optimization available with the original algorithm that have not been explored.
  5474. function(){
  5475. var module, mid;
  5476. for(mid in modules){
  5477. module = modules[mid];
  5478. if(module.noReqPluginCheck===undefined){
  5479. // tag the module as either a loadInit or require plugin or not for future reference
  5480. module.noReqPluginCheck = /loadInit\!/.test(mid) || /require\!/.test(mid) ? 1 : 0;
  5481. }
  5482. if(!module.executed && !module.noReqPluginCheck && module.injected==requested){
  5483. return;
  5484. }
  5485. }
  5486. guardCheckComplete(function(){
  5487. var oldCallbacks = dojoRequireCallbacks;
  5488. dojoRequireCallbacks = [];
  5489. array.forEach(oldCallbacks, function(cb){cb(1);});
  5490. });
  5491. } : (function(){
  5492. // Note: this is the original checkDojoRequirePlugin that is much slower than the algorithm above. However, we know it
  5493. // works, so we leave it here in case the algorithm above fails in some corner case.
  5494. //
  5495. // checkDojoRequirePlugin inspects all of the modules demanded by a dojo/require!<module-list> dependency
  5496. // to see if they have arrived. The loader does not release *any* of these modules to be instantiated
  5497. // until *all* of these modules are on board, thereby preventing the evaluation of a module with dojo.require's
  5498. // that reference modules that are not available.
  5499. //
  5500. // The algorithm works by traversing the dependency graphs (remember, there can be cycles so they are not trees)
  5501. // of each module in the dojoRequireModuleStack array (which contains the list of modules demanded by dojo/require!).
  5502. // The moment a single module is discovered that is missing, the algorithm gives up and indicates that not all
  5503. // modules are on board. dojo/loadInit! and dojo/require! are ignored because there dependencies are inserted
  5504. // directly in dojoRequireModuleStack. For example, if "your/module" module depends on "dojo/require!my/module", then
  5505. // *both* "dojo/require!my/module" and "my/module" will be in dojoRequireModuleStack. Obviously, if "my/module"
  5506. // is on board, then "dojo/require!my/module" is also satisfied, so the algorithm doesn't check for "dojo/require!my/module".
  5507. //
  5508. // Note: inserting a dojo/require!<some-module-list> dependency in the dojoRequireModuleStack achieves nothing
  5509. // with the current algorithm; however, having such modules present makes it possible to optimize the algorithm
  5510. //
  5511. // Note: prior versions of this algorithm had an optimization that signaled loaded on dojo/require! dependencies
  5512. // individually (rather than waiting for them all to be resolved). The implementation proved problematic with cycles
  5513. // and plugins. However, it is possible to reattach that strategy in the future.
  5514. // a set from module-id to {undefined | 1 | 0}, where...
  5515. // undefined => the module has not been inspected
  5516. // 0 => the module or at least one of its dependencies has not arrived
  5517. // 1 => the module is a loadInit! or require! plugin resource, or is currently being traversed (therefore, assume
  5518. // OK until proven otherwise), or has been completely traversed and all dependencies have arrived
  5519. var touched,
  5520. traverse = function(m){
  5521. touched[m.mid] = 1;
  5522. for(var t, module, deps = m.deps || [], i= 0; i<deps.length; i++){
  5523. module = deps[i];
  5524. if(!(t = touched[module.mid])){
  5525. if(t===0 || !traverse(module)){
  5526. touched[m.mid] = 0;
  5527. return false;
  5528. }
  5529. }
  5530. }
  5531. return true;
  5532. };
  5533. return function(){
  5534. // initialize the touched hash with easy-to-compute values that help short circuit recursive algorithm;
  5535. // recall loadInit/require plugin modules are dependencies of modules in dojoRequireModuleStack...
  5536. // which would cause a circular dependency chain that would never be resolved if checked here
  5537. // notice all dependencies of any particular loadInit/require plugin module will already
  5538. // be checked since those are pushed into dojoRequireModuleStack explicitly by the
  5539. // plugin...so if a particular loadInitPlugin module's dependencies are not really
  5540. // on board, that *will* be detected elsewhere in the traversal.
  5541. var module, mid;
  5542. touched = {};
  5543. for(mid in modules){
  5544. module = modules[mid];
  5545. if(module.executed || module.noReqPluginCheck){
  5546. touched[mid] = 1;
  5547. }else{
  5548. if(module.noReqPluginCheck!==0){
  5549. // tag the module as either a loadInit or require plugin or not for future reference
  5550. module.noReqPluginCheck = /loadInit\!/.test(mid) || /require\!/.test(mid) ? 1 : 0;
  5551. }
  5552. if(module.noReqPluginCheck){
  5553. touched[mid] = 1;
  5554. }else if(module.injected!==arrived){
  5555. // not executed, has not arrived, and is not a loadInit or require plugin resource
  5556. touched[mid] = 0;
  5557. }// else, leave undefined and we'll traverse the dependencies
  5558. }
  5559. }
  5560. for(var t, i = 0, end = dojoRequireModuleStack.length; i<end; i++){
  5561. module = dojoRequireModuleStack[i];
  5562. if(!(t = touched[module.mid])){
  5563. if(t===0 || !traverse(module)){
  5564. return;
  5565. }
  5566. }
  5567. }
  5568. guardCheckComplete(function(){
  5569. var oldCallbacks = dojoRequireCallbacks;
  5570. dojoRequireCallbacks = [];
  5571. array.forEach(oldCallbacks, function(cb){cb(1);});
  5572. });
  5573. };
  5574. })()),
  5575. dojoLoadInitPlugin = function(mid, require, loaded){
  5576. // mid names a module that defines a "dojo load init" bundle, an object with two properties:
  5577. //
  5578. // * names: a vector of module ids that give top-level names to define in the lexical scope of def
  5579. // * def: a function that contains some some legacy loader API applications
  5580. //
  5581. // The point of def is to possibly cause some modules to be loaded (but not executed) by dojo/require! where the module
  5582. // ids are possibly-determined at runtime. For example, here is dojox.gfx from v1.6 expressed as an AMD module using the dojo/loadInit
  5583. // and dojo/require plugins.
  5584. //
  5585. // // dojox/gfx:
  5586. //
  5587. // define("*loadInit_12, {
  5588. // names:["dojo", "dijit", "dojox"],
  5589. // def: function(){
  5590. // dojo.loadInit(function(){
  5591. // var gfx = lang.getObject("dojox.gfx", true);
  5592. //
  5593. // //
  5594. // // code required to set gfx properties ommitted...
  5595. // //
  5596. //
  5597. // // now use the calculations to include the runtime-dependent module
  5598. // dojo.require("dojox.gfx." + gfx.renderer);
  5599. // });
  5600. // }
  5601. // });
  5602. //
  5603. // define(["dojo", "dojo/loadInit!" + id].concat("dojo/require!dojox/gfx/matric,dojox/gfx/_base"), function(dojo){
  5604. // // when this AMD factory function is executed, the following modules are guaranteed downloaded but not executed:
  5605. // // "dojox.gfx." + gfx.renderer
  5606. // // dojox.gfx.matrix
  5607. // // dojox.gfx._base
  5608. // dojo.provide("dojo.gfx");
  5609. // dojo.require("dojox.gfx.matrix");
  5610. // dojo.require("dojox.gfx._base");
  5611. // dojo.require("dojox.gfx." + gfx.renderer);
  5612. // return lang.getObject("dojo.gfx");
  5613. // });
  5614. // })();
  5615. //
  5616. // The idea is to run the legacy loader API with global variables shadowed, which allows these variables to
  5617. // be relocated. For example, dojox and dojo could be relocated to different names by giving a map and the code above will
  5618. // execute properly (because the plugin below resolves the load init bundle.names module with respect to the module that demanded
  5619. // the plugin resource).
  5620. //
  5621. // Note that the relocation is specified in the runtime configuration; relocated names need not be set at build-time.
  5622. //
  5623. // Warning: this is not the best way to express dojox.gfx as and AMD module. In fact, the module has been properly converted in
  5624. // v1.7. However, this technique allows the builder to convert legacy modules into AMD modules and guarantee the codepath is the
  5625. // same in the converted AMD module.
  5626. require([mid], function(bundle){
  5627. // notice how names is resolved with respect to the module that demanded the plugin resource
  5628. require(bundle.names, function(){
  5629. // bring the bundle names into scope
  5630. for(var scopeText = "", args= [], i = 0; i<arguments.length; i++){
  5631. scopeText+= "var " + bundle.names[i] + "= arguments[" + i + "]; ";
  5632. args.push(arguments[i]);
  5633. }
  5634. eval(scopeText);
  5635. var callingModule = require.module,
  5636. // the list of modules that need to be downloaded but not executed before the callingModule can be executed
  5637. requireList = [],
  5638. // the list of i18n bundles that are xdomain; undefined if none
  5639. i18nDeps,
  5640. syncLoaderApi = {
  5641. provide:function(moduleName){
  5642. // mark modules that arrive consequent to multiple provides in this module as arrived since they can't be injected
  5643. moduleName = slashName(moduleName);
  5644. var providedModule = getModule(moduleName, callingModule);
  5645. if(providedModule!==callingModule){
  5646. setArrived(providedModule);
  5647. }
  5648. },
  5649. require:function(moduleName, omitModuleCheck){
  5650. moduleName = slashName(moduleName);
  5651. omitModuleCheck && (getModule(moduleName, callingModule).result = nonmodule);
  5652. requireList.push(moduleName);
  5653. },
  5654. requireLocalization:function(moduleName, bundleName, locale){
  5655. // since we're going to need dojo/i8n, add it to i18nDeps if not already there
  5656. if(!i18nDeps){
  5657. // don't have to map since that will occur when the dependency is resolved
  5658. i18nDeps = ["dojo/i18n"];
  5659. }
  5660. // figure out if the bundle is xdomain; if so, add it to the i18nDepsSet
  5661. locale = (locale || dojo.locale).toLowerCase();
  5662. moduleName = slashName(moduleName) + "/nls/" + (/root/i.test(locale) ? "" : locale + "/") + slashName(bundleName);
  5663. if(getModule(moduleName, callingModule).isXd){
  5664. // don't have to map since that will occur when the dependency is resolved
  5665. i18nDeps.push("dojo/i18n!" + moduleName);
  5666. }// else the bundle will be loaded synchronously when the module is evaluated
  5667. },
  5668. loadInit:function(f){
  5669. f();
  5670. }
  5671. },
  5672. hold = {},
  5673. p;
  5674. // hijack the correct dojo and apply bundle.def
  5675. try{
  5676. for(p in syncLoaderApi){
  5677. hold[p] = dojo[p];
  5678. dojo[p] = syncLoaderApi[p];
  5679. }
  5680. bundle.def.apply(null, args);
  5681. }catch(e){
  5682. signal("error", [makeErrorToken("failedDojoLoadInit"), e]);
  5683. }finally{
  5684. for(p in syncLoaderApi){
  5685. dojo[p] = hold[p];
  5686. }
  5687. }
  5688. if(i18nDeps){
  5689. requireList = requireList.concat(i18nDeps);
  5690. }
  5691. if(requireList.length){
  5692. dojoRequirePlugin(requireList.join(","), require, loaded);
  5693. }else{
  5694. loaded();
  5695. }
  5696. });
  5697. });
  5698. },
  5699. extractApplication = function(
  5700. text, // the text to search
  5701. startSearch, // the position in text to start looking for the closing paren
  5702. startApplication // the position in text where the function application expression starts
  5703. ){
  5704. // find end of the call by finding the matching end paren
  5705. // Warning: as usual, this will fail in the presense of unmatched right parans contained in strings, regexs, or unremoved comments
  5706. var parenRe = /\(|\)/g,
  5707. matchCount = 1,
  5708. match;
  5709. parenRe.lastIndex = startSearch;
  5710. while((match = parenRe.exec(text))){
  5711. if(match[0] == ")"){
  5712. matchCount -= 1;
  5713. }else{
  5714. matchCount += 1;
  5715. }
  5716. if(matchCount == 0){
  5717. break;
  5718. }
  5719. }
  5720. if(matchCount != 0){
  5721. throw "unmatched paren around character " + parenRe.lastIndex + " in: " + text;
  5722. }
  5723. //Put the master matching string in the results.
  5724. return [dojo.trim(text.substring(startApplication, parenRe.lastIndex))+";\n", parenRe.lastIndex];
  5725. },
  5726. // the following regex is taken from 1.6. It is a very poor technique to remove comments and
  5727. // will fail in some cases; for example, consider the code...
  5728. //
  5729. // var message = "Category-1 */* Category-2";
  5730. //
  5731. // The regex that follows will see a /* comment and trash the code accordingly. In fact, there are all
  5732. // kinds of cases like this with strings and regexs that will cause this design to fail miserably.
  5733. //
  5734. // Alternative regex designs exist that will result in less-likely failures, but will still fail in many cases.
  5735. // The only solution guaranteed 100% correct is to parse the code and that seems overkill for this
  5736. // backcompat/unbuilt-xdomain layer. In the end, since it's been this way for a while, we won't change it.
  5737. // See the opening paragraphs of Chapter 7 or ECME-262 which describes the lexical abiguity further.
  5738. removeCommentRe = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
  5739. syncLoaderApiRe = /(^|\s)dojo\.(loadInit|require|provide|requireLocalization|requireIf|requireAfterIf|platformRequire)\s*\(/mg,
  5740. amdLoaderApiRe = /(^|\s)(require|define)\s*\(/m,
  5741. extractLegacyApiApplications = function(text, noCommentText){
  5742. // scan the noCommentText for any legacy loader API applications. Copy such applications into result (this is
  5743. // used by the builder). Move dojo.loadInit applications to loadInitApplications string. Copy all other applications
  5744. // to otherApplications string. If no applications were found, return 0, signalling an AMD module. Otherwise, return
  5745. // loadInitApplications + otherApplications. Fixup text by replacing
  5746. //
  5747. // dojo.loadInit(// etc...
  5748. //
  5749. // with
  5750. //
  5751. // \n 0 && dojo.loadInit(// etc...
  5752. //
  5753. // Which results in the dojo.loadInit from *not* being applied. This design goes a long way towards protecting the
  5754. // code from an over-agressive removeCommentRe. However...
  5755. //
  5756. // WARNING: the removeCommentRe will cause an error if a detected comment removes all or part of a legacy-loader application
  5757. // that is not in a comment.
  5758. var match, startSearch, startApplication, application,
  5759. loadInitApplications = [],
  5760. otherApplications = [],
  5761. allApplications = [];
  5762. // noCommentText may be provided by a build app with comments extracted by a better method than regex (hopefully)
  5763. noCommentText = noCommentText || text.replace(removeCommentRe, function(match){
  5764. // remove iff the detected comment has text that looks like a sync loader API application; this helps by
  5765. // removing as little as possible, minimizing the changes the janky regex will kill the module
  5766. syncLoaderApiRe.lastIndex = amdLoaderApiRe.lastIndex = 0;
  5767. return (syncLoaderApiRe.test(match) || amdLoaderApiRe.test(match)) ? "" : match;
  5768. });
  5769. // find and extract all dojo.loadInit applications
  5770. while((match = syncLoaderApiRe.exec(noCommentText))){
  5771. startSearch = syncLoaderApiRe.lastIndex;
  5772. startApplication = startSearch - match[0].length;
  5773. application = extractApplication(noCommentText, startSearch, startApplication);
  5774. if(match[2]=="loadInit"){
  5775. loadInitApplications.push(application[0]);
  5776. }else{
  5777. otherApplications.push(application[0]);
  5778. }
  5779. syncLoaderApiRe.lastIndex = application[1];
  5780. }
  5781. allApplications = loadInitApplications.concat(otherApplications);
  5782. if(allApplications.length || !amdLoaderApiRe.test(noCommentText)){
  5783. // either there were some legacy loader API applications or there were no AMD API applications
  5784. return [text.replace(/(^|\s)dojo\.loadInit\s*\(/g, "\n0 && dojo.loadInit("), allApplications.join(""), allApplications];
  5785. }else{
  5786. // legacy loader API *was not* detected and AMD API *was* detected; therefore, assume it's an AMD module
  5787. return 0;
  5788. }
  5789. },
  5790. transformToAmd = function(module, text){
  5791. // This is roughly the equivalent of dojo._xdCreateResource in 1.6-; however, it expresses a v1.6- dojo
  5792. // module in terms of AMD define instead of creating the dojo proprietary xdomain module expression.
  5793. // The module could have originated from several sources:
  5794. //
  5795. // * amd require() a module, e.g., require(["my/module"])
  5796. // * amd require() a nonmodule, e.g., require(["my/resource.js"')
  5797. // * amd define() deps vector (always a module)
  5798. // * dojo.require() a module, e.g. dojo.require("my.module")
  5799. // * dojo.require() a nonmodule, e.g., dojo.require("my.module", true)
  5800. // * dojo.requireIf/requireAfterIf/platformRequire a module
  5801. //
  5802. // The module is scanned for legacy loader API applications; if none are found, then assume the module is an
  5803. // AMD module and return 0. Otherwise, a synthetic dojo/loadInit plugin resource is created and the module text
  5804. // is rewritten as an AMD module with the single dependency of this synthetic resource. When the dojo/loadInit
  5805. // plugin loaded the synthetic resource, it will cause all dojo.loadInit's to be executed, find all dojo.require's
  5806. // (either directly consequent to dojo.require or indirectly consequent to dojo.require[After]If or
  5807. // dojo.platformRequire, and finally cause loading of all dojo.required modules with the dojo/require plugin. Thus,
  5808. // when the dojo/loadInit plugin reports it has been loaded, all modules required by the given module are guaranteed
  5809. // loaded (but not executed). This then allows the module to execute it's code path without interupts, thereby
  5810. // following the synchronous code path.
  5811. //
  5812. // Notice that this function behaves the same whether or not it happens to be in a mapped dojo/loader module.
  5813. var extractResult, id, names = [], namesAsStrings = [];
  5814. if(buildDetectRe.test(text) || !(extractResult = extractLegacyApiApplications(text))){
  5815. // buildDetectRe.test(text) => a built module, always AMD
  5816. // extractResult==0 => no sync API
  5817. return 0;
  5818. }
  5819. // manufacture a synthetic module id that can never be a real mdule id (just like require does)
  5820. id = module.mid + "-*loadInit";
  5821. // construct the dojo/loadInit names vector which causes any relocated names to be defined as lexical variables under their not-relocated name
  5822. // the dojo/loadInit plugin assumes the first name in names is "dojo"
  5823. for(var p in getModule("dojo", module).result.scopeMap){
  5824. names.push(p);
  5825. namesAsStrings.push('"' + p + '"');
  5826. }
  5827. // rewrite the module as a synthetic dojo/loadInit plugin resource + the module expressed as an AMD module that depends on this synthetic resource
  5828. // don't have to map dojo/init since that will occur when the dependency is resolved
  5829. return "// xdomain rewrite of " + module.mid + "\n" +
  5830. "define('" + id + "',{\n" +
  5831. "\tnames:" + dojo.toJson(names) + ",\n" +
  5832. "\tdef:function(" + names.join(",") + "){" + extractResult[1] + "}" +
  5833. "});\n\n" +
  5834. "define(" + dojo.toJson(names.concat(["dojo/loadInit!"+id])) + ", function(" + names.join(",") + "){\n" + extractResult[0] + "});";
  5835. },
  5836. loaderVars = require.initSyncLoader(dojoRequirePlugin, checkDojoRequirePlugin, transformToAmd),
  5837. sync =
  5838. loaderVars.sync,
  5839. requested =
  5840. loaderVars.requested,
  5841. arrived =
  5842. loaderVars.arrived,
  5843. nonmodule =
  5844. loaderVars.nonmodule,
  5845. executing =
  5846. loaderVars.executing,
  5847. executed =
  5848. loaderVars.executed,
  5849. syncExecStack =
  5850. loaderVars.syncExecStack,
  5851. modules =
  5852. loaderVars.modules,
  5853. execQ =
  5854. loaderVars.execQ,
  5855. getModule =
  5856. loaderVars.getModule,
  5857. injectModule =
  5858. loaderVars.injectModule,
  5859. setArrived =
  5860. loaderVars.setArrived,
  5861. signal =
  5862. loaderVars.signal,
  5863. finishExec =
  5864. loaderVars.finishExec,
  5865. execModule =
  5866. loaderVars.execModule,
  5867. getLegacyMode =
  5868. loaderVars.getLegacyMode,
  5869. guardCheckComplete =
  5870. loaderVars.guardCheckComplete;
  5871. // there is exactly one dojoRequirePlugin among possibly-many dojo/_base/loader's (owing to mapping)
  5872. dojoRequirePlugin = loaderVars.dojoRequirePlugin;
  5873. dojo.provide = function(mid){
  5874. var executingModule = syncExecStack[0],
  5875. module = lang.mixin(getModule(slashName(mid), require.module), {
  5876. executed:executing,
  5877. result:lang.getObject(mid, true)
  5878. });
  5879. setArrived(module);
  5880. if(executingModule){
  5881. (executingModule.provides || (executingModule.provides = [])).push(function(){
  5882. module.result = lang.getObject(mid);
  5883. delete module.provides;
  5884. module.executed!==executed && finishExec(module);
  5885. });
  5886. }// else dojo.provide called not consequent to loading; therefore, give up trying to publish module value to loader namespace
  5887. return module.result;
  5888. };
  5889. has.add("config-publishRequireResult", 1, 0, 0);
  5890. dojo.require = function(moduleName, omitModuleCheck) {
  5891. // summary:
  5892. // loads a Javascript module from the appropriate URI
  5893. //
  5894. // moduleName: String
  5895. // module name to load, using periods for separators,
  5896. // e.g. "dojo.date.locale". Module paths are de-referenced by dojo's
  5897. // internal mapping of locations to names and are disambiguated by
  5898. // longest prefix. See `dojo.registerModulePath()` for details on
  5899. // registering new modules.
  5900. //
  5901. // omitModuleCheck: Boolean?
  5902. // if `true`, omitModuleCheck skips the step of ensuring that the
  5903. // loaded file actually defines the symbol it is referenced by.
  5904. // For example if it called as `dojo.require("a.b.c")` and the
  5905. // file located at `a/b/c.js` does not define an object `a.b.c`,
  5906. // and exception will be throws whereas no exception is raised
  5907. // when called as `dojo.require("a.b.c", true)`
  5908. //
  5909. // description:
  5910. // Modules are loaded via dojo.require by using one of two loaders: the normal loader
  5911. // and the xdomain loader. The xdomain loader is used when dojo was built with a
  5912. // custom build that specified loader=xdomain and the module lives on a modulePath
  5913. // that is a whole URL, with protocol and a domain. The versions of Dojo that are on
  5914. // the Google and AOL CDNs use the xdomain loader.
  5915. //
  5916. // If the module is loaded via the xdomain loader, it is an asynchronous load, since
  5917. // the module is added via a dynamically created script tag. This
  5918. // means that dojo.require() can return before the module has loaded. However, this
  5919. // should only happen in the case where you do dojo.require calls in the top-level
  5920. // HTML page, or if you purposely avoid the loader checking for dojo.require
  5921. // dependencies in your module by using a syntax like dojo["require"] to load the module.
  5922. //
  5923. // Sometimes it is useful to not have the loader detect the dojo.require calls in the
  5924. // module so that you can dynamically load the modules as a result of an action on the
  5925. // page, instead of right at module load time.
  5926. //
  5927. // Also, for script blocks in an HTML page, the loader does not pre-process them, so
  5928. // it does not know to download the modules before the dojo.require calls occur.
  5929. //
  5930. // So, in those two cases, when you want on-the-fly module loading or for script blocks
  5931. // in the HTML page, special care must be taken if the dojo.required code is loaded
  5932. // asynchronously. To make sure you can execute code that depends on the dojo.required
  5933. // modules, be sure to add the code that depends on the modules in a dojo.addOnLoad()
  5934. // callback. dojo.addOnLoad waits for all outstanding modules to finish loading before
  5935. // executing.
  5936. //
  5937. // This type of syntax works with both xdomain and normal loaders, so it is good
  5938. // practice to always use this idiom for on-the-fly code loading and in HTML script
  5939. // blocks. If at some point you change loaders and where the code is loaded from,
  5940. // it will all still work.
  5941. //
  5942. // More on how dojo.require
  5943. // `dojo.require("A.B")` first checks to see if symbol A.B is
  5944. // defined. If it is, it is simply returned (nothing to do).
  5945. //
  5946. // If it is not defined, it will look for `A/B.js` in the script root
  5947. // directory.
  5948. //
  5949. // `dojo.require` throws an exception if it cannot find a file
  5950. // to load, or if the symbol `A.B` is not defined after loading.
  5951. //
  5952. // It returns the object `A.B`, but note the caveats above about on-the-fly loading and
  5953. // HTML script blocks when the xdomain loader is loading a module.
  5954. //
  5955. // `dojo.require()` does nothing about importing symbols into
  5956. // the current namespace. It is presumed that the caller will
  5957. // take care of that.
  5958. //
  5959. // example:
  5960. // To use dojo.require in conjunction with dojo.ready:
  5961. //
  5962. // | dojo.require("foo");
  5963. // | dojo.require("bar");
  5964. // | dojo.addOnLoad(function(){
  5965. // | //you can now safely do something with foo and bar
  5966. // | });
  5967. //
  5968. // example:
  5969. // For example, to import all symbols into a local block, you might write:
  5970. //
  5971. // | with (dojo.require("A.B")) {
  5972. // | ...
  5973. // | }
  5974. //
  5975. // And to import just the leaf symbol to a local variable:
  5976. //
  5977. // | var B = dojo.require("A.B");
  5978. // | ...
  5979. //
  5980. // returns:
  5981. // the required namespace object
  5982. function doRequire(mid, omitModuleCheck){
  5983. var module = getModule(slashName(mid), require.module);
  5984. if(syncExecStack.length && syncExecStack[0].finish){
  5985. // switched to async loading in the middle of evaluating a legacy module; stop
  5986. // applying dojo.require so the remaining dojo.requires are applied in order
  5987. syncExecStack[0].finish.push(mid);
  5988. return undefined;
  5989. }
  5990. // recall module.executed has values {0, executing, executed}; therefore, truthy indicates executing or executed
  5991. if(module.executed){
  5992. return module.result;
  5993. }
  5994. omitModuleCheck && (module.result = nonmodule);
  5995. // rcg...why here and in two lines??
  5996. var currentMode = getLegacyMode();
  5997. // recall, in sync mode to inject is to *eval* the module text
  5998. // if the module is a legacy module, this is the same as executing
  5999. // but if the module is an AMD module, this means defining, not executing
  6000. injectModule(module);
  6001. // the inject may have changed the mode
  6002. currentMode = getLegacyMode();
  6003. // in sync mode to dojo.require is to execute
  6004. if(module.executed!==executed && module.injected===arrived){
  6005. // the module was already here before injectModule was called probably finishing up a xdomain
  6006. // load, but maybe a module given to the loader directly rather than having the loader retrieve it
  6007. loaderVars.guardCheckComplete(function(){
  6008. execModule(module);
  6009. });
  6010. }
  6011. if(module.executed){
  6012. return module.result;
  6013. }
  6014. if(currentMode==sync){
  6015. // the only way to get here is in sync mode and dojo.required a module that
  6016. // * was loaded async in the injectModule application a few lines up
  6017. // * was an AMD module that had deps that are being loaded async and therefore couldn't execute
  6018. if(module.cjs){
  6019. // the module was an AMD module; unshift, not push, which causes the current traversal to be reattempted from the top
  6020. execQ.unshift(module);
  6021. }else{
  6022. // the module was a legacy module
  6023. syncExecStack.length && (syncExecStack[0].finish= [mid]);
  6024. }
  6025. }else{
  6026. // the loader wasn't in sync mode on entry; probably async mode; therefore, no expectation of getting
  6027. // the module value synchronously; make sure it gets executed though
  6028. execQ.push(module);
  6029. }
  6030. return undefined;
  6031. }
  6032. var result = doRequire(moduleName, omitModuleCheck);
  6033. if(has("config-publishRequireResult") && !lang.exists(moduleName) && result!==undefined){
  6034. lang.setObject(moduleName, result);
  6035. }
  6036. return result;
  6037. };
  6038. dojo.loadInit = function(f) {
  6039. f();
  6040. };
  6041. dojo.registerModulePath = function(/*String*/moduleName, /*String*/prefix){
  6042. // summary:
  6043. // Maps a module name to a path
  6044. // description:
  6045. // An unregistered module is given the default path of ../[module],
  6046. // relative to Dojo root. For example, module acme is mapped to
  6047. // ../acme. If you want to use a different module name, use
  6048. // dojo.registerModulePath.
  6049. // example:
  6050. // If your dojo.js is located at this location in the web root:
  6051. // | /myapp/js/dojo/dojo/dojo.js
  6052. // and your modules are located at:
  6053. // | /myapp/js/foo/bar.js
  6054. // | /myapp/js/foo/baz.js
  6055. // | /myapp/js/foo/thud/xyzzy.js
  6056. // Your application can tell Dojo to locate the "foo" namespace by calling:
  6057. // | dojo.registerModulePath("foo", "../../foo");
  6058. // At which point you can then use dojo.require() to load the
  6059. // modules (assuming they provide() the same things which are
  6060. // required). The full code might be:
  6061. // | <script type="text/javascript"
  6062. // | src="/myapp/js/dojo/dojo/dojo.js"></script>
  6063. // | <script type="text/javascript">
  6064. // | dojo.registerModulePath("foo", "../../foo");
  6065. // | dojo.require("foo.bar");
  6066. // | dojo.require("foo.baz");
  6067. // | dojo.require("foo.thud.xyzzy");
  6068. // | </script>
  6069. var paths = {};
  6070. paths[moduleName.replace(/\./g, "/")] = prefix;
  6071. require({paths:paths});
  6072. };
  6073. dojo.platformRequire = function(/*Object*/modMap){
  6074. // summary:
  6075. // require one or more modules based on which host environment
  6076. // Dojo is currently operating in
  6077. // description:
  6078. // This method takes a "map" of arrays which one can use to
  6079. // optionally load dojo modules. The map is indexed by the
  6080. // possible dojo.name_ values, with two additional values:
  6081. // "default" and "common". The items in the "default" array will
  6082. // be loaded if none of the other items have been choosen based on
  6083. // dojo.name_, set by your host environment. The items in the
  6084. // "common" array will *always* be loaded, regardless of which
  6085. // list is chosen.
  6086. // example:
  6087. // | dojo.platformRequire({
  6088. // | browser: [
  6089. // | "foo.sample", // simple module
  6090. // | "foo.test",
  6091. // | ["foo.bar.baz", true] // skip object check in _loadModule (dojo.require)
  6092. // | ],
  6093. // | default: [ "foo.sample._base" ],
  6094. // | common: [ "important.module.common" ]
  6095. // | });
  6096. var result = (modMap.common || []).concat(modMap[dojo._name] || modMap["default"] || []),
  6097. temp;
  6098. while(result.length){
  6099. if(lang.isArray(temp = result.shift())){
  6100. dojo.require.apply(dojo, temp);
  6101. }else{
  6102. dojo.require(temp);
  6103. }
  6104. }
  6105. };
  6106. dojo.requireIf = dojo.requireAfterIf = function(/*Boolean*/ condition, /*String*/ moduleName, /*Boolean?*/omitModuleCheck){
  6107. // summary:
  6108. // If the condition is true then call `dojo.require()` for the specified
  6109. // resource
  6110. //
  6111. // example:
  6112. // | dojo.requireIf(dojo.isBrowser, "my.special.Module");
  6113. if(condition){
  6114. dojo.require(moduleName, omitModuleCheck);
  6115. }
  6116. };
  6117. dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale){
  6118. require(["../i18n"], function(i18n){
  6119. i18n.getLocalization(moduleName, bundleName, locale);
  6120. });
  6121. };
  6122. return {
  6123. // summary:
  6124. // This module defines the v1.x synchronous loader API.
  6125. extractLegacyApiApplications:extractLegacyApiApplications,
  6126. require:dojoRequirePlugin,
  6127. loadInit:dojoLoadInitPlugin
  6128. };
  6129. });
  6130. },
  6131. 'dojo/json':function(){
  6132. define(["./has"], function(has){
  6133. "use strict";
  6134. var hasJSON = typeof JSON != "undefined";
  6135. has.add("json-parse", hasJSON); // all the parsers work fine
  6136. // Firefox 3.5/Gecko 1.9 fails to use replacer in stringify properly https://bugzilla.mozilla.org/show_bug.cgi?id=509184
  6137. has.add("json-stringify", hasJSON && JSON.stringify({a:0}, function(k,v){return v||1;}) == '{"a":1}');
  6138. /*=====
  6139. return {
  6140. // summary:
  6141. // Functions to parse and serialize JSON
  6142. parse: function(str, strict){
  6143. // summary:
  6144. // Parses a [JSON](http://json.org) string to return a JavaScript object.
  6145. // description:
  6146. // This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
  6147. // Throws for invalid JSON strings. This delegates to eval() if native JSON
  6148. // support is not available. By default this will evaluate any valid JS expression.
  6149. // With the strict parameter set to true, the parser will ensure that only
  6150. // valid JSON strings are parsed (otherwise throwing an error). Without the strict
  6151. // parameter, the content passed to this method must come
  6152. // from a trusted source.
  6153. // str:
  6154. // a string literal of a JSON item, for instance:
  6155. // `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
  6156. // strict:
  6157. // When set to true, this will ensure that only valid, secure JSON is ever parsed.
  6158. // Make sure this is set to true for untrusted content. Note that on browsers/engines
  6159. // without native JSON support, setting this to true will run slower.
  6160. },
  6161. stringify: function(value, replacer, spacer){
  6162. // summary:
  6163. // Returns a [JSON](http://json.org) serialization of an object.
  6164. // description:
  6165. // Returns a [JSON](http://json.org) serialization of an object.
  6166. // This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
  6167. // Note that this doesn't check for infinite recursion, so don't do that!
  6168. // value:
  6169. // A value to be serialized.
  6170. // replacer:
  6171. // A replacer function that is called for each value and can return a replacement
  6172. // spacer:
  6173. // A spacer string to be used for pretty printing of JSON
  6174. // example:
  6175. // simple serialization of a trivial object
  6176. // | define(["dojo/json"], function(JSON){
  6177. // | var jsonStr = JSON.stringify({ howdy: "stranger!", isStrange: true });
  6178. // | doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
  6179. }
  6180. };
  6181. =====*/
  6182. if(has("json-stringify")){
  6183. return JSON;
  6184. }else{
  6185. var escapeString = function(/*String*/str){
  6186. // summary:
  6187. // Adds escape sequences for non-visual characters, double quote and
  6188. // backslash and surrounds with double quotes to form a valid string
  6189. // literal.
  6190. return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
  6191. replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
  6192. replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
  6193. };
  6194. return {
  6195. parse: has("json-parse") ? JSON.parse : function(str, strict){
  6196. if(strict && !/^([\s\[\{]*(?:"(?:\\.|[^"])+"|-?\d[\d\.]*(?:[Ee][+-]?\d+)?|null|true|false|)[\s\]\}]*(?:,|:|$))+$/.test(str)){
  6197. throw new SyntaxError("Invalid characters in JSON");
  6198. }
  6199. return eval('(' + str + ')');
  6200. },
  6201. stringify: function(value, replacer, spacer){
  6202. var undef;
  6203. if(typeof replacer == "string"){
  6204. spacer = replacer;
  6205. replacer = null;
  6206. }
  6207. function stringify(it, indent, key){
  6208. if(replacer){
  6209. it = replacer(key, it);
  6210. }
  6211. var val, objtype = typeof it;
  6212. if(objtype == "number"){
  6213. return isFinite(it) ? it + "" : "null";
  6214. }
  6215. if(objtype == "boolean"){
  6216. return it + "";
  6217. }
  6218. if(it === null){
  6219. return "null";
  6220. }
  6221. if(typeof it == "string"){
  6222. return escapeString(it);
  6223. }
  6224. if(objtype == "function" || objtype == "undefined"){
  6225. return undef; // undefined
  6226. }
  6227. // short-circuit for objects that support "json" serialization
  6228. // if they return "self" then just pass-through...
  6229. if(typeof it.toJSON == "function"){
  6230. return stringify(it.toJSON(key), indent, key);
  6231. }
  6232. if(it instanceof Date){
  6233. return '"{FullYear}-{Month+}-{Date}T{Hours}:{Minutes}:{Seconds}Z"'.replace(/\{(\w+)(\+)?\}/g, function(t, prop, plus){
  6234. var num = it["getUTC" + prop]() + (plus ? 1 : 0);
  6235. return num < 10 ? "0" + num : num;
  6236. });
  6237. }
  6238. if(it.valueOf() !== it){
  6239. // primitive wrapper, try again unwrapped:
  6240. return stringify(it.valueOf(), indent, key);
  6241. }
  6242. var nextIndent= spacer ? (indent + spacer) : "";
  6243. /* we used to test for DOM nodes and throw, but FF serializes them as {}, so cross-browser consistency is probably not efficiently attainable */
  6244. var sep = spacer ? " " : "";
  6245. var newLine = spacer ? "\n" : "";
  6246. // array
  6247. if(it instanceof Array){
  6248. var itl = it.length, res = [];
  6249. for(key = 0; key < itl; key++){
  6250. var obj = it[key];
  6251. val = stringify(obj, nextIndent, key);
  6252. if(typeof val != "string"){
  6253. val = "null";
  6254. }
  6255. res.push(newLine + nextIndent + val);
  6256. }
  6257. return "[" + res.join(",") + newLine + indent + "]";
  6258. }
  6259. // generic object code path
  6260. var output = [];
  6261. for(key in it){
  6262. var keyStr;
  6263. if(it.hasOwnProperty(key)){
  6264. if(typeof key == "number"){
  6265. keyStr = '"' + key + '"';
  6266. }else if(typeof key == "string"){
  6267. keyStr = escapeString(key);
  6268. }else{
  6269. // skip non-string or number keys
  6270. continue;
  6271. }
  6272. val = stringify(it[key], nextIndent, key);
  6273. if(typeof val != "string"){
  6274. // skip non-serializable values
  6275. continue;
  6276. }
  6277. // At this point, the most non-IE browsers don't get in this branch
  6278. // (they have native JSON), so push is definitely the way to
  6279. output.push(newLine + nextIndent + keyStr + ":" + sep + val);
  6280. }
  6281. }
  6282. return "{" + output.join(",") + newLine + indent + "}"; // String
  6283. }
  6284. return stringify(value, "", "");
  6285. }
  6286. };
  6287. }
  6288. });
  6289. },
  6290. 'dojo/_base/declare':function(){
  6291. define(["./kernel", "../has", "./lang"], function(dojo, has, lang){
  6292. // module:
  6293. // dojo/_base/declare
  6294. var mix = lang.mixin, op = Object.prototype, opts = op.toString,
  6295. xtor = new Function, counter = 0, cname = "constructor";
  6296. function err(msg, cls){ throw new Error("declare" + (cls ? " " + cls : "") + ": " + msg); }
  6297. // C3 Method Resolution Order (see http://www.python.org/download/releases/2.3/mro/)
  6298. function c3mro(bases, className){
  6299. var result = [], roots = [{cls: 0, refs: []}], nameMap = {}, clsCount = 1,
  6300. l = bases.length, i = 0, j, lin, base, top, proto, rec, name, refs;
  6301. // build a list of bases naming them if needed
  6302. for(; i < l; ++i){
  6303. base = bases[i];
  6304. if(!base){
  6305. err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?", className);
  6306. }else if(opts.call(base) != "[object Function]"){
  6307. err("mixin #" + i + " is not a callable constructor.", className);
  6308. }
  6309. lin = base._meta ? base._meta.bases : [base];
  6310. top = 0;
  6311. // add bases to the name map
  6312. for(j = lin.length - 1; j >= 0; --j){
  6313. proto = lin[j].prototype;
  6314. if(!proto.hasOwnProperty("declaredClass")){
  6315. proto.declaredClass = "uniqName_" + (counter++);
  6316. }
  6317. name = proto.declaredClass;
  6318. if(!nameMap.hasOwnProperty(name)){
  6319. nameMap[name] = {count: 0, refs: [], cls: lin[j]};
  6320. ++clsCount;
  6321. }
  6322. rec = nameMap[name];
  6323. if(top && top !== rec){
  6324. rec.refs.push(top);
  6325. ++top.count;
  6326. }
  6327. top = rec;
  6328. }
  6329. ++top.count;
  6330. roots[0].refs.push(top);
  6331. }
  6332. // remove classes without external references recursively
  6333. while(roots.length){
  6334. top = roots.pop();
  6335. result.push(top.cls);
  6336. --clsCount;
  6337. // optimization: follow a single-linked chain
  6338. while(refs = top.refs, refs.length == 1){
  6339. top = refs[0];
  6340. if(!top || --top.count){
  6341. // branch or end of chain => do not end to roots
  6342. top = 0;
  6343. break;
  6344. }
  6345. result.push(top.cls);
  6346. --clsCount;
  6347. }
  6348. if(top){
  6349. // branch
  6350. for(i = 0, l = refs.length; i < l; ++i){
  6351. top = refs[i];
  6352. if(!--top.count){
  6353. roots.push(top);
  6354. }
  6355. }
  6356. }
  6357. }
  6358. if(clsCount){
  6359. err("can't build consistent linearization", className);
  6360. }
  6361. // calculate the superclass offset
  6362. base = bases[0];
  6363. result[0] = base ?
  6364. base._meta && base === result[result.length - base._meta.bases.length] ?
  6365. base._meta.bases.length : 1 : 0;
  6366. return result;
  6367. }
  6368. function inherited(args, a, f){
  6369. var name, chains, bases, caller, meta, base, proto, opf, pos,
  6370. cache = this._inherited = this._inherited || {};
  6371. // crack arguments
  6372. if(typeof args == "string"){
  6373. name = args;
  6374. args = a;
  6375. a = f;
  6376. }
  6377. f = 0;
  6378. caller = args.callee;
  6379. name = name || caller.nom;
  6380. if(!name){
  6381. err("can't deduce a name to call inherited()", this.declaredClass);
  6382. }
  6383. meta = this.constructor._meta;
  6384. bases = meta.bases;
  6385. pos = cache.p;
  6386. if(name != cname){
  6387. // method
  6388. if(cache.c !== caller){
  6389. // cache bust
  6390. pos = 0;
  6391. base = bases[0];
  6392. meta = base._meta;
  6393. if(meta.hidden[name] !== caller){
  6394. // error detection
  6395. chains = meta.chains;
  6396. if(chains && typeof chains[name] == "string"){
  6397. err("calling chained method with inherited: " + name, this.declaredClass);
  6398. }
  6399. // find caller
  6400. do{
  6401. meta = base._meta;
  6402. proto = base.prototype;
  6403. if(meta && (proto[name] === caller && proto.hasOwnProperty(name) || meta.hidden[name] === caller)){
  6404. break;
  6405. }
  6406. }while(base = bases[++pos]); // intentional assignment
  6407. pos = base ? pos : -1;
  6408. }
  6409. }
  6410. // find next
  6411. base = bases[++pos];
  6412. if(base){
  6413. proto = base.prototype;
  6414. if(base._meta && proto.hasOwnProperty(name)){
  6415. f = proto[name];
  6416. }else{
  6417. opf = op[name];
  6418. do{
  6419. proto = base.prototype;
  6420. f = proto[name];
  6421. if(f && (base._meta ? proto.hasOwnProperty(name) : f !== opf)){
  6422. break;
  6423. }
  6424. }while(base = bases[++pos]); // intentional assignment
  6425. }
  6426. }
  6427. f = base && f || op[name];
  6428. }else{
  6429. // constructor
  6430. if(cache.c !== caller){
  6431. // cache bust
  6432. pos = 0;
  6433. meta = bases[0]._meta;
  6434. if(meta && meta.ctor !== caller){
  6435. // error detection
  6436. chains = meta.chains;
  6437. if(!chains || chains.constructor !== "manual"){
  6438. err("calling chained constructor with inherited", this.declaredClass);
  6439. }
  6440. // find caller
  6441. while(base = bases[++pos]){ // intentional assignment
  6442. meta = base._meta;
  6443. if(meta && meta.ctor === caller){
  6444. break;
  6445. }
  6446. }
  6447. pos = base ? pos : -1;
  6448. }
  6449. }
  6450. // find next
  6451. while(base = bases[++pos]){ // intentional assignment
  6452. meta = base._meta;
  6453. f = meta ? meta.ctor : base;
  6454. if(f){
  6455. break;
  6456. }
  6457. }
  6458. f = base && f;
  6459. }
  6460. // cache the found super method
  6461. cache.c = f;
  6462. cache.p = pos;
  6463. // now we have the result
  6464. if(f){
  6465. return a === true ? f : f.apply(this, a || args);
  6466. }
  6467. // intentionally no return if a super method was not found
  6468. }
  6469. function getInherited(name, args){
  6470. if(typeof name == "string"){
  6471. return this.__inherited(name, args, true);
  6472. }
  6473. return this.__inherited(name, true);
  6474. }
  6475. function inherited__debug(args, a1, a2){
  6476. var f = this.getInherited(args, a1);
  6477. if(f){ return f.apply(this, a2 || a1 || args); }
  6478. // intentionally no return if a super method was not found
  6479. }
  6480. var inheritedImpl = dojo.config.isDebug ? inherited__debug : inherited;
  6481. // emulation of "instanceof"
  6482. function isInstanceOf(cls){
  6483. var bases = this.constructor._meta.bases;
  6484. for(var i = 0, l = bases.length; i < l; ++i){
  6485. if(bases[i] === cls){
  6486. return true;
  6487. }
  6488. }
  6489. return this instanceof cls;
  6490. }
  6491. function mixOwn(target, source){
  6492. // add props adding metadata for incoming functions skipping a constructor
  6493. for(var name in source){
  6494. if(name != cname && source.hasOwnProperty(name)){
  6495. target[name] = source[name];
  6496. }
  6497. }
  6498. if(has("bug-for-in-skips-shadowed")){
  6499. for(var extraNames= lang._extraNames, i= extraNames.length; i;){
  6500. name = extraNames[--i];
  6501. if(name != cname && source.hasOwnProperty(name)){
  6502. target[name] = source[name];
  6503. }
  6504. }
  6505. }
  6506. }
  6507. // implementation of safe mixin function
  6508. function safeMixin(target, source){
  6509. // summary:
  6510. // Mix in properties skipping a constructor and decorating functions
  6511. // like it is done by declare().
  6512. // target: Object
  6513. // Target object to accept new properties.
  6514. // source: Object
  6515. // Source object for new properties.
  6516. // description:
  6517. // This function is used to mix in properties like lang.mixin does,
  6518. // but it skips a constructor property and decorates functions like
  6519. // declare() does.
  6520. //
  6521. // It is meant to be used with classes and objects produced with
  6522. // declare. Functions mixed in with dojo.safeMixin can use
  6523. // this.inherited() like normal methods.
  6524. //
  6525. // This function is used to implement extend() method of a constructor
  6526. // produced with declare().
  6527. //
  6528. // example:
  6529. // | var A = declare(null, {
  6530. // | m1: function(){
  6531. // | console.log("A.m1");
  6532. // | },
  6533. // | m2: function(){
  6534. // | console.log("A.m2");
  6535. // | }
  6536. // | });
  6537. // | var B = declare(A, {
  6538. // | m1: function(){
  6539. // | this.inherited(arguments);
  6540. // | console.log("B.m1");
  6541. // | }
  6542. // | });
  6543. // | B.extend({
  6544. // | m2: function(){
  6545. // | this.inherited(arguments);
  6546. // | console.log("B.m2");
  6547. // | }
  6548. // | });
  6549. // | var x = new B();
  6550. // | dojo.safeMixin(x, {
  6551. // | m1: function(){
  6552. // | this.inherited(arguments);
  6553. // | console.log("X.m1");
  6554. // | },
  6555. // | m2: function(){
  6556. // | this.inherited(arguments);
  6557. // | console.log("X.m2");
  6558. // | }
  6559. // | });
  6560. // | x.m2();
  6561. // | // prints:
  6562. // | // A.m1
  6563. // | // B.m1
  6564. // | // X.m1
  6565. var name, t;
  6566. // add props adding metadata for incoming functions skipping a constructor
  6567. for(name in source){
  6568. t = source[name];
  6569. if((t !== op[name] || !(name in op)) && name != cname){
  6570. if(opts.call(t) == "[object Function]"){
  6571. // non-trivial function method => attach its name
  6572. t.nom = name;
  6573. }
  6574. target[name] = t;
  6575. }
  6576. }
  6577. if(has("bug-for-in-skips-shadowed")){
  6578. for(var extraNames= lang._extraNames, i= extraNames.length; i;){
  6579. name = extraNames[--i];
  6580. t = source[name];
  6581. if((t !== op[name] || !(name in op)) && name != cname){
  6582. if(opts.call(t) == "[object Function]"){
  6583. // non-trivial function method => attach its name
  6584. t.nom = name;
  6585. }
  6586. target[name] = t;
  6587. }
  6588. }
  6589. }
  6590. return target;
  6591. }
  6592. function extend(source){
  6593. declare.safeMixin(this.prototype, source);
  6594. return this;
  6595. }
  6596. function createSubclass(mixins){
  6597. return declare([this].concat(mixins));
  6598. }
  6599. // chained constructor compatible with the legacy declare()
  6600. function chainedConstructor(bases, ctorSpecial){
  6601. return function(){
  6602. var a = arguments, args = a, a0 = a[0], f, i, m,
  6603. l = bases.length, preArgs;
  6604. if(!(this instanceof a.callee)){
  6605. // not called via new, so force it
  6606. return applyNew(a);
  6607. }
  6608. //this._inherited = {};
  6609. // perform the shaman's rituals of the original declare()
  6610. // 1) call two types of the preamble
  6611. if(ctorSpecial && (a0 && a0.preamble || this.preamble)){
  6612. // full blown ritual
  6613. preArgs = new Array(bases.length);
  6614. // prepare parameters
  6615. preArgs[0] = a;
  6616. for(i = 0;;){
  6617. // process the preamble of the 1st argument
  6618. a0 = a[0];
  6619. if(a0){
  6620. f = a0.preamble;
  6621. if(f){
  6622. a = f.apply(this, a) || a;
  6623. }
  6624. }
  6625. // process the preamble of this class
  6626. f = bases[i].prototype;
  6627. f = f.hasOwnProperty("preamble") && f.preamble;
  6628. if(f){
  6629. a = f.apply(this, a) || a;
  6630. }
  6631. // one peculiarity of the preamble:
  6632. // it is called if it is not needed,
  6633. // e.g., there is no constructor to call
  6634. // let's watch for the last constructor
  6635. // (see ticket #9795)
  6636. if(++i == l){
  6637. break;
  6638. }
  6639. preArgs[i] = a;
  6640. }
  6641. }
  6642. // 2) call all non-trivial constructors using prepared arguments
  6643. for(i = l - 1; i >= 0; --i){
  6644. f = bases[i];
  6645. m = f._meta;
  6646. f = m ? m.ctor : f;
  6647. if(f){
  6648. f.apply(this, preArgs ? preArgs[i] : a);
  6649. }
  6650. }
  6651. // 3) continue the original ritual: call the postscript
  6652. f = this.postscript;
  6653. if(f){
  6654. f.apply(this, args);
  6655. }
  6656. };
  6657. }
  6658. // chained constructor compatible with the legacy declare()
  6659. function singleConstructor(ctor, ctorSpecial){
  6660. return function(){
  6661. var a = arguments, t = a, a0 = a[0], f;
  6662. if(!(this instanceof a.callee)){
  6663. // not called via new, so force it
  6664. return applyNew(a);
  6665. }
  6666. //this._inherited = {};
  6667. // perform the shaman's rituals of the original declare()
  6668. // 1) call two types of the preamble
  6669. if(ctorSpecial){
  6670. // full blown ritual
  6671. if(a0){
  6672. // process the preamble of the 1st argument
  6673. f = a0.preamble;
  6674. if(f){
  6675. t = f.apply(this, t) || t;
  6676. }
  6677. }
  6678. f = this.preamble;
  6679. if(f){
  6680. // process the preamble of this class
  6681. f.apply(this, t);
  6682. // one peculiarity of the preamble:
  6683. // it is called even if it is not needed,
  6684. // e.g., there is no constructor to call
  6685. // let's watch for the last constructor
  6686. // (see ticket #9795)
  6687. }
  6688. }
  6689. // 2) call a constructor
  6690. if(ctor){
  6691. ctor.apply(this, a);
  6692. }
  6693. // 3) continue the original ritual: call the postscript
  6694. f = this.postscript;
  6695. if(f){
  6696. f.apply(this, a);
  6697. }
  6698. };
  6699. }
  6700. // plain vanilla constructor (can use inherited() to call its base constructor)
  6701. function simpleConstructor(bases){
  6702. return function(){
  6703. var a = arguments, i = 0, f, m;
  6704. if(!(this instanceof a.callee)){
  6705. // not called via new, so force it
  6706. return applyNew(a);
  6707. }
  6708. //this._inherited = {};
  6709. // perform the shaman's rituals of the original declare()
  6710. // 1) do not call the preamble
  6711. // 2) call the top constructor (it can use this.inherited())
  6712. for(; f = bases[i]; ++i){ // intentional assignment
  6713. m = f._meta;
  6714. f = m ? m.ctor : f;
  6715. if(f){
  6716. f.apply(this, a);
  6717. break;
  6718. }
  6719. }
  6720. // 3) call the postscript
  6721. f = this.postscript;
  6722. if(f){
  6723. f.apply(this, a);
  6724. }
  6725. };
  6726. }
  6727. function chain(name, bases, reversed){
  6728. return function(){
  6729. var b, m, f, i = 0, step = 1;
  6730. if(reversed){
  6731. i = bases.length - 1;
  6732. step = -1;
  6733. }
  6734. for(; b = bases[i]; i += step){ // intentional assignment
  6735. m = b._meta;
  6736. f = (m ? m.hidden : b.prototype)[name];
  6737. if(f){
  6738. f.apply(this, arguments);
  6739. }
  6740. }
  6741. };
  6742. }
  6743. // forceNew(ctor)
  6744. // return a new object that inherits from ctor.prototype but
  6745. // without actually running ctor on the object.
  6746. function forceNew(ctor){
  6747. // create object with correct prototype using a do-nothing
  6748. // constructor
  6749. xtor.prototype = ctor.prototype;
  6750. var t = new xtor;
  6751. xtor.prototype = null; // clean up
  6752. return t;
  6753. }
  6754. // applyNew(args)
  6755. // just like 'new ctor()' except that the constructor and its arguments come
  6756. // from args, which must be an array or an arguments object
  6757. function applyNew(args){
  6758. // create an object with ctor's prototype but without
  6759. // calling ctor on it.
  6760. var ctor = args.callee, t = forceNew(ctor);
  6761. // execute the real constructor on the new object
  6762. ctor.apply(t, args);
  6763. return t;
  6764. }
  6765. function declare(className, superclass, props){
  6766. // summary:
  6767. // Create a feature-rich constructor from compact notation.
  6768. // className: String?
  6769. // The optional name of the constructor (loosely, a "class")
  6770. // stored in the "declaredClass" property in the created prototype.
  6771. // It will be used as a global name for a created constructor.
  6772. // superclass: Function|Function[]
  6773. // May be null, a Function, or an Array of Functions. This argument
  6774. // specifies a list of bases (the left-most one is the most deepest
  6775. // base).
  6776. // props: Object
  6777. // An object whose properties are copied to the created prototype.
  6778. // Add an instance-initialization function by making it a property
  6779. // named "constructor".
  6780. // returns: dojo/_base/declare.__DeclareCreatedObject
  6781. // New constructor function.
  6782. // description:
  6783. // Create a constructor using a compact notation for inheritance and
  6784. // prototype extension.
  6785. //
  6786. // Mixin ancestors provide a type of multiple inheritance.
  6787. // Prototypes of mixin ancestors are copied to the new class:
  6788. // changes to mixin prototypes will not affect classes to which
  6789. // they have been mixed in.
  6790. //
  6791. // Ancestors can be compound classes created by this version of
  6792. // declare(). In complex cases all base classes are going to be
  6793. // linearized according to C3 MRO algorithm
  6794. // (see http://www.python.org/download/releases/2.3/mro/ for more
  6795. // details).
  6796. //
  6797. // "className" is cached in "declaredClass" property of the new class,
  6798. // if it was supplied. The immediate super class will be cached in
  6799. // "superclass" property of the new class.
  6800. //
  6801. // Methods in "props" will be copied and modified: "nom" property
  6802. // (the declared name of the method) will be added to all copied
  6803. // functions to help identify them for the internal machinery. Be
  6804. // very careful, while reusing methods: if you use the same
  6805. // function under different names, it can produce errors in some
  6806. // cases.
  6807. //
  6808. // It is possible to use constructors created "manually" (without
  6809. // declare()) as bases. They will be called as usual during the
  6810. // creation of an instance, their methods will be chained, and even
  6811. // called by "this.inherited()".
  6812. //
  6813. // Special property "-chains-" governs how to chain methods. It is
  6814. // a dictionary, which uses method names as keys, and hint strings
  6815. // as values. If a hint string is "after", this method will be
  6816. // called after methods of its base classes. If a hint string is
  6817. // "before", this method will be called before methods of its base
  6818. // classes.
  6819. //
  6820. // If "constructor" is not mentioned in "-chains-" property, it will
  6821. // be chained using the legacy mode: using "after" chaining,
  6822. // calling preamble() method before each constructor, if available,
  6823. // and calling postscript() after all constructors were executed.
  6824. // If the hint is "after", it is chained as a regular method, but
  6825. // postscript() will be called after the chain of constructors.
  6826. // "constructor" cannot be chained "before", but it allows
  6827. // a special hint string: "manual", which means that constructors
  6828. // are not going to be chained in any way, and programmer will call
  6829. // them manually using this.inherited(). In the latter case
  6830. // postscript() will be called after the construction.
  6831. //
  6832. // All chaining hints are "inherited" from base classes and
  6833. // potentially can be overridden. Be very careful when overriding
  6834. // hints! Make sure that all chained methods can work in a proposed
  6835. // manner of chaining.
  6836. //
  6837. // Once a method was chained, it is impossible to unchain it. The
  6838. // only exception is "constructor". You don't need to define a
  6839. // method in order to supply a chaining hint.
  6840. //
  6841. // If a method is chained, it cannot use this.inherited() because
  6842. // all other methods in the hierarchy will be called automatically.
  6843. //
  6844. // Usually constructors and initializers of any kind are chained
  6845. // using "after" and destructors of any kind are chained as
  6846. // "before". Note that chaining assumes that chained methods do not
  6847. // return any value: any returned value will be discarded.
  6848. //
  6849. // example:
  6850. // | declare("my.classes.bar", my.classes.foo, {
  6851. // | // properties to be added to the class prototype
  6852. // | someValue: 2,
  6853. // | // initialization function
  6854. // | constructor: function(){
  6855. // | this.myComplicatedObject = new ReallyComplicatedObject();
  6856. // | },
  6857. // | // other functions
  6858. // | someMethod: function(){
  6859. // | doStuff();
  6860. // | }
  6861. // | });
  6862. //
  6863. // example:
  6864. // | var MyBase = declare(null, {
  6865. // | // constructor, properties, and methods go here
  6866. // | // ...
  6867. // | });
  6868. // | var MyClass1 = declare(MyBase, {
  6869. // | // constructor, properties, and methods go here
  6870. // | // ...
  6871. // | });
  6872. // | var MyClass2 = declare(MyBase, {
  6873. // | // constructor, properties, and methods go here
  6874. // | // ...
  6875. // | });
  6876. // | var MyDiamond = declare([MyClass1, MyClass2], {
  6877. // | // constructor, properties, and methods go here
  6878. // | // ...
  6879. // | });
  6880. //
  6881. // example:
  6882. // | var F = function(){ console.log("raw constructor"); };
  6883. // | F.prototype.method = function(){
  6884. // | console.log("raw method");
  6885. // | };
  6886. // | var A = declare(F, {
  6887. // | constructor: function(){
  6888. // | console.log("A.constructor");
  6889. // | },
  6890. // | method: function(){
  6891. // | console.log("before calling F.method...");
  6892. // | this.inherited(arguments);
  6893. // | console.log("...back in A");
  6894. // | }
  6895. // | });
  6896. // | new A().method();
  6897. // | // will print:
  6898. // | // raw constructor
  6899. // | // A.constructor
  6900. // | // before calling F.method...
  6901. // | // raw method
  6902. // | // ...back in A
  6903. //
  6904. // example:
  6905. // | var A = declare(null, {
  6906. // | "-chains-": {
  6907. // | destroy: "before"
  6908. // | }
  6909. // | });
  6910. // | var B = declare(A, {
  6911. // | constructor: function(){
  6912. // | console.log("B.constructor");
  6913. // | },
  6914. // | destroy: function(){
  6915. // | console.log("B.destroy");
  6916. // | }
  6917. // | });
  6918. // | var C = declare(B, {
  6919. // | constructor: function(){
  6920. // | console.log("C.constructor");
  6921. // | },
  6922. // | destroy: function(){
  6923. // | console.log("C.destroy");
  6924. // | }
  6925. // | });
  6926. // | new C().destroy();
  6927. // | // prints:
  6928. // | // B.constructor
  6929. // | // C.constructor
  6930. // | // C.destroy
  6931. // | // B.destroy
  6932. //
  6933. // example:
  6934. // | var A = declare(null, {
  6935. // | "-chains-": {
  6936. // | constructor: "manual"
  6937. // | }
  6938. // | });
  6939. // | var B = declare(A, {
  6940. // | constructor: function(){
  6941. // | // ...
  6942. // | // call the base constructor with new parameters
  6943. // | this.inherited(arguments, [1, 2, 3]);
  6944. // | // ...
  6945. // | }
  6946. // | });
  6947. //
  6948. // example:
  6949. // | var A = declare(null, {
  6950. // | "-chains-": {
  6951. // | m1: "before"
  6952. // | },
  6953. // | m1: function(){
  6954. // | console.log("A.m1");
  6955. // | },
  6956. // | m2: function(){
  6957. // | console.log("A.m2");
  6958. // | }
  6959. // | });
  6960. // | var B = declare(A, {
  6961. // | "-chains-": {
  6962. // | m2: "after"
  6963. // | },
  6964. // | m1: function(){
  6965. // | console.log("B.m1");
  6966. // | },
  6967. // | m2: function(){
  6968. // | console.log("B.m2");
  6969. // | }
  6970. // | });
  6971. // | var x = new B();
  6972. // | x.m1();
  6973. // | // prints:
  6974. // | // B.m1
  6975. // | // A.m1
  6976. // | x.m2();
  6977. // | // prints:
  6978. // | // A.m2
  6979. // | // B.m2
  6980. // crack parameters
  6981. if(typeof className != "string"){
  6982. props = superclass;
  6983. superclass = className;
  6984. className = "";
  6985. }
  6986. props = props || {};
  6987. var proto, i, t, ctor, name, bases, chains, mixins = 1, parents = superclass;
  6988. // build a prototype
  6989. if(opts.call(superclass) == "[object Array]"){
  6990. // C3 MRO
  6991. bases = c3mro(superclass, className);
  6992. t = bases[0];
  6993. mixins = bases.length - t;
  6994. superclass = bases[mixins];
  6995. }else{
  6996. bases = [0];
  6997. if(superclass){
  6998. if(opts.call(superclass) == "[object Function]"){
  6999. t = superclass._meta;
  7000. bases = bases.concat(t ? t.bases : superclass);
  7001. }else{
  7002. err("base class is not a callable constructor.", className);
  7003. }
  7004. }else if(superclass !== null){
  7005. err("unknown base class. Did you use dojo.require to pull it in?", className);
  7006. }
  7007. }
  7008. if(superclass){
  7009. for(i = mixins - 1;; --i){
  7010. proto = forceNew(superclass);
  7011. if(!i){
  7012. // stop if nothing to add (the last base)
  7013. break;
  7014. }
  7015. // mix in properties
  7016. t = bases[i];
  7017. (t._meta ? mixOwn : mix)(proto, t.prototype);
  7018. // chain in new constructor
  7019. ctor = new Function;
  7020. ctor.superclass = superclass;
  7021. ctor.prototype = proto;
  7022. superclass = proto.constructor = ctor;
  7023. }
  7024. }else{
  7025. proto = {};
  7026. }
  7027. // add all properties
  7028. declare.safeMixin(proto, props);
  7029. // add constructor
  7030. t = props.constructor;
  7031. if(t !== op.constructor){
  7032. t.nom = cname;
  7033. proto.constructor = t;
  7034. }
  7035. // collect chains and flags
  7036. for(i = mixins - 1; i; --i){ // intentional assignment
  7037. t = bases[i]._meta;
  7038. if(t && t.chains){
  7039. chains = mix(chains || {}, t.chains);
  7040. }
  7041. }
  7042. if(proto["-chains-"]){
  7043. chains = mix(chains || {}, proto["-chains-"]);
  7044. }
  7045. // build ctor
  7046. t = !chains || !chains.hasOwnProperty(cname);
  7047. bases[0] = ctor = (chains && chains.constructor === "manual") ? simpleConstructor(bases) :
  7048. (bases.length == 1 ? singleConstructor(props.constructor, t) : chainedConstructor(bases, t));
  7049. // add meta information to the constructor
  7050. ctor._meta = {bases: bases, hidden: props, chains: chains,
  7051. parents: parents, ctor: props.constructor};
  7052. ctor.superclass = superclass && superclass.prototype;
  7053. ctor.extend = extend;
  7054. ctor.createSubclass = createSubclass;
  7055. ctor.prototype = proto;
  7056. proto.constructor = ctor;
  7057. // add "standard" methods to the prototype
  7058. proto.getInherited = getInherited;
  7059. proto.isInstanceOf = isInstanceOf;
  7060. proto.inherited = inheritedImpl;
  7061. proto.__inherited = inherited;
  7062. // add name if specified
  7063. if(className){
  7064. proto.declaredClass = className;
  7065. lang.setObject(className, ctor);
  7066. }
  7067. // build chains and add them to the prototype
  7068. if(chains){
  7069. for(name in chains){
  7070. if(proto[name] && typeof chains[name] == "string" && name != cname){
  7071. t = proto[name] = chain(name, bases, chains[name] === "after");
  7072. t.nom = name;
  7073. }
  7074. }
  7075. }
  7076. // chained methods do not return values
  7077. // no need to chain "invisible" functions
  7078. return ctor; // Function
  7079. }
  7080. /*=====
  7081. declare.__DeclareCreatedObject = {
  7082. // summary:
  7083. // dojo/_base/declare() returns a constructor `C`. `new C()` returns an Object with the following
  7084. // methods, in addition to the methods and properties specified via the arguments passed to declare().
  7085. inherited: function(name, args, newArgs){
  7086. // summary:
  7087. // Calls a super method.
  7088. // name: String?
  7089. // The optional method name. Should be the same as the caller's
  7090. // name. Usually "name" is specified in complex dynamic cases, when
  7091. // the calling method was dynamically added, undecorated by
  7092. // declare(), and it cannot be determined.
  7093. // args: Arguments
  7094. // The caller supply this argument, which should be the original
  7095. // "arguments".
  7096. // newArgs: Object?
  7097. // If "true", the found function will be returned without
  7098. // executing it.
  7099. // If Array, it will be used to call a super method. Otherwise
  7100. // "args" will be used.
  7101. // returns:
  7102. // Whatever is returned by a super method, or a super method itself,
  7103. // if "true" was specified as newArgs.
  7104. // description:
  7105. // This method is used inside method of classes produced with
  7106. // declare() to call a super method (next in the chain). It is
  7107. // used for manually controlled chaining. Consider using the regular
  7108. // chaining, because it is faster. Use "this.inherited()" only in
  7109. // complex cases.
  7110. //
  7111. // This method cannot me called from automatically chained
  7112. // constructors including the case of a special (legacy)
  7113. // constructor chaining. It cannot be called from chained methods.
  7114. //
  7115. // If "this.inherited()" cannot find the next-in-chain method, it
  7116. // does nothing and returns "undefined". The last method in chain
  7117. // can be a default method implemented in Object, which will be
  7118. // called last.
  7119. //
  7120. // If "name" is specified, it is assumed that the method that
  7121. // received "args" is the parent method for this call. It is looked
  7122. // up in the chain list and if it is found the next-in-chain method
  7123. // is called. If it is not found, the first-in-chain method is
  7124. // called.
  7125. //
  7126. // If "name" is not specified, it will be derived from the calling
  7127. // method (using a methoid property "nom").
  7128. //
  7129. // example:
  7130. // | var B = declare(A, {
  7131. // | method1: function(a, b, c){
  7132. // | this.inherited(arguments);
  7133. // | },
  7134. // | method2: function(a, b){
  7135. // | return this.inherited(arguments, [a + b]);
  7136. // | }
  7137. // | });
  7138. // | // next method is not in the chain list because it is added
  7139. // | // manually after the class was created.
  7140. // | B.prototype.method3 = function(){
  7141. // | console.log("This is a dynamically-added method.");
  7142. // | this.inherited("method3", arguments);
  7143. // | };
  7144. // example:
  7145. // | var B = declare(A, {
  7146. // | method: function(a, b){
  7147. // | var super = this.inherited(arguments, true);
  7148. // | // ...
  7149. // | if(!super){
  7150. // | console.log("there is no super method");
  7151. // | return 0;
  7152. // | }
  7153. // | return super.apply(this, arguments);
  7154. // | }
  7155. // | });
  7156. return {}; // Object
  7157. },
  7158. getInherited: function(name, args){
  7159. // summary:
  7160. // Returns a super method.
  7161. // name: String?
  7162. // The optional method name. Should be the same as the caller's
  7163. // name. Usually "name" is specified in complex dynamic cases, when
  7164. // the calling method was dynamically added, undecorated by
  7165. // declare(), and it cannot be determined.
  7166. // args: Arguments
  7167. // The caller supply this argument, which should be the original
  7168. // "arguments".
  7169. // returns:
  7170. // Returns a super method (Function) or "undefined".
  7171. // description:
  7172. // This method is a convenience method for "this.inherited()".
  7173. // It uses the same algorithm but instead of executing a super
  7174. // method, it returns it, or "undefined" if not found.
  7175. //
  7176. // example:
  7177. // | var B = declare(A, {
  7178. // | method: function(a, b){
  7179. // | var super = this.getInherited(arguments);
  7180. // | // ...
  7181. // | if(!super){
  7182. // | console.log("there is no super method");
  7183. // | return 0;
  7184. // | }
  7185. // | return super.apply(this, arguments);
  7186. // | }
  7187. // | });
  7188. return {}; // Object
  7189. },
  7190. isInstanceOf: function(cls){
  7191. // summary:
  7192. // Checks the inheritance chain to see if it is inherited from this
  7193. // class.
  7194. // cls: Function
  7195. // Class constructor.
  7196. // returns:
  7197. // "true", if this object is inherited from this class, "false"
  7198. // otherwise.
  7199. // description:
  7200. // This method is used with instances of classes produced with
  7201. // declare() to determine of they support a certain interface or
  7202. // not. It models "instanceof" operator.
  7203. //
  7204. // example:
  7205. // | var A = declare(null, {
  7206. // | // constructor, properties, and methods go here
  7207. // | // ...
  7208. // | });
  7209. // | var B = declare(null, {
  7210. // | // constructor, properties, and methods go here
  7211. // | // ...
  7212. // | });
  7213. // | var C = declare([A, B], {
  7214. // | // constructor, properties, and methods go here
  7215. // | // ...
  7216. // | });
  7217. // | var D = declare(A, {
  7218. // | // constructor, properties, and methods go here
  7219. // | // ...
  7220. // | });
  7221. // |
  7222. // | var a = new A(), b = new B(), c = new C(), d = new D();
  7223. // |
  7224. // | console.log(a.isInstanceOf(A)); // true
  7225. // | console.log(b.isInstanceOf(A)); // false
  7226. // | console.log(c.isInstanceOf(A)); // true
  7227. // | console.log(d.isInstanceOf(A)); // true
  7228. // |
  7229. // | console.log(a.isInstanceOf(B)); // false
  7230. // | console.log(b.isInstanceOf(B)); // true
  7231. // | console.log(c.isInstanceOf(B)); // true
  7232. // | console.log(d.isInstanceOf(B)); // false
  7233. // |
  7234. // | console.log(a.isInstanceOf(C)); // false
  7235. // | console.log(b.isInstanceOf(C)); // false
  7236. // | console.log(c.isInstanceOf(C)); // true
  7237. // | console.log(d.isInstanceOf(C)); // false
  7238. // |
  7239. // | console.log(a.isInstanceOf(D)); // false
  7240. // | console.log(b.isInstanceOf(D)); // false
  7241. // | console.log(c.isInstanceOf(D)); // false
  7242. // | console.log(d.isInstanceOf(D)); // true
  7243. return {}; // Object
  7244. },
  7245. extend: function(source){
  7246. // summary:
  7247. // Adds all properties and methods of source to constructor's
  7248. // prototype, making them available to all instances created with
  7249. // constructor. This method is specific to constructors created with
  7250. // declare().
  7251. // source: Object
  7252. // Source object which properties are going to be copied to the
  7253. // constructor's prototype.
  7254. // description:
  7255. // Adds source properties to the constructor's prototype. It can
  7256. // override existing properties.
  7257. //
  7258. // This method is similar to dojo.extend function, but it is specific
  7259. // to constructors produced by declare(). It is implemented
  7260. // using dojo.safeMixin, and it skips a constructor property,
  7261. // and properly decorates copied functions.
  7262. //
  7263. // example:
  7264. // | var A = declare(null, {
  7265. // | m1: function(){},
  7266. // | s1: "Popokatepetl"
  7267. // | });
  7268. // | A.extend({
  7269. // | m1: function(){},
  7270. // | m2: function(){},
  7271. // | f1: true,
  7272. // | d1: 42
  7273. // | });
  7274. }
  7275. };
  7276. =====*/
  7277. // For back-compat, remove for 2.0
  7278. dojo.safeMixin = declare.safeMixin = safeMixin;
  7279. dojo.declare = declare;
  7280. return declare;
  7281. });
  7282. },
  7283. 'dojo/dom':function(){
  7284. define(["./sniff", "./_base/lang", "./_base/window"],
  7285. function(has, lang, win){
  7286. // module:
  7287. // dojo/dom
  7288. // FIXME: need to add unit tests for all the semi-public methods
  7289. if(has("ie") <= 7){
  7290. try{
  7291. document.execCommand("BackgroundImageCache", false, true);
  7292. }catch(e){
  7293. // sane browsers don't have cache "issues"
  7294. }
  7295. }
  7296. // =============================
  7297. // DOM Functions
  7298. // =============================
  7299. // the result object
  7300. var dom = {
  7301. // summary:
  7302. // This module defines the core dojo DOM API.
  7303. };
  7304. if(has("ie")){
  7305. dom.byId = function(id, doc){
  7306. if(typeof id != "string"){
  7307. return id;
  7308. }
  7309. var _d = doc || win.doc, te = id && _d.getElementById(id);
  7310. // attributes.id.value is better than just id in case the
  7311. // user has a name=id inside a form
  7312. if(te && (te.attributes.id.value == id || te.id == id)){
  7313. return te;
  7314. }else{
  7315. var eles = _d.all[id];
  7316. if(!eles || eles.nodeName){
  7317. eles = [eles];
  7318. }
  7319. // if more than 1, choose first with the correct id
  7320. var i = 0;
  7321. while((te = eles[i++])){
  7322. if((te.attributes && te.attributes.id && te.attributes.id.value == id) || te.id == id){
  7323. return te;
  7324. }
  7325. }
  7326. }
  7327. };
  7328. }else{
  7329. dom.byId = function(id, doc){
  7330. // inline'd type check.
  7331. // be sure to return null per documentation, to match IE branch.
  7332. return ((typeof id == "string") ? (doc || win.doc).getElementById(id) : id) || null; // DOMNode
  7333. };
  7334. }
  7335. /*=====
  7336. dom.byId = function(id, doc){
  7337. // summary:
  7338. // Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
  7339. // if not found. If `id` is a DomNode, this function is a no-op.
  7340. //
  7341. // id: String|DOMNode
  7342. // A string to match an HTML id attribute or a reference to a DOM Node
  7343. //
  7344. // doc: Document?
  7345. // Document to work in. Defaults to the current value of
  7346. // dojo.doc. Can be used to retrieve
  7347. // node references from other documents.
  7348. //
  7349. // example:
  7350. // Look up a node by ID:
  7351. // | var n = dojo.byId("foo");
  7352. //
  7353. // example:
  7354. // Check if a node exists, and use it.
  7355. // | var n = dojo.byId("bar");
  7356. // | if(n){ doStuff() ... }
  7357. //
  7358. // example:
  7359. // Allow string or DomNode references to be passed to a custom function:
  7360. // | var foo = function(nodeOrId){
  7361. // | nodeOrId = dojo.byId(nodeOrId);
  7362. // | // ... more stuff
  7363. // | }
  7364. };
  7365. =====*/
  7366. dom.isDescendant = function(/*DOMNode|String*/ node, /*DOMNode|String*/ ancestor){
  7367. // summary:
  7368. // Returns true if node is a descendant of ancestor
  7369. // node: DOMNode|String
  7370. // string id or node reference to test
  7371. // ancestor: DOMNode|String
  7372. // string id or node reference of potential parent to test against
  7373. //
  7374. // example:
  7375. // Test is node id="bar" is a descendant of node id="foo"
  7376. // | if(dojo.isDescendant("bar", "foo")){ ... }
  7377. try{
  7378. node = dom.byId(node);
  7379. ancestor = dom.byId(ancestor);
  7380. while(node){
  7381. if(node == ancestor){
  7382. return true; // Boolean
  7383. }
  7384. node = node.parentNode;
  7385. }
  7386. }catch(e){ /* squelch, return false */ }
  7387. return false; // Boolean
  7388. };
  7389. // TODO: do we need this function in the base?
  7390. dom.setSelectable = function(/*DOMNode|String*/ node, /*Boolean*/ selectable){
  7391. // summary:
  7392. // Enable or disable selection on a node
  7393. // node: DOMNode|String
  7394. // id or reference to node
  7395. // selectable: Boolean
  7396. // state to put the node in. false indicates unselectable, true
  7397. // allows selection.
  7398. // example:
  7399. // Make the node id="bar" unselectable
  7400. // | dojo.setSelectable("bar");
  7401. // example:
  7402. // Make the node id="bar" selectable
  7403. // | dojo.setSelectable("bar", true);
  7404. node = dom.byId(node);
  7405. if(has("mozilla")){
  7406. node.style.MozUserSelect = selectable ? "" : "none";
  7407. }else if(has("khtml") || has("webkit")){
  7408. node.style.KhtmlUserSelect = selectable ? "auto" : "none";
  7409. }else if(has("ie")){
  7410. var v = (node.unselectable = selectable ? "" : "on"),
  7411. cs = node.getElementsByTagName("*"), i = 0, l = cs.length;
  7412. for(; i < l; ++i){
  7413. cs.item(i).unselectable = v;
  7414. }
  7415. }
  7416. //FIXME: else? Opera?
  7417. };
  7418. return dom;
  7419. });
  7420. },
  7421. 'dojo/_base/browser':function(){
  7422. if(require.has){
  7423. require.has.add("config-selectorEngine", "acme");
  7424. }
  7425. define([
  7426. "../ready",
  7427. "./kernel",
  7428. "./connect", // until we decide if connect is going back into non-browser environments
  7429. "./unload",
  7430. "./window",
  7431. "./event",
  7432. "./html",
  7433. "./NodeList",
  7434. "../query",
  7435. "./xhr",
  7436. "./fx"], function(dojo){
  7437. // module:
  7438. // dojo/_base/browser
  7439. /*=====
  7440. return {
  7441. // summary:
  7442. // This module causes the browser-only base modules to be loaded.
  7443. };
  7444. =====*/
  7445. return dojo;
  7446. });
  7447. },
  7448. 'dojo/selector/acme':function(){
  7449. define([
  7450. "../dom", "../sniff", "../_base/array", "../_base/lang", "../_base/window"
  7451. ], function(dom, has, array, lang, win){
  7452. // module:
  7453. // dojo/selector/acme
  7454. /*
  7455. acme architectural overview:
  7456. acme is a relatively full-featured CSS3 query library. It is
  7457. designed to take any valid CSS3 selector and return the nodes matching
  7458. the selector. To do this quickly, it processes queries in several
  7459. steps, applying caching where profitable.
  7460. The steps (roughly in reverse order of the way they appear in the code):
  7461. 1.) check to see if we already have a "query dispatcher"
  7462. - if so, use that with the given parameterization. Skip to step 4.
  7463. 2.) attempt to determine which branch to dispatch the query to:
  7464. - JS (optimized DOM iteration)
  7465. - native (FF3.1+, Safari 3.1+, IE 8+)
  7466. 3.) tokenize and convert to executable "query dispatcher"
  7467. - this is where the lion's share of the complexity in the
  7468. system lies. In the DOM version, the query dispatcher is
  7469. assembled as a chain of "yes/no" test functions pertaining to
  7470. a section of a simple query statement (".blah:nth-child(odd)"
  7471. but not "div div", which is 2 simple statements). Individual
  7472. statement dispatchers are cached (to prevent re-definition)
  7473. as are entire dispatch chains (to make re-execution of the
  7474. same query fast)
  7475. 4.) the resulting query dispatcher is called in the passed scope
  7476. (by default the top-level document)
  7477. - for DOM queries, this results in a recursive, top-down
  7478. evaluation of nodes based on each simple query section
  7479. - for native implementations, this may mean working around spec
  7480. bugs. So be it.
  7481. 5.) matched nodes are pruned to ensure they are unique (if necessary)
  7482. */
  7483. ////////////////////////////////////////////////////////////////////////
  7484. // Toolkit aliases
  7485. ////////////////////////////////////////////////////////////////////////
  7486. // if you are extracting acme for use in your own system, you will
  7487. // need to provide these methods and properties. No other porting should be
  7488. // necessary, save for configuring the system to use a class other than
  7489. // dojo/NodeList as the return instance instantiator
  7490. var trim = lang.trim;
  7491. var each = array.forEach;
  7492. var getDoc = function(){ return win.doc; };
  7493. // NOTE(alex): the spec is idiotic. CSS queries should ALWAYS be case-sensitive, but nooooooo
  7494. var cssCaseBug = (getDoc().compatMode) == "BackCompat";
  7495. ////////////////////////////////////////////////////////////////////////
  7496. // Global utilities
  7497. ////////////////////////////////////////////////////////////////////////
  7498. var specials = ">~+";
  7499. // global thunk to determine whether we should treat the current query as
  7500. // case sensitive or not. This switch is flipped by the query evaluator
  7501. // based on the document passed as the context to search.
  7502. var caseSensitive = false;
  7503. // how high?
  7504. var yesman = function(){ return true; };
  7505. ////////////////////////////////////////////////////////////////////////
  7506. // Tokenizer
  7507. ////////////////////////////////////////////////////////////////////////
  7508. var getQueryParts = function(query){
  7509. // summary:
  7510. // state machine for query tokenization
  7511. // description:
  7512. // instead of using a brittle and slow regex-based CSS parser,
  7513. // acme implements an AST-style query representation. This
  7514. // representation is only generated once per query. For example,
  7515. // the same query run multiple times or under different root nodes
  7516. // does not re-parse the selector expression but instead uses the
  7517. // cached data structure. The state machine implemented here
  7518. // terminates on the last " " (space) character and returns an
  7519. // ordered array of query component structures (or "parts"). Each
  7520. // part represents an operator or a simple CSS filtering
  7521. // expression. The structure for parts is documented in the code
  7522. // below.
  7523. // NOTE:
  7524. // this code is designed to run fast and compress well. Sacrifices
  7525. // to readability and maintainability have been made. Your best
  7526. // bet when hacking the tokenizer is to put The Donnas on *really*
  7527. // loud (may we recommend their "Spend The Night" release?) and
  7528. // just assume you're gonna make mistakes. Keep the unit tests
  7529. // open and run them frequently. Knowing is half the battle ;-)
  7530. if(specials.indexOf(query.slice(-1)) >= 0){
  7531. // if we end with a ">", "+", or "~", that means we're implicitly
  7532. // searching all children, so make it explicit
  7533. query += " * ";
  7534. }else{
  7535. // if you have not provided a terminator, one will be provided for
  7536. // you...
  7537. query += " ";
  7538. }
  7539. var ts = function(/*Integer*/ s, /*Integer*/ e){
  7540. // trim and slice.
  7541. // take an index to start a string slice from and an end position
  7542. // and return a trimmed copy of that sub-string
  7543. return trim(query.slice(s, e));
  7544. };
  7545. // the overall data graph of the full query, as represented by queryPart objects
  7546. var queryParts = [];
  7547. // state keeping vars
  7548. var inBrackets = -1, inParens = -1, inMatchFor = -1,
  7549. inPseudo = -1, inClass = -1, inId = -1, inTag = -1, currentQuoteChar,
  7550. lc = "", cc = "", pStart;
  7551. // iteration vars
  7552. var x = 0, // index in the query
  7553. ql = query.length,
  7554. currentPart = null, // data structure representing the entire clause
  7555. _cp = null; // the current pseudo or attr matcher
  7556. // several temporary variables are assigned to this structure during a
  7557. // potential sub-expression match:
  7558. // attr:
  7559. // a string representing the current full attribute match in a
  7560. // bracket expression
  7561. // type:
  7562. // if there's an operator in a bracket expression, this is
  7563. // used to keep track of it
  7564. // value:
  7565. // the internals of parenthetical expression for a pseudo. for
  7566. // :nth-child(2n+1), value might be "2n+1"
  7567. var endTag = function(){
  7568. // called when the tokenizer hits the end of a particular tag name.
  7569. // Re-sets state variables for tag matching and sets up the matcher
  7570. // to handle the next type of token (tag or operator).
  7571. if(inTag >= 0){
  7572. var tv = (inTag == x) ? null : ts(inTag, x); // .toLowerCase();
  7573. currentPart[ (specials.indexOf(tv) < 0) ? "tag" : "oper" ] = tv;
  7574. inTag = -1;
  7575. }
  7576. };
  7577. var endId = function(){
  7578. // called when the tokenizer might be at the end of an ID portion of a match
  7579. if(inId >= 0){
  7580. currentPart.id = ts(inId, x).replace(/\\/g, "");
  7581. inId = -1;
  7582. }
  7583. };
  7584. var endClass = function(){
  7585. // called when the tokenizer might be at the end of a class name
  7586. // match. CSS allows for multiple classes, so we augment the
  7587. // current item with another class in its list
  7588. if(inClass >= 0){
  7589. currentPart.classes.push(ts(inClass + 1, x).replace(/\\/g, ""));
  7590. inClass = -1;
  7591. }
  7592. };
  7593. var endAll = function(){
  7594. // at the end of a simple fragment, so wall off the matches
  7595. endId();
  7596. endTag();
  7597. endClass();
  7598. };
  7599. var endPart = function(){
  7600. endAll();
  7601. if(inPseudo >= 0){
  7602. currentPart.pseudos.push({ name: ts(inPseudo + 1, x) });
  7603. }
  7604. // hint to the selector engine to tell it whether or not it
  7605. // needs to do any iteration. Many simple selectors don't, and
  7606. // we can avoid significant construction-time work by advising
  7607. // the system to skip them
  7608. currentPart.loops = (
  7609. currentPart.pseudos.length ||
  7610. currentPart.attrs.length ||
  7611. currentPart.classes.length );
  7612. currentPart.oquery = currentPart.query = ts(pStart, x); // save the full expression as a string
  7613. // otag/tag are hints to suggest to the system whether or not
  7614. // it's an operator or a tag. We save a copy of otag since the
  7615. // tag name is cast to upper-case in regular HTML matches. The
  7616. // system has a global switch to figure out if the current
  7617. // expression needs to be case sensitive or not and it will use
  7618. // otag or tag accordingly
  7619. currentPart.otag = currentPart.tag = (currentPart["oper"]) ? null : (currentPart.tag || "*");
  7620. if(currentPart.tag){
  7621. // if we're in a case-insensitive HTML doc, we likely want
  7622. // the toUpperCase when matching on element.tagName. If we
  7623. // do it here, we can skip the string op per node
  7624. // comparison
  7625. currentPart.tag = currentPart.tag.toUpperCase();
  7626. }
  7627. // add the part to the list
  7628. if(queryParts.length && (queryParts[queryParts.length-1].oper)){
  7629. // operators are always infix, so we remove them from the
  7630. // list and attach them to the next match. The evaluator is
  7631. // responsible for sorting out how to handle them.
  7632. currentPart.infixOper = queryParts.pop();
  7633. currentPart.query = currentPart.infixOper.query + " " + currentPart.query;
  7634. /*
  7635. console.debug( "swapping out the infix",
  7636. currentPart.infixOper,
  7637. "and attaching it to",
  7638. currentPart);
  7639. */
  7640. }
  7641. queryParts.push(currentPart);
  7642. currentPart = null;
  7643. };
  7644. // iterate over the query, character by character, building up a
  7645. // list of query part objects
  7646. for(; lc=cc, cc=query.charAt(x), x < ql; x++){
  7647. // cc: the current character in the match
  7648. // lc: the last character (if any)
  7649. // someone is trying to escape something, so don't try to match any
  7650. // fragments. We assume we're inside a literal.
  7651. if(lc == "\\"){ continue; }
  7652. if(!currentPart){ // a part was just ended or none has yet been created
  7653. // NOTE: I hate all this alloc, but it's shorter than writing tons of if's
  7654. pStart = x;
  7655. // rules describe full CSS sub-expressions, like:
  7656. // #someId
  7657. // .className:first-child
  7658. // but not:
  7659. // thinger > div.howdy[type=thinger]
  7660. // the indidual components of the previous query would be
  7661. // split into 3 parts that would be represented a structure like:
  7662. // [
  7663. // {
  7664. // query: "thinger",
  7665. // tag: "thinger",
  7666. // },
  7667. // {
  7668. // query: "div.howdy[type=thinger]",
  7669. // classes: ["howdy"],
  7670. // infixOper: {
  7671. // query: ">",
  7672. // oper: ">",
  7673. // }
  7674. // },
  7675. // ]
  7676. currentPart = {
  7677. query: null, // the full text of the part's rule
  7678. pseudos: [], // CSS supports multiple pseud-class matches in a single rule
  7679. attrs: [], // CSS supports multi-attribute match, so we need an array
  7680. classes: [], // class matches may be additive, e.g.: .thinger.blah.howdy
  7681. tag: null, // only one tag...
  7682. oper: null, // ...or operator per component. Note that these wind up being exclusive.
  7683. id: null, // the id component of a rule
  7684. getTag: function(){
  7685. return caseSensitive ? this.otag : this.tag;
  7686. }
  7687. };
  7688. // if we don't have a part, we assume we're going to start at
  7689. // the beginning of a match, which should be a tag name. This
  7690. // might fault a little later on, but we detect that and this
  7691. // iteration will still be fine.
  7692. inTag = x;
  7693. }
  7694. // Skip processing all quoted characters.
  7695. // If we are inside quoted text then currentQuoteChar stores the character that began the quote,
  7696. // thus that character that will end it.
  7697. if(currentQuoteChar){
  7698. if(cc == currentQuoteChar){
  7699. currentQuoteChar = null;
  7700. }
  7701. continue;
  7702. }else if (cc == "'" || cc == '"'){
  7703. currentQuoteChar = cc;
  7704. continue;
  7705. }
  7706. if(inBrackets >= 0){
  7707. // look for a the close first
  7708. if(cc == "]"){ // if we're in a [...] clause and we end, do assignment
  7709. if(!_cp.attr){
  7710. // no attribute match was previously begun, so we
  7711. // assume this is an attribute existence match in the
  7712. // form of [someAttributeName]
  7713. _cp.attr = ts(inBrackets+1, x);
  7714. }else{
  7715. // we had an attribute already, so we know that we're
  7716. // matching some sort of value, as in [attrName=howdy]
  7717. _cp.matchFor = ts((inMatchFor||inBrackets+1), x);
  7718. }
  7719. var cmf = _cp.matchFor;
  7720. if(cmf){
  7721. // try to strip quotes from the matchFor value. We want
  7722. // [attrName=howdy] to match the same
  7723. // as [attrName = 'howdy' ]
  7724. if( (cmf.charAt(0) == '"') || (cmf.charAt(0) == "'") ){
  7725. _cp.matchFor = cmf.slice(1, -1);
  7726. }
  7727. }
  7728. // remove backslash escapes from an attribute match, since DOM
  7729. // querying will get attribute values without backslashes
  7730. if(_cp.matchFor){
  7731. _cp.matchFor = _cp.matchFor.replace(/\\/g, "");
  7732. }
  7733. // end the attribute by adding it to the list of attributes.
  7734. currentPart.attrs.push(_cp);
  7735. _cp = null; // necessary?
  7736. inBrackets = inMatchFor = -1;
  7737. }else if(cc == "="){
  7738. // if the last char was an operator prefix, make sure we
  7739. // record it along with the "=" operator.
  7740. var addToCc = ("|~^$*".indexOf(lc) >=0 ) ? lc : "";
  7741. _cp.type = addToCc+cc;
  7742. _cp.attr = ts(inBrackets+1, x-addToCc.length);
  7743. inMatchFor = x+1;
  7744. }
  7745. // now look for other clause parts
  7746. }else if(inParens >= 0){
  7747. // if we're in a parenthetical expression, we need to figure
  7748. // out if it's attached to a pseudo-selector rule like
  7749. // :nth-child(1)
  7750. if(cc == ")"){
  7751. if(inPseudo >= 0){
  7752. _cp.value = ts(inParens+1, x);
  7753. }
  7754. inPseudo = inParens = -1;
  7755. }
  7756. }else if(cc == "#"){
  7757. // start of an ID match
  7758. endAll();
  7759. inId = x+1;
  7760. }else if(cc == "."){
  7761. // start of a class match
  7762. endAll();
  7763. inClass = x;
  7764. }else if(cc == ":"){
  7765. // start of a pseudo-selector match
  7766. endAll();
  7767. inPseudo = x;
  7768. }else if(cc == "["){
  7769. // start of an attribute match.
  7770. endAll();
  7771. inBrackets = x;
  7772. // provide a new structure for the attribute match to fill-in
  7773. _cp = {
  7774. /*=====
  7775. attr: null, type: null, matchFor: null
  7776. =====*/
  7777. };
  7778. }else if(cc == "("){
  7779. // we really only care if we've entered a parenthetical
  7780. // expression if we're already inside a pseudo-selector match
  7781. if(inPseudo >= 0){
  7782. // provide a new structure for the pseudo match to fill-in
  7783. _cp = {
  7784. name: ts(inPseudo+1, x),
  7785. value: null
  7786. };
  7787. currentPart.pseudos.push(_cp);
  7788. }
  7789. inParens = x;
  7790. }else if(
  7791. (cc == " ") &&
  7792. // if it's a space char and the last char is too, consume the
  7793. // current one without doing more work
  7794. (lc != cc)
  7795. ){
  7796. endPart();
  7797. }
  7798. }
  7799. return queryParts;
  7800. };
  7801. ////////////////////////////////////////////////////////////////////////
  7802. // DOM query infrastructure
  7803. ////////////////////////////////////////////////////////////////////////
  7804. var agree = function(first, second){
  7805. // the basic building block of the yes/no chaining system. agree(f1,
  7806. // f2) generates a new function which returns the boolean results of
  7807. // both of the passed functions to a single logical-anded result. If
  7808. // either are not passed, the other is used exclusively.
  7809. if(!first){ return second; }
  7810. if(!second){ return first; }
  7811. return function(){
  7812. return first.apply(window, arguments) && second.apply(window, arguments);
  7813. };
  7814. };
  7815. var getArr = function(i, arr){
  7816. // helps us avoid array alloc when we don't need it
  7817. var r = arr||[]; // FIXME: should this be 'new d._NodeListCtor()' ?
  7818. if(i){ r.push(i); }
  7819. return r;
  7820. };
  7821. var _isElement = function(n){ return (1 == n.nodeType); };
  7822. // FIXME: need to coalesce _getAttr with defaultGetter
  7823. var blank = "";
  7824. var _getAttr = function(elem, attr){
  7825. if(!elem){ return blank; }
  7826. if(attr == "class"){
  7827. return elem.className || blank;
  7828. }
  7829. if(attr == "for"){
  7830. return elem.htmlFor || blank;
  7831. }
  7832. if(attr == "style"){
  7833. return elem.style.cssText || blank;
  7834. }
  7835. return (caseSensitive ? elem.getAttribute(attr) : elem.getAttribute(attr, 2)) || blank;
  7836. };
  7837. var attrs = {
  7838. "*=": function(attr, value){
  7839. return function(elem){
  7840. // E[foo*="bar"]
  7841. // an E element whose "foo" attribute value contains
  7842. // the substring "bar"
  7843. return (_getAttr(elem, attr).indexOf(value)>=0);
  7844. };
  7845. },
  7846. "^=": function(attr, value){
  7847. // E[foo^="bar"]
  7848. // an E element whose "foo" attribute value begins exactly
  7849. // with the string "bar"
  7850. return function(elem){
  7851. return (_getAttr(elem, attr).indexOf(value)==0);
  7852. };
  7853. },
  7854. "$=": function(attr, value){
  7855. // E[foo$="bar"]
  7856. // an E element whose "foo" attribute value ends exactly
  7857. // with the string "bar"
  7858. return function(elem){
  7859. var ea = " "+_getAttr(elem, attr);
  7860. var lastIndex = ea.lastIndexOf(value);
  7861. return lastIndex > -1 && (lastIndex==(ea.length-value.length));
  7862. };
  7863. },
  7864. "~=": function(attr, value){
  7865. // E[foo~="bar"]
  7866. // an E element whose "foo" attribute value is a list of
  7867. // space-separated values, one of which is exactly equal
  7868. // to "bar"
  7869. // return "[contains(concat(' ',@"+attr+",' '), ' "+ value +" ')]";
  7870. var tval = " "+value+" ";
  7871. return function(elem){
  7872. var ea = " "+_getAttr(elem, attr)+" ";
  7873. return (ea.indexOf(tval)>=0);
  7874. };
  7875. },
  7876. "|=": function(attr, value){
  7877. // E[hreflang|="en"]
  7878. // an E element whose "hreflang" attribute has a
  7879. // hyphen-separated list of values beginning (from the
  7880. // left) with "en"
  7881. var valueDash = value+"-";
  7882. return function(elem){
  7883. var ea = _getAttr(elem, attr);
  7884. return (
  7885. (ea == value) ||
  7886. (ea.indexOf(valueDash)==0)
  7887. );
  7888. };
  7889. },
  7890. "=": function(attr, value){
  7891. return function(elem){
  7892. return (_getAttr(elem, attr) == value);
  7893. };
  7894. }
  7895. };
  7896. // avoid testing for node type if we can. Defining this in the negative
  7897. // here to avoid negation in the fast path.
  7898. var _noNES = (typeof getDoc().firstChild.nextElementSibling == "undefined");
  7899. var _ns = !_noNES ? "nextElementSibling" : "nextSibling";
  7900. var _ps = !_noNES ? "previousElementSibling" : "previousSibling";
  7901. var _simpleNodeTest = (_noNES ? _isElement : yesman);
  7902. var _lookLeft = function(node){
  7903. // look left
  7904. while(node = node[_ps]){
  7905. if(_simpleNodeTest(node)){ return false; }
  7906. }
  7907. return true;
  7908. };
  7909. var _lookRight = function(node){
  7910. // look right
  7911. while(node = node[_ns]){
  7912. if(_simpleNodeTest(node)){ return false; }
  7913. }
  7914. return true;
  7915. };
  7916. var getNodeIndex = function(node){
  7917. var root = node.parentNode;
  7918. root = root.nodeType != 7 ? root : root.nextSibling; // PROCESSING_INSTRUCTION_NODE
  7919. var i = 0,
  7920. tret = root.children || root.childNodes,
  7921. ci = (node["_i"]||node.getAttribute("_i")||-1),
  7922. cl = (root["_l"]|| (typeof root.getAttribute !== "undefined" ? root.getAttribute("_l") : -1));
  7923. if(!tret){ return -1; }
  7924. var l = tret.length;
  7925. // we calculate the parent length as a cheap way to invalidate the
  7926. // cache. It's not 100% accurate, but it's much more honest than what
  7927. // other libraries do
  7928. if( cl == l && ci >= 0 && cl >= 0 ){
  7929. // if it's legit, tag and release
  7930. return ci;
  7931. }
  7932. // else re-key things
  7933. if(has("ie") && typeof root.setAttribute !== "undefined"){
  7934. root.setAttribute("_l", l);
  7935. }else{
  7936. root["_l"] = l;
  7937. }
  7938. ci = -1;
  7939. for(var te = root["firstElementChild"]||root["firstChild"]; te; te = te[_ns]){
  7940. if(_simpleNodeTest(te)){
  7941. if(has("ie")){
  7942. te.setAttribute("_i", ++i);
  7943. }else{
  7944. te["_i"] = ++i;
  7945. }
  7946. if(node === te){
  7947. // NOTE:
  7948. // shortcutting the return at this step in indexing works
  7949. // very well for benchmarking but we avoid it here since
  7950. // it leads to potential O(n^2) behavior in sequential
  7951. // getNodexIndex operations on a previously un-indexed
  7952. // parent. We may revisit this at a later time, but for
  7953. // now we just want to get the right answer more often
  7954. // than not.
  7955. ci = i;
  7956. }
  7957. }
  7958. }
  7959. return ci;
  7960. };
  7961. var isEven = function(elem){
  7962. return !((getNodeIndex(elem)) % 2);
  7963. };
  7964. var isOdd = function(elem){
  7965. return ((getNodeIndex(elem)) % 2);
  7966. };
  7967. var pseudos = {
  7968. "checked": function(name, condition){
  7969. return function(elem){
  7970. return !!("checked" in elem ? elem.checked : elem.selected);
  7971. };
  7972. },
  7973. "disabled": function(name, condition){
  7974. return function(elem){
  7975. return elem.disabled;
  7976. };
  7977. },
  7978. "enabled": function(name, condition){
  7979. return function(elem){
  7980. return !elem.disabled;
  7981. };
  7982. },
  7983. "first-child": function(){ return _lookLeft; },
  7984. "last-child": function(){ return _lookRight; },
  7985. "only-child": function(name, condition){
  7986. return function(node){
  7987. return _lookLeft(node) && _lookRight(node);
  7988. };
  7989. },
  7990. "empty": function(name, condition){
  7991. return function(elem){
  7992. // DomQuery and jQuery get this wrong, oddly enough.
  7993. // The CSS 3 selectors spec is pretty explicit about it, too.
  7994. var cn = elem.childNodes;
  7995. var cnl = elem.childNodes.length;
  7996. // if(!cnl){ return true; }
  7997. for(var x=cnl-1; x >= 0; x--){
  7998. var nt = cn[x].nodeType;
  7999. if((nt === 1)||(nt == 3)){ return false; }
  8000. }
  8001. return true;
  8002. };
  8003. },
  8004. "contains": function(name, condition){
  8005. var cz = condition.charAt(0);
  8006. if( cz == '"' || cz == "'" ){ //remove quote
  8007. condition = condition.slice(1, -1);
  8008. }
  8009. return function(elem){
  8010. return (elem.innerHTML.indexOf(condition) >= 0);
  8011. };
  8012. },
  8013. "not": function(name, condition){
  8014. var p = getQueryParts(condition)[0];
  8015. var ignores = { el: 1 };
  8016. if(p.tag != "*"){
  8017. ignores.tag = 1;
  8018. }
  8019. if(!p.classes.length){
  8020. ignores.classes = 1;
  8021. }
  8022. var ntf = getSimpleFilterFunc(p, ignores);
  8023. return function(elem){
  8024. return (!ntf(elem));
  8025. };
  8026. },
  8027. "nth-child": function(name, condition){
  8028. var pi = parseInt;
  8029. // avoid re-defining function objects if we can
  8030. if(condition == "odd"){
  8031. return isOdd;
  8032. }else if(condition == "even"){
  8033. return isEven;
  8034. }
  8035. // FIXME: can we shorten this?
  8036. if(condition.indexOf("n") != -1){
  8037. var tparts = condition.split("n", 2);
  8038. var pred = tparts[0] ? ((tparts[0] == '-') ? -1 : pi(tparts[0])) : 1;
  8039. var idx = tparts[1] ? pi(tparts[1]) : 0;
  8040. var lb = 0, ub = -1;
  8041. if(pred > 0){
  8042. if(idx < 0){
  8043. idx = (idx % pred) && (pred + (idx % pred));
  8044. }else if(idx>0){
  8045. if(idx >= pred){
  8046. lb = idx - idx % pred;
  8047. }
  8048. idx = idx % pred;
  8049. }
  8050. }else if(pred<0){
  8051. pred *= -1;
  8052. // idx has to be greater than 0 when pred is negative;
  8053. // shall we throw an error here?
  8054. if(idx > 0){
  8055. ub = idx;
  8056. idx = idx % pred;
  8057. }
  8058. }
  8059. if(pred > 0){
  8060. return function(elem){
  8061. var i = getNodeIndex(elem);
  8062. return (i>=lb) && (ub<0 || i<=ub) && ((i % pred) == idx);
  8063. };
  8064. }else{
  8065. condition = idx;
  8066. }
  8067. }
  8068. var ncount = pi(condition);
  8069. return function(elem){
  8070. return (getNodeIndex(elem) == ncount);
  8071. };
  8072. }
  8073. };
  8074. var defaultGetter = (has("ie") && (has("ie") < 9 || has("quirks"))) ? function(cond){
  8075. var clc = cond.toLowerCase();
  8076. if(clc == "class"){ cond = "className"; }
  8077. return function(elem){
  8078. return (caseSensitive ? elem.getAttribute(cond) : elem[cond]||elem[clc]);
  8079. };
  8080. } : function(cond){
  8081. return function(elem){
  8082. return (elem && elem.getAttribute && elem.hasAttribute(cond));
  8083. };
  8084. };
  8085. var getSimpleFilterFunc = function(query, ignores){
  8086. // generates a node tester function based on the passed query part. The
  8087. // query part is one of the structures generated by the query parser
  8088. // when it creates the query AST. The "ignores" object specifies which
  8089. // (if any) tests to skip, allowing the system to avoid duplicating
  8090. // work where it may have already been taken into account by other
  8091. // factors such as how the nodes to test were fetched in the first
  8092. // place
  8093. if(!query){ return yesman; }
  8094. ignores = ignores||{};
  8095. var ff = null;
  8096. if(!("el" in ignores)){
  8097. ff = agree(ff, _isElement);
  8098. }
  8099. if(!("tag" in ignores)){
  8100. if(query.tag != "*"){
  8101. ff = agree(ff, function(elem){
  8102. return (elem && ((caseSensitive ? elem.tagName : elem.tagName.toUpperCase()) == query.getTag()));
  8103. });
  8104. }
  8105. }
  8106. if(!("classes" in ignores)){
  8107. each(query.classes, function(cname, idx, arr){
  8108. // get the class name
  8109. /*
  8110. var isWildcard = cname.charAt(cname.length-1) == "*";
  8111. if(isWildcard){
  8112. cname = cname.substr(0, cname.length-1);
  8113. }
  8114. // I dislike the regex thing, even if memoized in a cache, but it's VERY short
  8115. var re = new RegExp("(?:^|\\s)" + cname + (isWildcard ? ".*" : "") + "(?:\\s|$)");
  8116. */
  8117. var re = new RegExp("(?:^|\\s)" + cname + "(?:\\s|$)");
  8118. ff = agree(ff, function(elem){
  8119. return re.test(elem.className);
  8120. });
  8121. ff.count = idx;
  8122. });
  8123. }
  8124. if(!("pseudos" in ignores)){
  8125. each(query.pseudos, function(pseudo){
  8126. var pn = pseudo.name;
  8127. if(pseudos[pn]){
  8128. ff = agree(ff, pseudos[pn](pn, pseudo.value));
  8129. }
  8130. });
  8131. }
  8132. if(!("attrs" in ignores)){
  8133. each(query.attrs, function(attr){
  8134. var matcher;
  8135. var a = attr.attr;
  8136. // type, attr, matchFor
  8137. if(attr.type && attrs[attr.type]){
  8138. matcher = attrs[attr.type](a, attr.matchFor);
  8139. }else if(a.length){
  8140. matcher = defaultGetter(a);
  8141. }
  8142. if(matcher){
  8143. ff = agree(ff, matcher);
  8144. }
  8145. });
  8146. }
  8147. if(!("id" in ignores)){
  8148. if(query.id){
  8149. ff = agree(ff, function(elem){
  8150. return (!!elem && (elem.id == query.id));
  8151. });
  8152. }
  8153. }
  8154. if(!ff){
  8155. if(!("default" in ignores)){
  8156. ff = yesman;
  8157. }
  8158. }
  8159. return ff;
  8160. };
  8161. var _nextSibling = function(filterFunc){
  8162. return function(node, ret, bag){
  8163. while(node = node[_ns]){
  8164. if(_noNES && (!_isElement(node))){ continue; }
  8165. if(
  8166. (!bag || _isUnique(node, bag)) &&
  8167. filterFunc(node)
  8168. ){
  8169. ret.push(node);
  8170. }
  8171. break;
  8172. }
  8173. return ret;
  8174. };
  8175. };
  8176. var _nextSiblings = function(filterFunc){
  8177. return function(root, ret, bag){
  8178. var te = root[_ns];
  8179. while(te){
  8180. if(_simpleNodeTest(te)){
  8181. if(bag && !_isUnique(te, bag)){
  8182. break;
  8183. }
  8184. if(filterFunc(te)){
  8185. ret.push(te);
  8186. }
  8187. }
  8188. te = te[_ns];
  8189. }
  8190. return ret;
  8191. };
  8192. };
  8193. // get an array of child *elements*, skipping text and comment nodes
  8194. var _childElements = function(filterFunc){
  8195. filterFunc = filterFunc||yesman;
  8196. return function(root, ret, bag){
  8197. // get an array of child elements, skipping text and comment nodes
  8198. var te, x = 0, tret = root.children || root.childNodes;
  8199. while(te = tret[x++]){
  8200. if(
  8201. _simpleNodeTest(te) &&
  8202. (!bag || _isUnique(te, bag)) &&
  8203. (filterFunc(te, x))
  8204. ){
  8205. ret.push(te);
  8206. }
  8207. }
  8208. return ret;
  8209. };
  8210. };
  8211. // test to see if node is below root
  8212. var _isDescendant = function(node, root){
  8213. var pn = node.parentNode;
  8214. while(pn){
  8215. if(pn == root){
  8216. break;
  8217. }
  8218. pn = pn.parentNode;
  8219. }
  8220. return !!pn;
  8221. };
  8222. var _getElementsFuncCache = {};
  8223. var getElementsFunc = function(query){
  8224. var retFunc = _getElementsFuncCache[query.query];
  8225. // if we've got a cached dispatcher, just use that
  8226. if(retFunc){ return retFunc; }
  8227. // else, generate a new on
  8228. // NOTE:
  8229. // this function returns a function that searches for nodes and
  8230. // filters them. The search may be specialized by infix operators
  8231. // (">", "~", or "+") else it will default to searching all
  8232. // descendants (the " " selector). Once a group of children is
  8233. // found, a test function is applied to weed out the ones we
  8234. // don't want. Many common cases can be fast-pathed. We spend a
  8235. // lot of cycles to create a dispatcher that doesn't do more work
  8236. // than necessary at any point since, unlike this function, the
  8237. // dispatchers will be called every time. The logic of generating
  8238. // efficient dispatchers looks like this in pseudo code:
  8239. //
  8240. // # if it's a purely descendant query (no ">", "+", or "~" modifiers)
  8241. // if infixOperator == " ":
  8242. // if only(id):
  8243. // return def(root):
  8244. // return d.byId(id, root);
  8245. //
  8246. // elif id:
  8247. // return def(root):
  8248. // return filter(d.byId(id, root));
  8249. //
  8250. // elif cssClass && getElementsByClassName:
  8251. // return def(root):
  8252. // return filter(root.getElementsByClassName(cssClass));
  8253. //
  8254. // elif only(tag):
  8255. // return def(root):
  8256. // return root.getElementsByTagName(tagName);
  8257. //
  8258. // else:
  8259. // # search by tag name, then filter
  8260. // return def(root):
  8261. // return filter(root.getElementsByTagName(tagName||"*"));
  8262. //
  8263. // elif infixOperator == ">":
  8264. // # search direct children
  8265. // return def(root):
  8266. // return filter(root.children);
  8267. //
  8268. // elif infixOperator == "+":
  8269. // # search next sibling
  8270. // return def(root):
  8271. // return filter(root.nextElementSibling);
  8272. //
  8273. // elif infixOperator == "~":
  8274. // # search rightward siblings
  8275. // return def(root):
  8276. // return filter(nextSiblings(root));
  8277. var io = query.infixOper;
  8278. var oper = (io ? io.oper : "");
  8279. // the default filter func which tests for all conditions in the query
  8280. // part. This is potentially inefficient, so some optimized paths may
  8281. // re-define it to test fewer things.
  8282. var filterFunc = getSimpleFilterFunc(query, { el: 1 });
  8283. var qt = query.tag;
  8284. var wildcardTag = ("*" == qt);
  8285. var ecs = getDoc()["getElementsByClassName"];
  8286. if(!oper){
  8287. // if there's no infix operator, then it's a descendant query. ID
  8288. // and "elements by class name" variants can be accelerated so we
  8289. // call them out explicitly:
  8290. if(query.id){
  8291. // testing shows that the overhead of yesman() is acceptable
  8292. // and can save us some bytes vs. re-defining the function
  8293. // everywhere.
  8294. filterFunc = (!query.loops && wildcardTag) ?
  8295. yesman :
  8296. getSimpleFilterFunc(query, { el: 1, id: 1 });
  8297. retFunc = function(root, arr){
  8298. var te = dom.byId(query.id, (root.ownerDocument||root));
  8299. if(!te || !filterFunc(te)){ return; }
  8300. if(9 == root.nodeType){ // if root's a doc, we just return directly
  8301. return getArr(te, arr);
  8302. }else{ // otherwise check ancestry
  8303. if(_isDescendant(te, root)){
  8304. return getArr(te, arr);
  8305. }
  8306. }
  8307. };
  8308. }else if(
  8309. ecs &&
  8310. // isAlien check. Workaround for Prototype.js being totally evil/dumb.
  8311. /\{\s*\[native code\]\s*\}/.test(String(ecs)) &&
  8312. query.classes.length &&
  8313. !cssCaseBug
  8314. ){
  8315. // it's a class-based query and we've got a fast way to run it.
  8316. // ignore class and ID filters since we will have handled both
  8317. filterFunc = getSimpleFilterFunc(query, { el: 1, classes: 1, id: 1 });
  8318. var classesString = query.classes.join(" ");
  8319. retFunc = function(root, arr, bag){
  8320. var ret = getArr(0, arr), te, x=0;
  8321. var tret = root.getElementsByClassName(classesString);
  8322. while((te = tret[x++])){
  8323. if(filterFunc(te, root) && _isUnique(te, bag)){
  8324. ret.push(te);
  8325. }
  8326. }
  8327. return ret;
  8328. };
  8329. }else if(!wildcardTag && !query.loops){
  8330. // it's tag only. Fast-path it.
  8331. retFunc = function(root, arr, bag){
  8332. var ret = getArr(0, arr), te, x=0;
  8333. var tag = query.getTag(),
  8334. tret = tag ? root.getElementsByTagName(tag) : [];
  8335. while((te = tret[x++])){
  8336. if(_isUnique(te, bag)){
  8337. ret.push(te);
  8338. }
  8339. }
  8340. return ret;
  8341. };
  8342. }else{
  8343. // the common case:
  8344. // a descendant selector without a fast path. By now it's got
  8345. // to have a tag selector, even if it's just "*" so we query
  8346. // by that and filter
  8347. filterFunc = getSimpleFilterFunc(query, { el: 1, tag: 1, id: 1 });
  8348. retFunc = function(root, arr, bag){
  8349. var ret = getArr(0, arr), te, x=0;
  8350. // we use getTag() to avoid case sensitivity issues
  8351. var tag = query.getTag(),
  8352. tret = tag ? root.getElementsByTagName(tag) : [];
  8353. while((te = tret[x++])){
  8354. if(filterFunc(te, root) && _isUnique(te, bag)){
  8355. ret.push(te);
  8356. }
  8357. }
  8358. return ret;
  8359. };
  8360. }
  8361. }else{
  8362. // the query is scoped in some way. Instead of querying by tag we
  8363. // use some other collection to find candidate nodes
  8364. var skipFilters = { el: 1 };
  8365. if(wildcardTag){
  8366. skipFilters.tag = 1;
  8367. }
  8368. filterFunc = getSimpleFilterFunc(query, skipFilters);
  8369. if("+" == oper){
  8370. retFunc = _nextSibling(filterFunc);
  8371. }else if("~" == oper){
  8372. retFunc = _nextSiblings(filterFunc);
  8373. }else if(">" == oper){
  8374. retFunc = _childElements(filterFunc);
  8375. }
  8376. }
  8377. // cache it and return
  8378. return _getElementsFuncCache[query.query] = retFunc;
  8379. };
  8380. var filterDown = function(root, queryParts){
  8381. // NOTE:
  8382. // this is the guts of the DOM query system. It takes a list of
  8383. // parsed query parts and a root and finds children which match
  8384. // the selector represented by the parts
  8385. var candidates = getArr(root), qp, x, te, qpl = queryParts.length, bag, ret;
  8386. for(var i = 0; i < qpl; i++){
  8387. ret = [];
  8388. qp = queryParts[i];
  8389. x = candidates.length - 1;
  8390. if(x > 0){
  8391. // if we have more than one root at this level, provide a new
  8392. // hash to use for checking group membership but tell the
  8393. // system not to post-filter us since we will already have been
  8394. // guaranteed to be unique
  8395. bag = {};
  8396. ret.nozip = true;
  8397. }
  8398. var gef = getElementsFunc(qp);
  8399. for(var j = 0; (te = candidates[j]); j++){
  8400. // for every root, get the elements that match the descendant
  8401. // selector, adding them to the "ret" array and filtering them
  8402. // via membership in this level's bag. If there are more query
  8403. // parts, then this level's return will be used as the next
  8404. // level's candidates
  8405. gef(te, ret, bag);
  8406. }
  8407. if(!ret.length){ break; }
  8408. candidates = ret;
  8409. }
  8410. return ret;
  8411. };
  8412. ////////////////////////////////////////////////////////////////////////
  8413. // the query runner
  8414. ////////////////////////////////////////////////////////////////////////
  8415. // these are the primary caches for full-query results. The query
  8416. // dispatcher functions are generated then stored here for hash lookup in
  8417. // the future
  8418. var _queryFuncCacheDOM = {},
  8419. _queryFuncCacheQSA = {};
  8420. // this is the second level of splitting, from full-length queries (e.g.,
  8421. // "div.foo .bar") into simple query expressions (e.g., ["div.foo",
  8422. // ".bar"])
  8423. var getStepQueryFunc = function(query){
  8424. var qparts = getQueryParts(trim(query));
  8425. // if it's trivial, avoid iteration and zipping costs
  8426. if(qparts.length == 1){
  8427. // we optimize this case here to prevent dispatch further down the
  8428. // chain, potentially slowing things down. We could more elegantly
  8429. // handle this in filterDown(), but it's slower for simple things
  8430. // that need to be fast (e.g., "#someId").
  8431. var tef = getElementsFunc(qparts[0]);
  8432. return function(root){
  8433. var r = tef(root, []);
  8434. if(r){ r.nozip = true; }
  8435. return r;
  8436. };
  8437. }
  8438. // otherwise, break it up and return a runner that iterates over the parts recursively
  8439. return function(root){
  8440. return filterDown(root, qparts);
  8441. };
  8442. };
  8443. // NOTES:
  8444. // * we can't trust QSA for anything but document-rooted queries, so
  8445. // caching is split into DOM query evaluators and QSA query evaluators
  8446. // * caching query results is dirty and leak-prone (or, at a minimum,
  8447. // prone to unbounded growth). Other toolkits may go this route, but
  8448. // they totally destroy their own ability to manage their memory
  8449. // footprint. If we implement it, it should only ever be with a fixed
  8450. // total element reference # limit and an LRU-style algorithm since JS
  8451. // has no weakref support. Caching compiled query evaluators is also
  8452. // potentially problematic, but even on large documents the size of the
  8453. // query evaluators is often < 100 function objects per evaluator (and
  8454. // LRU can be applied if it's ever shown to be an issue).
  8455. // * since IE's QSA support is currently only for HTML documents and even
  8456. // then only in IE 8's "standards mode", we have to detect our dispatch
  8457. // route at query time and keep 2 separate caches. Ugg.
  8458. // we need to determine if we think we can run a given query via
  8459. // querySelectorAll or if we'll need to fall back on DOM queries to get
  8460. // there. We need a lot of information about the environment and the query
  8461. // to make the determination (e.g. does it support QSA, does the query in
  8462. // question work in the native QSA impl, etc.).
  8463. // IE QSA queries may incorrectly include comment nodes, so we throw the
  8464. // zipping function into "remove" comments mode instead of the normal "skip
  8465. // it" which every other QSA-clued browser enjoys
  8466. var noZip = has("ie") ? "commentStrip" : "nozip";
  8467. var qsa = "querySelectorAll";
  8468. var qsaAvail = !!getDoc()[qsa];
  8469. //Don't bother with n+3 type of matches, IE complains if we modify those.
  8470. var infixSpaceRe = /\\[>~+]|n\+\d|([^ \\])?([>~+])([^ =])?/g;
  8471. var infixSpaceFunc = function(match, pre, ch, post){
  8472. return ch ? (pre ? pre + " " : "") + ch + (post ? " " + post : "") : /*n+3*/ match;
  8473. };
  8474. //Don't apply the infixSpaceRe to attribute value selectors
  8475. var attRe = /([^[]*)([^\]]*])?/g;
  8476. var attFunc = function(match, nonAtt, att){
  8477. return nonAtt.replace(infixSpaceRe, infixSpaceFunc) + (att||"");
  8478. };
  8479. var getQueryFunc = function(query, forceDOM){
  8480. //Normalize query. The CSS3 selectors spec allows for omitting spaces around
  8481. //infix operators, >, ~ and +
  8482. //Do the work here since detection for spaces is used as a simple "not use QSA"
  8483. //test below.
  8484. query = query.replace(attRe, attFunc);
  8485. if(qsaAvail){
  8486. // if we've got a cached variant and we think we can do it, run it!
  8487. var qsaCached = _queryFuncCacheQSA[query];
  8488. if(qsaCached && !forceDOM){ return qsaCached; }
  8489. }
  8490. // else if we've got a DOM cached variant, assume that we already know
  8491. // all we need to and use it
  8492. var domCached = _queryFuncCacheDOM[query];
  8493. if(domCached){ return domCached; }
  8494. // TODO:
  8495. // today we're caching DOM and QSA branches separately so we
  8496. // recalc useQSA every time. If we had a way to tag root+query
  8497. // efficiently, we'd be in good shape to do a global cache.
  8498. var qcz = query.charAt(0);
  8499. var nospace = (-1 == query.indexOf(" "));
  8500. // byId searches are wicked fast compared to QSA, even when filtering
  8501. // is required
  8502. if( (query.indexOf("#") >= 0) && (nospace) ){
  8503. forceDOM = true;
  8504. }
  8505. var useQSA = (
  8506. qsaAvail && (!forceDOM) &&
  8507. // as per CSS 3, we can't currently start w/ combinator:
  8508. // http://www.w3.org/TR/css3-selectors/#w3cselgrammar
  8509. (specials.indexOf(qcz) == -1) &&
  8510. // IE's QSA impl sucks on pseudos
  8511. (!has("ie") || (query.indexOf(":") == -1)) &&
  8512. (!(cssCaseBug && (query.indexOf(".") >= 0))) &&
  8513. // FIXME:
  8514. // need to tighten up browser rules on ":contains" and "|=" to
  8515. // figure out which aren't good
  8516. // Latest webkit (around 531.21.8) does not seem to do well with :checked on option
  8517. // elements, even though according to spec, selected options should
  8518. // match :checked. So go nonQSA for it:
  8519. // http://bugs.dojotoolkit.org/ticket/5179
  8520. (query.indexOf(":contains") == -1) && (query.indexOf(":checked") == -1) &&
  8521. (query.indexOf("|=") == -1) // some browsers don't grok it
  8522. );
  8523. // TODO:
  8524. // if we've got a descendant query (e.g., "> .thinger" instead of
  8525. // just ".thinger") in a QSA-able doc, but are passed a child as a
  8526. // root, it should be possible to give the item a synthetic ID and
  8527. // trivially rewrite the query to the form "#synid > .thinger" to
  8528. // use the QSA branch
  8529. if(useQSA){
  8530. var tq = (specials.indexOf(query.charAt(query.length-1)) >= 0) ?
  8531. (query + " *") : query;
  8532. return _queryFuncCacheQSA[query] = function(root){
  8533. try{
  8534. // the QSA system contains an egregious spec bug which
  8535. // limits us, effectively, to only running QSA queries over
  8536. // entire documents. See:
  8537. // http://ejohn.org/blog/thoughts-on-queryselectorall/
  8538. // despite this, we can also handle QSA runs on simple
  8539. // selectors, but we don't want detection to be expensive
  8540. // so we're just checking for the presence of a space char
  8541. // right now. Not elegant, but it's cheaper than running
  8542. // the query parser when we might not need to
  8543. if(!((9 == root.nodeType) || nospace)){ throw ""; }
  8544. var r = root[qsa](tq);
  8545. // skip expensive duplication checks and just wrap in a NodeList
  8546. r[noZip] = true;
  8547. return r;
  8548. }catch(e){
  8549. // else run the DOM branch on this query, ensuring that we
  8550. // default that way in the future
  8551. return getQueryFunc(query, true)(root);
  8552. }
  8553. };
  8554. }else{
  8555. // DOM branch
  8556. var parts = query.match(/([^\s,](?:"(?:\\.|[^"])+"|'(?:\\.|[^'])+'|[^,])*)/g);
  8557. return _queryFuncCacheDOM[query] = ((parts.length < 2) ?
  8558. // if not a compound query (e.g., ".foo, .bar"), cache and return a dispatcher
  8559. getStepQueryFunc(query) :
  8560. // if it *is* a complex query, break it up into its
  8561. // constituent parts and return a dispatcher that will
  8562. // merge the parts when run
  8563. function(root){
  8564. var pindex = 0, // avoid array alloc for every invocation
  8565. ret = [],
  8566. tp;
  8567. while((tp = parts[pindex++])){
  8568. ret = ret.concat(getStepQueryFunc(tp)(root));
  8569. }
  8570. return ret;
  8571. }
  8572. );
  8573. }
  8574. };
  8575. var _zipIdx = 0;
  8576. // NOTE:
  8577. // this function is Moo inspired, but our own impl to deal correctly
  8578. // with XML in IE
  8579. var _nodeUID = has("ie") ? function(node){
  8580. if(caseSensitive){
  8581. // XML docs don't have uniqueID on their nodes
  8582. return (node.getAttribute("_uid") || node.setAttribute("_uid", ++_zipIdx) || _zipIdx);
  8583. }else{
  8584. return node.uniqueID;
  8585. }
  8586. } :
  8587. function(node){
  8588. return (node._uid || (node._uid = ++_zipIdx));
  8589. };
  8590. // determine if a node in is unique in a "bag". In this case we don't want
  8591. // to flatten a list of unique items, but rather just tell if the item in
  8592. // question is already in the bag. Normally we'd just use hash lookup to do
  8593. // this for us but IE's DOM is busted so we can't really count on that. On
  8594. // the upside, it gives us a built in unique ID function.
  8595. var _isUnique = function(node, bag){
  8596. if(!bag){ return 1; }
  8597. var id = _nodeUID(node);
  8598. if(!bag[id]){ return bag[id] = 1; }
  8599. return 0;
  8600. };
  8601. // attempt to efficiently determine if an item in a list is a dupe,
  8602. // returning a list of "uniques", hopefully in document order
  8603. var _zipIdxName = "_zipIdx";
  8604. var _zip = function(arr){
  8605. if(arr && arr.nozip){
  8606. return arr;
  8607. }
  8608. var ret = [];
  8609. if(!arr || !arr.length){ return ret; }
  8610. if(arr[0]){
  8611. ret.push(arr[0]);
  8612. }
  8613. if(arr.length < 2){ return ret; }
  8614. _zipIdx++;
  8615. // we have to fork here for IE and XML docs because we can't set
  8616. // expandos on their nodes (apparently). *sigh*
  8617. var x, te;
  8618. if(has("ie") && caseSensitive){
  8619. var szidx = _zipIdx+"";
  8620. arr[0].setAttribute(_zipIdxName, szidx);
  8621. for(x = 1; te = arr[x]; x++){
  8622. if(arr[x].getAttribute(_zipIdxName) != szidx){
  8623. ret.push(te);
  8624. }
  8625. te.setAttribute(_zipIdxName, szidx);
  8626. }
  8627. }else if(has("ie") && arr.commentStrip){
  8628. try{
  8629. for(x = 1; te = arr[x]; x++){
  8630. if(_isElement(te)){
  8631. ret.push(te);
  8632. }
  8633. }
  8634. }catch(e){ /* squelch */ }
  8635. }else{
  8636. if(arr[0]){ arr[0][_zipIdxName] = _zipIdx; }
  8637. for(x = 1; te = arr[x]; x++){
  8638. if(arr[x][_zipIdxName] != _zipIdx){
  8639. ret.push(te);
  8640. }
  8641. te[_zipIdxName] = _zipIdx;
  8642. }
  8643. }
  8644. return ret;
  8645. };
  8646. // the main executor
  8647. var query = function(/*String*/ query, /*String|DOMNode?*/ root){
  8648. // summary:
  8649. // Returns nodes which match the given CSS3 selector, searching the
  8650. // entire document by default but optionally taking a node to scope
  8651. // the search by. Returns an array.
  8652. // description:
  8653. // dojo.query() is the swiss army knife of DOM node manipulation in
  8654. // Dojo. Much like Prototype's "$$" (bling-bling) function or JQuery's
  8655. // "$" function, dojo.query provides robust, high-performance
  8656. // CSS-based node selector support with the option of scoping searches
  8657. // to a particular sub-tree of a document.
  8658. //
  8659. // Supported Selectors:
  8660. // --------------------
  8661. //
  8662. // acme supports a rich set of CSS3 selectors, including:
  8663. //
  8664. // - class selectors (e.g., `.foo`)
  8665. // - node type selectors like `span`
  8666. // - ` ` descendant selectors
  8667. // - `>` child element selectors
  8668. // - `#foo` style ID selectors
  8669. // - `*` universal selector
  8670. // - `~`, the preceded-by sibling selector
  8671. // - `+`, the immediately preceded-by sibling selector
  8672. // - attribute queries:
  8673. // - `[foo]` attribute presence selector
  8674. // - `[foo='bar']` attribute value exact match
  8675. // - `[foo~='bar']` attribute value list item match
  8676. // - `[foo^='bar']` attribute start match
  8677. // - `[foo$='bar']` attribute end match
  8678. // - `[foo*='bar']` attribute substring match
  8679. // - `:first-child`, `:last-child`, and `:only-child` positional selectors
  8680. // - `:empty` content emtpy selector
  8681. // - `:checked` pseudo selector
  8682. // - `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations
  8683. // - `:nth-child(even)`, `:nth-child(odd)` positional selectors
  8684. // - `:not(...)` negation pseudo selectors
  8685. //
  8686. // Any legal combination of these selectors will work with
  8687. // `dojo.query()`, including compound selectors ("," delimited).
  8688. // Very complex and useful searches can be constructed with this
  8689. // palette of selectors and when combined with functions for
  8690. // manipulation presented by dojo/NodeList, many types of DOM
  8691. // manipulation operations become very straightforward.
  8692. //
  8693. // Unsupported Selectors:
  8694. // ----------------------
  8695. //
  8696. // While dojo.query handles many CSS3 selectors, some fall outside of
  8697. // what's reasonable for a programmatic node querying engine to
  8698. // handle. Currently unsupported selectors include:
  8699. //
  8700. // - namespace-differentiated selectors of any form
  8701. // - all `::` pseduo-element selectors
  8702. // - certain pseudo-selectors which don't get a lot of day-to-day use:
  8703. // - `:root`, `:lang()`, `:target`, `:focus`
  8704. // - all visual and state selectors:
  8705. // - `:root`, `:active`, `:hover`, `:visited`, `:link`,
  8706. // `:enabled`, `:disabled`
  8707. // - `:*-of-type` pseudo selectors
  8708. //
  8709. // dojo.query and XML Documents:
  8710. // -----------------------------
  8711. //
  8712. // `dojo.query` (as of dojo 1.2) supports searching XML documents
  8713. // in a case-sensitive manner. If an HTML document is served with
  8714. // a doctype that forces case-sensitivity (e.g., XHTML 1.1
  8715. // Strict), dojo.query() will detect this and "do the right
  8716. // thing". Case sensitivity is dependent upon the document being
  8717. // searched and not the query used. It is therefore possible to
  8718. // use case-sensitive queries on strict sub-documents (iframes,
  8719. // etc.) or XML documents while still assuming case-insensitivity
  8720. // for a host/root document.
  8721. //
  8722. // Non-selector Queries:
  8723. // ---------------------
  8724. //
  8725. // If something other than a String is passed for the query,
  8726. // `dojo.query` will return a new `dojo/NodeList` instance
  8727. // constructed from that parameter alone and all further
  8728. // processing will stop. This means that if you have a reference
  8729. // to a node or NodeList, you can quickly construct a new NodeList
  8730. // from the original by calling `dojo.query(node)` or
  8731. // `dojo.query(list)`.
  8732. //
  8733. // query:
  8734. // The CSS3 expression to match against. For details on the syntax of
  8735. // CSS3 selectors, see <http://www.w3.org/TR/css3-selectors/#selectors>
  8736. // root:
  8737. // A DOMNode (or node id) to scope the search from. Optional.
  8738. // returns: Array
  8739. // example:
  8740. // search the entire document for elements with the class "foo":
  8741. // | dojo.query(".foo");
  8742. // these elements will match:
  8743. // | <span class="foo"></span>
  8744. // | <span class="foo bar"></span>
  8745. // | <p class="thud foo"></p>
  8746. // example:
  8747. // search the entire document for elements with the classes "foo" *and* "bar":
  8748. // | dojo.query(".foo.bar");
  8749. // these elements will match:
  8750. // | <span class="foo bar"></span>
  8751. // while these will not:
  8752. // | <span class="foo"></span>
  8753. // | <p class="thud foo"></p>
  8754. // example:
  8755. // find `<span>` elements which are descendants of paragraphs and
  8756. // which have a "highlighted" class:
  8757. // | dojo.query("p span.highlighted");
  8758. // the innermost span in this fragment matches:
  8759. // | <p class="foo">
  8760. // | <span>...
  8761. // | <span class="highlighted foo bar">...</span>
  8762. // | </span>
  8763. // | </p>
  8764. // example:
  8765. // set an "odd" class on all odd table rows inside of the table
  8766. // `#tabular_data`, using the `>` (direct child) selector to avoid
  8767. // affecting any nested tables:
  8768. // | dojo.query("#tabular_data > tbody > tr:nth-child(odd)").addClass("odd");
  8769. // example:
  8770. // remove all elements with the class "error" from the document
  8771. // and store them in a list:
  8772. // | var errors = dojo.query(".error").orphan();
  8773. // example:
  8774. // add an onclick handler to every submit button in the document
  8775. // which causes the form to be sent via Ajax instead:
  8776. // | dojo.query("input[type='submit']").onclick(function(e){
  8777. // | dojo.stopEvent(e); // prevent sending the form
  8778. // | var btn = e.target;
  8779. // | dojo.xhrPost({
  8780. // | form: btn.form,
  8781. // | load: function(data){
  8782. // | // replace the form with the response
  8783. // | var div = dojo.doc.createElement("div");
  8784. // | dojo.place(div, btn.form, "after");
  8785. // | div.innerHTML = data;
  8786. // | dojo.style(btn.form, "display", "none");
  8787. // | }
  8788. // | });
  8789. // | });
  8790. root = root || getDoc();
  8791. // throw the big case sensitivity switch
  8792. var od = root.ownerDocument || root; // root is either Document or a node inside the document
  8793. caseSensitive = (od.createElement("div").tagName === "div");
  8794. // NOTE:
  8795. // adding "true" as the 2nd argument to getQueryFunc is useful for
  8796. // testing the DOM branch without worrying about the
  8797. // behavior/performance of the QSA branch.
  8798. var r = getQueryFunc(query)(root);
  8799. // FIXME:
  8800. // need to investigate this branch WRT #8074 and #8075
  8801. if(r && r.nozip){
  8802. return r;
  8803. }
  8804. return _zip(r); // dojo/NodeList
  8805. };
  8806. query.filter = function(/*Node[]*/ nodeList, /*String*/ filter, /*String|DOMNode?*/ root){
  8807. // summary:
  8808. // function for filtering a NodeList based on a selector, optimized for simple selectors
  8809. var tmpNodeList = [],
  8810. parts = getQueryParts(filter),
  8811. filterFunc =
  8812. (parts.length == 1 && !/[^\w#\.]/.test(filter)) ?
  8813. getSimpleFilterFunc(parts[0]) :
  8814. function(node){
  8815. return array.indexOf(query(filter, dom.byId(root)), node) != -1;
  8816. };
  8817. for(var x = 0, te; te = nodeList[x]; x++){
  8818. if(filterFunc(te)){ tmpNodeList.push(te); }
  8819. }
  8820. return tmpNodeList;
  8821. };
  8822. return query;
  8823. });
  8824. },
  8825. 'dojo/errors/RequestTimeoutError':function(){
  8826. define("dojo/errors/RequestTimeoutError", ['./create', './RequestError'], function(create, RequestError){
  8827. // module:
  8828. // dojo/errors/RequestTimeoutError
  8829. /*=====
  8830. return function(){
  8831. // summary:
  8832. // TODOC
  8833. };
  8834. =====*/
  8835. return create("RequestTimeoutError", null, RequestError, {
  8836. dojoType: "timeout"
  8837. });
  8838. });
  8839. },
  8840. 'dojo/dom-style':function(){
  8841. define("dojo/dom-style", ["./sniff", "./dom"], function(has, dom){
  8842. // module:
  8843. // dojo/dom-style
  8844. // =============================
  8845. // Style Functions
  8846. // =============================
  8847. // getComputedStyle drives most of the style code.
  8848. // Wherever possible, reuse the returned object.
  8849. //
  8850. // API functions below that need to access computed styles accept an
  8851. // optional computedStyle parameter.
  8852. // If this parameter is omitted, the functions will call getComputedStyle themselves.
  8853. // This way, calling code can access computedStyle once, and then pass the reference to
  8854. // multiple API functions.
  8855. // Although we normally eschew argument validation at this
  8856. // level, here we test argument 'node' for (duck)type,
  8857. // by testing nodeType, ecause 'document' is the 'parentNode' of 'body'
  8858. // it is frequently sent to this function even
  8859. // though it is not Element.
  8860. var getComputedStyle, style = {
  8861. // summary:
  8862. // This module defines the core dojo DOM style API.
  8863. };
  8864. if(has("webkit")){
  8865. getComputedStyle = function(/*DomNode*/ node){
  8866. var s;
  8867. if(node.nodeType == 1){
  8868. var dv = node.ownerDocument.defaultView;
  8869. s = dv.getComputedStyle(node, null);
  8870. if(!s && node.style){
  8871. node.style.display = "";
  8872. s = dv.getComputedStyle(node, null);
  8873. }
  8874. }
  8875. return s || {};
  8876. };
  8877. }else if(has("ie") && (has("ie") < 9 || has("quirks"))){
  8878. getComputedStyle = function(node){
  8879. // IE (as of 7) doesn't expose Element like sane browsers
  8880. // currentStyle can be null on IE8!
  8881. return node.nodeType == 1 /* ELEMENT_NODE*/ && node.currentStyle ? node.currentStyle : {};
  8882. };
  8883. }else{
  8884. getComputedStyle = function(node){
  8885. return node.nodeType == 1 /* ELEMENT_NODE*/ ?
  8886. node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
  8887. };
  8888. }
  8889. style.getComputedStyle = getComputedStyle;
  8890. /*=====
  8891. style.getComputedStyle = function(node){
  8892. // summary:
  8893. // Returns a "computed style" object.
  8894. //
  8895. // description:
  8896. // Gets a "computed style" object which can be used to gather
  8897. // information about the current state of the rendered node.
  8898. //
  8899. // Note that this may behave differently on different browsers.
  8900. // Values may have different formats and value encodings across
  8901. // browsers.
  8902. //
  8903. // Note also that this method is expensive. Wherever possible,
  8904. // reuse the returned object.
  8905. //
  8906. // Use the dojo.style() method for more consistent (pixelized)
  8907. // return values.
  8908. //
  8909. // node: DOMNode
  8910. // A reference to a DOM node. Does NOT support taking an
  8911. // ID string for speed reasons.
  8912. // example:
  8913. // | dojo.getComputedStyle(dojo.byId('foo')).borderWidth;
  8914. //
  8915. // example:
  8916. // Reusing the returned object, avoiding multiple lookups:
  8917. // | var cs = dojo.getComputedStyle(dojo.byId("someNode"));
  8918. // | var w = cs.width, h = cs.height;
  8919. return; // CSS2Properties
  8920. };
  8921. =====*/
  8922. var toPixel;
  8923. if(!has("ie")){
  8924. toPixel = function(element, value){
  8925. // style values can be floats, client code may want
  8926. // to round for integer pixels.
  8927. return parseFloat(value) || 0;
  8928. };
  8929. }else{
  8930. toPixel = function(element, avalue){
  8931. if(!avalue){ return 0; }
  8932. // on IE7, medium is usually 4 pixels
  8933. if(avalue == "medium"){ return 4; }
  8934. // style values can be floats, client code may
  8935. // want to round this value for integer pixels.
  8936. if(avalue.slice && avalue.slice(-2) == 'px'){ return parseFloat(avalue); }
  8937. var s = element.style, rs = element.runtimeStyle, cs = element.currentStyle,
  8938. sLeft = s.left, rsLeft = rs.left;
  8939. rs.left = cs.left;
  8940. try{
  8941. // 'avalue' may be incompatible with style.left, which can cause IE to throw
  8942. // this has been observed for border widths using "thin", "medium", "thick" constants
  8943. // those particular constants could be trapped by a lookup
  8944. // but perhaps there are more
  8945. s.left = avalue;
  8946. avalue = s.pixelLeft;
  8947. }catch(e){
  8948. avalue = 0;
  8949. }
  8950. s.left = sLeft;
  8951. rs.left = rsLeft;
  8952. return avalue;
  8953. };
  8954. }
  8955. style.toPixelValue = toPixel;
  8956. /*=====
  8957. style.toPixelValue = function(node, value){
  8958. // summary:
  8959. // converts style value to pixels on IE or return a numeric value.
  8960. // node: DOMNode
  8961. // value: String
  8962. // returns: Number
  8963. };
  8964. =====*/
  8965. // FIXME: there opacity quirks on FF that we haven't ported over. Hrm.
  8966. var astr = "DXImageTransform.Microsoft.Alpha";
  8967. var af = function(n, f){
  8968. try{
  8969. return n.filters.item(astr);
  8970. }catch(e){
  8971. return f ? {} : null;
  8972. }
  8973. };
  8974. var _getOpacity =
  8975. has("ie") < 9 || (has("ie") && has("quirks")) ? function(node){
  8976. try{
  8977. return af(node).Opacity / 100; // Number
  8978. }catch(e){
  8979. return 1; // Number
  8980. }
  8981. } :
  8982. function(node){
  8983. return getComputedStyle(node).opacity;
  8984. };
  8985. var _setOpacity =
  8986. has("ie") < 9 || (has("ie") && has("quirks")) ? function(/*DomNode*/ node, /*Number*/ opacity){
  8987. var ov = opacity * 100, opaque = opacity == 1;
  8988. node.style.zoom = opaque ? "" : 1;
  8989. if(!af(node)){
  8990. if(opaque){
  8991. return opacity;
  8992. }
  8993. node.style.filter += " progid:" + astr + "(Opacity=" + ov + ")";
  8994. }else{
  8995. af(node, 1).Opacity = ov;
  8996. }
  8997. // on IE7 Alpha(Filter opacity=100) makes text look fuzzy so disable it altogether (bug #2661),
  8998. //but still update the opacity value so we can get a correct reading if it is read later.
  8999. af(node, 1).Enabled = !opaque;
  9000. if(node.tagName.toLowerCase() == "tr"){
  9001. for(var td = node.firstChild; td; td = td.nextSibling){
  9002. if(td.tagName.toLowerCase() == "td"){
  9003. _setOpacity(td, opacity);
  9004. }
  9005. }
  9006. }
  9007. return opacity;
  9008. } :
  9009. function(node, opacity){
  9010. return node.style.opacity = opacity;
  9011. };
  9012. var _pixelNamesCache = {
  9013. left: true, top: true
  9014. };
  9015. var _pixelRegExp = /margin|padding|width|height|max|min|offset/; // |border
  9016. function _toStyleValue(node, type, value){
  9017. //TODO: should we really be doing string case conversion here? Should we cache it? Need to profile!
  9018. type = type.toLowerCase();
  9019. if(has("ie")){
  9020. if(value == "auto"){
  9021. if(type == "height"){ return node.offsetHeight; }
  9022. if(type == "width"){ return node.offsetWidth; }
  9023. }
  9024. if(type == "fontweight"){
  9025. switch(value){
  9026. case 700: return "bold";
  9027. case 400:
  9028. default: return "normal";
  9029. }
  9030. }
  9031. }
  9032. if(!(type in _pixelNamesCache)){
  9033. _pixelNamesCache[type] = _pixelRegExp.test(type);
  9034. }
  9035. return _pixelNamesCache[type] ? toPixel(node, value) : value;
  9036. }
  9037. var _floatStyle = has("ie") ? "styleFloat" : "cssFloat",
  9038. _floatAliases = {"cssFloat": _floatStyle, "styleFloat": _floatStyle, "float": _floatStyle};
  9039. // public API
  9040. style.get = function getStyle(/*DOMNode|String*/ node, /*String?*/ name){
  9041. // summary:
  9042. // Accesses styles on a node.
  9043. // description:
  9044. // Getting the style value uses the computed style for the node, so the value
  9045. // will be a calculated value, not just the immediate node.style value.
  9046. // Also when getting values, use specific style names,
  9047. // like "borderBottomWidth" instead of "border" since compound values like
  9048. // "border" are not necessarily reflected as expected.
  9049. // If you want to get node dimensions, use `dojo.marginBox()`,
  9050. // `dojo.contentBox()` or `dojo.position()`.
  9051. // node: DOMNode|String
  9052. // id or reference to node to get style for
  9053. // name: String?
  9054. // the style property to get
  9055. // example:
  9056. // Passing only an ID or node returns the computed style object of
  9057. // the node:
  9058. // | dojo.getStyle("thinger");
  9059. // example:
  9060. // Passing a node and a style property returns the current
  9061. // normalized, computed value for that property:
  9062. // | dojo.getStyle("thinger", "opacity"); // 1 by default
  9063. var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
  9064. if(l == 2 && op){
  9065. return _getOpacity(n);
  9066. }
  9067. name = _floatAliases[name] || name;
  9068. var s = style.getComputedStyle(n);
  9069. return (l == 1) ? s : _toStyleValue(n, name, s[name] || n.style[name]); /* CSS2Properties||String||Number */
  9070. };
  9071. style.set = function setStyle(/*DOMNode|String*/ node, /*String|Object*/ name, /*String?*/ value){
  9072. // summary:
  9073. // Sets styles on a node.
  9074. // node: DOMNode|String
  9075. // id or reference to node to set style for
  9076. // name: String|Object
  9077. // the style property to set in DOM-accessor format
  9078. // ("borderWidth", not "border-width") or an object with key/value
  9079. // pairs suitable for setting each property.
  9080. // value: String?
  9081. // If passed, sets value on the node for style, handling
  9082. // cross-browser concerns. When setting a pixel value,
  9083. // be sure to include "px" in the value. For instance, top: "200px".
  9084. // Otherwise, in some cases, some browsers will not apply the style.
  9085. //
  9086. // example:
  9087. // Passing a node, a style property, and a value changes the
  9088. // current display of the node and returns the new computed value
  9089. // | dojo.setStyle("thinger", "opacity", 0.5); // == 0.5
  9090. //
  9091. // example:
  9092. // Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
  9093. // | dojo.setStyle("thinger", {
  9094. // | "opacity": 0.5,
  9095. // | "border": "3px solid black",
  9096. // | "height": "300px"
  9097. // | });
  9098. //
  9099. // example:
  9100. // When the CSS style property is hyphenated, the JavaScript property is camelCased.
  9101. // font-size becomes fontSize, and so on.
  9102. // | dojo.setStyle("thinger",{
  9103. // | fontSize:"14pt",
  9104. // | letterSpacing:"1.2em"
  9105. // | });
  9106. //
  9107. // example:
  9108. // dojo/NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
  9109. // dojo.style() on every element of the list. See: `dojo.query()` and `dojo/NodeList`
  9110. // | dojo.query(".someClassName").style("visibility","hidden");
  9111. // | // or
  9112. // | dojo.query("#baz > div").style({
  9113. // | opacity:0.75,
  9114. // | fontSize:"13pt"
  9115. // | });
  9116. var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
  9117. name = _floatAliases[name] || name;
  9118. if(l == 3){
  9119. return op ? _setOpacity(n, value) : n.style[name] = value; // Number
  9120. }
  9121. for(var x in name){
  9122. style.set(node, x, name[x]);
  9123. }
  9124. return style.getComputedStyle(n);
  9125. };
  9126. return style;
  9127. });
  9128. },
  9129. 'dojo/dom-geometry':function(){
  9130. define(["./sniff", "./_base/window","./dom", "./dom-style"],
  9131. function(has, win, dom, style){
  9132. // module:
  9133. // dojo/dom-geometry
  9134. // the result object
  9135. var geom = {
  9136. // summary:
  9137. // This module defines the core dojo DOM geometry API.
  9138. };
  9139. // Box functions will assume this model.
  9140. // On IE/Opera, BORDER_BOX will be set if the primary document is in quirks mode.
  9141. // Can be set to change behavior of box setters.
  9142. // can be either:
  9143. // "border-box"
  9144. // "content-box" (default)
  9145. geom.boxModel = "content-box";
  9146. // We punt per-node box mode testing completely.
  9147. // If anybody cares, we can provide an additional (optional) unit
  9148. // that overrides existing code to include per-node box sensitivity.
  9149. // Opera documentation claims that Opera 9 uses border-box in BackCompat mode.
  9150. // but experiments (Opera 9.10.8679 on Windows Vista) indicate that it actually continues to use content-box.
  9151. // IIRC, earlier versions of Opera did in fact use border-box.
  9152. // Opera guys, this is really confusing. Opera being broken in quirks mode is not our fault.
  9153. if(has("ie") /*|| has("opera")*/){
  9154. // client code may have to adjust if compatMode varies across iframes
  9155. geom.boxModel = document.compatMode == "BackCompat" ? "border-box" : "content-box";
  9156. }
  9157. geom.getPadExtents = function getPadExtents(/*DomNode*/ node, /*Object*/ computedStyle){
  9158. // summary:
  9159. // Returns object with special values specifically useful for node
  9160. // fitting.
  9161. // description:
  9162. // Returns an object with `w`, `h`, `l`, `t` properties:
  9163. // | l/t/r/b = left/top/right/bottom padding (respectively)
  9164. // | w = the total of the left and right padding
  9165. // | h = the total of the top and bottom padding
  9166. // If 'node' has position, l/t forms the origin for child nodes.
  9167. // The w/h are used for calculating boxes.
  9168. // Normally application code will not need to invoke this
  9169. // directly, and will use the ...box... functions instead.
  9170. // node: DOMNode
  9171. // computedStyle: Object?
  9172. // This parameter accepts computed styles object.
  9173. // If this parameter is omitted, the functions will call
  9174. // dojo.getComputedStyle to get one. It is a better way, calling
  9175. // dojo.computedStyle once, and then pass the reference to this
  9176. // computedStyle parameter. Wherever possible, reuse the returned
  9177. // object of dojo/dom-style.getComputedStyle().
  9178. node = dom.byId(node);
  9179. var s = computedStyle || style.getComputedStyle(node), px = style.toPixelValue,
  9180. l = px(node, s.paddingLeft), t = px(node, s.paddingTop), r = px(node, s.paddingRight), b = px(node, s.paddingBottom);
  9181. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9182. };
  9183. var none = "none";
  9184. geom.getBorderExtents = function getBorderExtents(/*DomNode*/ node, /*Object*/ computedStyle){
  9185. // summary:
  9186. // returns an object with properties useful for noting the border
  9187. // dimensions.
  9188. // description:
  9189. // - l/t/r/b = the sum of left/top/right/bottom border (respectively)
  9190. // - w = the sum of the left and right border
  9191. // - h = the sum of the top and bottom border
  9192. //
  9193. // The w/h are used for calculating boxes.
  9194. // Normally application code will not need to invoke this
  9195. // directly, and will use the ...box... functions instead.
  9196. // node: DOMNode
  9197. // computedStyle: Object?
  9198. // This parameter accepts computed styles object.
  9199. // If this parameter is omitted, the functions will call
  9200. // dojo.getComputedStyle to get one. It is a better way, calling
  9201. // dojo.computedStyle once, and then pass the reference to this
  9202. // computedStyle parameter. Wherever possible, reuse the returned
  9203. // object of dojo/dom-style.getComputedStyle().
  9204. node = dom.byId(node);
  9205. var px = style.toPixelValue, s = computedStyle || style.getComputedStyle(node),
  9206. l = s.borderLeftStyle != none ? px(node, s.borderLeftWidth) : 0,
  9207. t = s.borderTopStyle != none ? px(node, s.borderTopWidth) : 0,
  9208. r = s.borderRightStyle != none ? px(node, s.borderRightWidth) : 0,
  9209. b = s.borderBottomStyle != none ? px(node, s.borderBottomWidth) : 0;
  9210. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9211. };
  9212. geom.getPadBorderExtents = function getPadBorderExtents(/*DomNode*/ node, /*Object*/ computedStyle){
  9213. // summary:
  9214. // Returns object with properties useful for box fitting with
  9215. // regards to padding.
  9216. // description:
  9217. // - l/t/r/b = the sum of left/top/right/bottom padding and left/top/right/bottom border (respectively)
  9218. // - w = the sum of the left and right padding and border
  9219. // - h = the sum of the top and bottom padding and border
  9220. //
  9221. // The w/h are used for calculating boxes.
  9222. // Normally application code will not need to invoke this
  9223. // directly, and will use the ...box... functions instead.
  9224. // node: DOMNode
  9225. // computedStyle: Object?
  9226. // This parameter accepts computed styles object.
  9227. // If this parameter is omitted, the functions will call
  9228. // dojo.getComputedStyle to get one. It is a better way, calling
  9229. // dojo.computedStyle once, and then pass the reference to this
  9230. // computedStyle parameter. Wherever possible, reuse the returned
  9231. // object of dojo/dom-style.getComputedStyle().
  9232. node = dom.byId(node);
  9233. var s = computedStyle || style.getComputedStyle(node),
  9234. p = geom.getPadExtents(node, s),
  9235. b = geom.getBorderExtents(node, s);
  9236. return {
  9237. l: p.l + b.l,
  9238. t: p.t + b.t,
  9239. r: p.r + b.r,
  9240. b: p.b + b.b,
  9241. w: p.w + b.w,
  9242. h: p.h + b.h
  9243. };
  9244. };
  9245. geom.getMarginExtents = function getMarginExtents(node, computedStyle){
  9246. // summary:
  9247. // returns object with properties useful for box fitting with
  9248. // regards to box margins (i.e., the outer-box).
  9249. //
  9250. // - l/t = marginLeft, marginTop, respectively
  9251. // - w = total width, margin inclusive
  9252. // - h = total height, margin inclusive
  9253. //
  9254. // The w/h are used for calculating boxes.
  9255. // Normally application code will not need to invoke this
  9256. // directly, and will use the ...box... functions instead.
  9257. // node: DOMNode
  9258. // computedStyle: Object?
  9259. // This parameter accepts computed styles object.
  9260. // If this parameter is omitted, the functions will call
  9261. // dojo.getComputedStyle to get one. It is a better way, calling
  9262. // dojo.computedStyle once, and then pass the reference to this
  9263. // computedStyle parameter. Wherever possible, reuse the returned
  9264. // object of dojo/dom-style.getComputedStyle().
  9265. node = dom.byId(node);
  9266. var s = computedStyle || style.getComputedStyle(node), px = style.toPixelValue,
  9267. l = px(node, s.marginLeft), t = px(node, s.marginTop), r = px(node, s.marginRight), b = px(node, s.marginBottom);
  9268. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9269. };
  9270. // Box getters work in any box context because offsetWidth/clientWidth
  9271. // are invariant wrt box context
  9272. //
  9273. // They do *not* work for display: inline objects that have padding styles
  9274. // because the user agent ignores padding (it's bogus styling in any case)
  9275. //
  9276. // Be careful with IMGs because they are inline or block depending on
  9277. // browser and browser mode.
  9278. // Although it would be easier to read, there are not separate versions of
  9279. // _getMarginBox for each browser because:
  9280. // 1. the branching is not expensive
  9281. // 2. factoring the shared code wastes cycles (function call overhead)
  9282. // 3. duplicating the shared code wastes bytes
  9283. geom.getMarginBox = function getMarginBox(/*DomNode*/ node, /*Object*/ computedStyle){
  9284. // summary:
  9285. // returns an object that encodes the width, height, left and top
  9286. // positions of the node's margin box.
  9287. // node: DOMNode
  9288. // computedStyle: Object?
  9289. // This parameter accepts computed styles object.
  9290. // If this parameter is omitted, the functions will call
  9291. // dojo.getComputedStyle to get one. It is a better way, calling
  9292. // dojo.computedStyle once, and then pass the reference to this
  9293. // computedStyle parameter. Wherever possible, reuse the returned
  9294. // object of dojo/dom-style.getComputedStyle().
  9295. node = dom.byId(node);
  9296. var s = computedStyle || style.getComputedStyle(node), me = geom.getMarginExtents(node, s),
  9297. l = node.offsetLeft - me.l, t = node.offsetTop - me.t, p = node.parentNode, px = style.toPixelValue, pcs;
  9298. if(has("mozilla")){
  9299. // Mozilla:
  9300. // If offsetParent has a computed overflow != visible, the offsetLeft is decreased
  9301. // by the parent's border.
  9302. // We don't want to compute the parent's style, so instead we examine node's
  9303. // computed left/top which is more stable.
  9304. var sl = parseFloat(s.left), st = parseFloat(s.top);
  9305. if(!isNaN(sl) && !isNaN(st)){
  9306. l = sl;
  9307. t = st;
  9308. }else{
  9309. // If child's computed left/top are not parseable as a number (e.g. "auto"), we
  9310. // have no choice but to examine the parent's computed style.
  9311. if(p && p.style){
  9312. pcs = style.getComputedStyle(p);
  9313. if(pcs.overflow != "visible"){
  9314. l += pcs.borderLeftStyle != none ? px(node, pcs.borderLeftWidth) : 0;
  9315. t += pcs.borderTopStyle != none ? px(node, pcs.borderTopWidth) : 0;
  9316. }
  9317. }
  9318. }
  9319. }else if(has("opera") || (has("ie") == 8 && !has("quirks"))){
  9320. // On Opera and IE 8, offsetLeft/Top includes the parent's border
  9321. if(p){
  9322. pcs = style.getComputedStyle(p);
  9323. l -= pcs.borderLeftStyle != none ? px(node, pcs.borderLeftWidth) : 0;
  9324. t -= pcs.borderTopStyle != none ? px(node, pcs.borderTopWidth) : 0;
  9325. }
  9326. }
  9327. return {l: l, t: t, w: node.offsetWidth + me.w, h: node.offsetHeight + me.h};
  9328. };
  9329. geom.getContentBox = function getContentBox(node, computedStyle){
  9330. // summary:
  9331. // Returns an object that encodes the width, height, left and top
  9332. // positions of the node's content box, irrespective of the
  9333. // current box model.
  9334. // node: DOMNode
  9335. // computedStyle: Object?
  9336. // This parameter accepts computed styles object.
  9337. // If this parameter is omitted, the functions will call
  9338. // dojo.getComputedStyle to get one. It is a better way, calling
  9339. // dojo.computedStyle once, and then pass the reference to this
  9340. // computedStyle parameter. Wherever possible, reuse the returned
  9341. // object of dojo/dom-style.getComputedStyle().
  9342. // clientWidth/Height are important since the automatically account for scrollbars
  9343. // fallback to offsetWidth/Height for special cases (see #3378)
  9344. node = dom.byId(node);
  9345. var s = computedStyle || style.getComputedStyle(node), w = node.clientWidth, h,
  9346. pe = geom.getPadExtents(node, s), be = geom.getBorderExtents(node, s);
  9347. if(!w){
  9348. w = node.offsetWidth;
  9349. h = node.offsetHeight;
  9350. }else{
  9351. h = node.clientHeight;
  9352. be.w = be.h = 0;
  9353. }
  9354. // On Opera, offsetLeft includes the parent's border
  9355. if(has("opera")){
  9356. pe.l += be.l;
  9357. pe.t += be.t;
  9358. }
  9359. return {l: pe.l, t: pe.t, w: w - pe.w - be.w, h: h - pe.h - be.h};
  9360. };
  9361. // Box setters depend on box context because interpretation of width/height styles
  9362. // vary wrt box context.
  9363. //
  9364. // The value of boxModel is used to determine box context.
  9365. // boxModel can be set directly to change behavior.
  9366. //
  9367. // Beware of display: inline objects that have padding styles
  9368. // because the user agent ignores padding (it's a bogus setup anyway)
  9369. //
  9370. // Be careful with IMGs because they are inline or block depending on
  9371. // browser and browser mode.
  9372. //
  9373. // Elements other than DIV may have special quirks, like built-in
  9374. // margins or padding, or values not detectable via computedStyle.
  9375. // In particular, margins on TABLE do not seems to appear
  9376. // at all in computedStyle on Mozilla.
  9377. function setBox(/*DomNode*/ node, /*Number?*/ l, /*Number?*/ t, /*Number?*/ w, /*Number?*/ h, /*String?*/ u){
  9378. // summary:
  9379. // sets width/height/left/top in the current (native) box-model
  9380. // dimensions. Uses the unit passed in u.
  9381. // node:
  9382. // DOM Node reference. Id string not supported for performance
  9383. // reasons.
  9384. // l:
  9385. // left offset from parent.
  9386. // t:
  9387. // top offset from parent.
  9388. // w:
  9389. // width in current box model.
  9390. // h:
  9391. // width in current box model.
  9392. // u:
  9393. // unit measure to use for other measures. Defaults to "px".
  9394. u = u || "px";
  9395. var s = node.style;
  9396. if(!isNaN(l)){
  9397. s.left = l + u;
  9398. }
  9399. if(!isNaN(t)){
  9400. s.top = t + u;
  9401. }
  9402. if(w >= 0){
  9403. s.width = w + u;
  9404. }
  9405. if(h >= 0){
  9406. s.height = h + u;
  9407. }
  9408. }
  9409. function isButtonTag(/*DomNode*/ node){
  9410. // summary:
  9411. // True if the node is BUTTON or INPUT.type="button".
  9412. return node.tagName.toLowerCase() == "button" ||
  9413. node.tagName.toLowerCase() == "input" && (node.getAttribute("type") || "").toLowerCase() == "button"; // boolean
  9414. }
  9415. function usesBorderBox(/*DomNode*/ node){
  9416. // summary:
  9417. // True if the node uses border-box layout.
  9418. // We could test the computed style of node to see if a particular box
  9419. // has been specified, but there are details and we choose not to bother.
  9420. // TABLE and BUTTON (and INPUT type=button) are always border-box by default.
  9421. // If you have assigned a different box to either one via CSS then
  9422. // box functions will break.
  9423. return geom.boxModel == "border-box" || node.tagName.toLowerCase() == "table" || isButtonTag(node); // boolean
  9424. }
  9425. geom.setContentSize = function setContentSize(/*DomNode*/ node, /*Object*/ box, /*Object*/ computedStyle){
  9426. // summary:
  9427. // Sets the size of the node's contents, irrespective of margins,
  9428. // padding, or borders.
  9429. // node: DOMNode
  9430. // box: Object
  9431. // hash with optional "w", and "h" properties for "width", and "height"
  9432. // respectively. All specified properties should have numeric values in whole pixels.
  9433. // computedStyle: Object?
  9434. // This parameter accepts computed styles object.
  9435. // If this parameter is omitted, the functions will call
  9436. // dojo.getComputedStyle to get one. It is a better way, calling
  9437. // dojo.computedStyle once, and then pass the reference to this
  9438. // computedStyle parameter. Wherever possible, reuse the returned
  9439. // object of dojo/dom-style.getComputedStyle().
  9440. node = dom.byId(node);
  9441. var w = box.w, h = box.h;
  9442. if(usesBorderBox(node)){
  9443. var pb = geom.getPadBorderExtents(node, computedStyle);
  9444. if(w >= 0){
  9445. w += pb.w;
  9446. }
  9447. if(h >= 0){
  9448. h += pb.h;
  9449. }
  9450. }
  9451. setBox(node, NaN, NaN, w, h);
  9452. };
  9453. var nilExtents = {l: 0, t: 0, w: 0, h: 0};
  9454. geom.setMarginBox = function setMarginBox(/*DomNode*/ node, /*Object*/ box, /*Object*/ computedStyle){
  9455. // summary:
  9456. // sets the size of the node's margin box and placement
  9457. // (left/top), irrespective of box model. Think of it as a
  9458. // passthrough to setBox that handles box-model vagaries for
  9459. // you.
  9460. // node: DOMNode
  9461. // box: Object
  9462. // hash with optional "l", "t", "w", and "h" properties for "left", "right", "width", and "height"
  9463. // respectively. All specified properties should have numeric values in whole pixels.
  9464. // computedStyle: Object?
  9465. // This parameter accepts computed styles object.
  9466. // If this parameter is omitted, the functions will call
  9467. // dojo.getComputedStyle to get one. It is a better way, calling
  9468. // dojo.computedStyle once, and then pass the reference to this
  9469. // computedStyle parameter. Wherever possible, reuse the returned
  9470. // object of dojo/dom-style.getComputedStyle().
  9471. node = dom.byId(node);
  9472. var s = computedStyle || style.getComputedStyle(node), w = box.w, h = box.h,
  9473. // Some elements have special padding, margin, and box-model settings.
  9474. // To use box functions you may need to set padding, margin explicitly.
  9475. // Controlling box-model is harder, in a pinch you might set dojo/dom-geometry.boxModel.
  9476. pb = usesBorderBox(node) ? nilExtents : geom.getPadBorderExtents(node, s),
  9477. mb = geom.getMarginExtents(node, s);
  9478. if(has("webkit")){
  9479. // on Safari (3.1.2), button nodes with no explicit size have a default margin
  9480. // setting an explicit size eliminates the margin.
  9481. // We have to swizzle the width to get correct margin reading.
  9482. if(isButtonTag(node)){
  9483. var ns = node.style;
  9484. if(w >= 0 && !ns.width){
  9485. ns.width = "4px";
  9486. }
  9487. if(h >= 0 && !ns.height){
  9488. ns.height = "4px";
  9489. }
  9490. }
  9491. }
  9492. if(w >= 0){
  9493. w = Math.max(w - pb.w - mb.w, 0);
  9494. }
  9495. if(h >= 0){
  9496. h = Math.max(h - pb.h - mb.h, 0);
  9497. }
  9498. setBox(node, box.l, box.t, w, h);
  9499. };
  9500. // =============================
  9501. // Positioning
  9502. // =============================
  9503. geom.isBodyLtr = function isBodyLtr(/*Document?*/ doc){
  9504. // summary:
  9505. // Returns true if the current language is left-to-right, and false otherwise.
  9506. // doc: Document?
  9507. // Optional document to query. If unspecified, use win.doc.
  9508. // returns: Boolean
  9509. doc = doc || win.doc;
  9510. return (win.body(doc).dir || doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
  9511. };
  9512. geom.docScroll = function docScroll(/*Document?*/ doc){
  9513. // summary:
  9514. // Returns an object with {node, x, y} with corresponding offsets.
  9515. // doc: Document?
  9516. // Optional document to query. If unspecified, use win.doc.
  9517. // returns: Object
  9518. doc = doc || win.doc;
  9519. var node = win.doc.parentWindow || win.doc.defaultView; // use UI window, not dojo.global window. TODO: use dojo/window::get() except for circular dependency problem
  9520. return "pageXOffset" in node ? {x: node.pageXOffset, y: node.pageYOffset } :
  9521. (node = has("quirks") ? win.body(doc) : doc.documentElement) &&
  9522. {x: geom.fixIeBiDiScrollLeft(node.scrollLeft || 0, doc), y: node.scrollTop || 0 };
  9523. };
  9524. if(has("ie")){
  9525. geom.getIeDocumentElementOffset = function getIeDocumentElementOffset(/*Document?*/ doc){
  9526. // summary:
  9527. // returns the offset in x and y from the document body to the
  9528. // visual edge of the page for IE
  9529. // doc: Document?
  9530. // Optional document to query. If unspecified, use win.doc.
  9531. // description:
  9532. // The following values in IE contain an offset:
  9533. // | event.clientX
  9534. // | event.clientY
  9535. // | node.getBoundingClientRect().left
  9536. // | node.getBoundingClientRect().top
  9537. // But other position related values do not contain this offset,
  9538. // such as node.offsetLeft, node.offsetTop, node.style.left and
  9539. // node.style.top. The offset is always (2, 2) in LTR direction.
  9540. // When the body is in RTL direction, the offset counts the width
  9541. // of left scroll bar's width. This function computes the actual
  9542. // offset.
  9543. //NOTE: assumes we're being called in an IE browser
  9544. doc = doc || win.doc;
  9545. var de = doc.documentElement; // only deal with HTML element here, position() handles body/quirks
  9546. if(has("ie") < 8){
  9547. var r = de.getBoundingClientRect(), // works well for IE6+
  9548. l = r.left, t = r.top;
  9549. if(has("ie") < 7){
  9550. l += de.clientLeft; // scrollbar size in strict/RTL, or,
  9551. t += de.clientTop; // HTML border size in strict
  9552. }
  9553. return {
  9554. x: l < 0 ? 0 : l, // FRAME element border size can lead to inaccurate negative values
  9555. y: t < 0 ? 0 : t
  9556. };
  9557. }else{
  9558. return {
  9559. x: 0,
  9560. y: 0
  9561. };
  9562. }
  9563. };
  9564. }
  9565. geom.fixIeBiDiScrollLeft = function fixIeBiDiScrollLeft(/*Integer*/ scrollLeft, /*Document?*/ doc){
  9566. // summary:
  9567. // In RTL direction, scrollLeft should be a negative value, but IE
  9568. // returns a positive one. All codes using documentElement.scrollLeft
  9569. // must call this function to fix this error, otherwise the position
  9570. // will offset to right when there is a horizontal scrollbar.
  9571. // scrollLeft: Number
  9572. // doc: Document?
  9573. // Optional document to query. If unspecified, use win.doc.
  9574. // returns: Number
  9575. // In RTL direction, scrollLeft should be a negative value, but IE
  9576. // returns a positive one. All codes using documentElement.scrollLeft
  9577. // must call this function to fix this error, otherwise the position
  9578. // will offset to right when there is a horizontal scrollbar.
  9579. doc = doc || win.doc;
  9580. var ie = has("ie");
  9581. if(ie && !geom.isBodyLtr(doc)){
  9582. var qk = has("quirks"),
  9583. de = qk ? win.body(doc) : doc.documentElement,
  9584. pwin = win.global; // TODO: use winUtils.get(doc) after resolving circular dependency b/w dom-geometry.js and dojo/window.js
  9585. if(ie == 6 && !qk && pwin.frameElement && de.scrollHeight > de.clientHeight){
  9586. scrollLeft += de.clientLeft; // workaround ie6+strict+rtl+iframe+vertical-scrollbar bug where clientWidth is too small by clientLeft pixels
  9587. }
  9588. return (ie < 8 || qk) ? (scrollLeft + de.clientWidth - de.scrollWidth) : -scrollLeft; // Integer
  9589. }
  9590. return scrollLeft; // Integer
  9591. };
  9592. geom.position = function(/*DomNode*/ node, /*Boolean?*/ includeScroll){
  9593. // summary:
  9594. // Gets the position and size of the passed element relative to
  9595. // the viewport (if includeScroll==false), or relative to the
  9596. // document root (if includeScroll==true).
  9597. //
  9598. // description:
  9599. // Returns an object of the form:
  9600. // `{ x: 100, y: 300, w: 20, h: 15 }`.
  9601. // If includeScroll==true, the x and y values will include any
  9602. // document offsets that may affect the position relative to the
  9603. // viewport.
  9604. // Uses the border-box model (inclusive of border and padding but
  9605. // not margin). Does not act as a setter.
  9606. // node: DOMNode|String
  9607. // includeScroll: Boolean?
  9608. // returns: Object
  9609. node = dom.byId(node);
  9610. var db = win.body(node.ownerDocument),
  9611. ret = node.getBoundingClientRect();
  9612. ret = {x: ret.left, y: ret.top, w: ret.right - ret.left, h: ret.bottom - ret.top};
  9613. if(has("ie")){
  9614. // On IE there's a 2px offset that we need to adjust for, see dojo.getIeDocumentElementOffset()
  9615. var offset = geom.getIeDocumentElementOffset(node.ownerDocument);
  9616. // fixes the position in IE, quirks mode
  9617. ret.x -= offset.x + (has("quirks") ? db.clientLeft + db.offsetLeft : 0);
  9618. ret.y -= offset.y + (has("quirks") ? db.clientTop + db.offsetTop : 0);
  9619. }
  9620. // account for document scrolling
  9621. // if offsetParent is used, ret value already includes scroll position
  9622. // so we may have to actually remove that value if !includeScroll
  9623. if(includeScroll){
  9624. var scroll = geom.docScroll(node.ownerDocument);
  9625. ret.x += scroll.x;
  9626. ret.y += scroll.y;
  9627. }
  9628. return ret; // Object
  9629. };
  9630. // random "private" functions wildly used throughout the toolkit
  9631. geom.getMarginSize = function getMarginSize(/*DomNode*/ node, /*Object*/ computedStyle){
  9632. // summary:
  9633. // returns an object that encodes the width and height of
  9634. // the node's margin box
  9635. // node: DOMNode|String
  9636. // computedStyle: Object?
  9637. // This parameter accepts computed styles object.
  9638. // If this parameter is omitted, the functions will call
  9639. // dojo.getComputedStyle to get one. It is a better way, calling
  9640. // dojo.computedStyle once, and then pass the reference to this
  9641. // computedStyle parameter. Wherever possible, reuse the returned
  9642. // object of dojo/dom-style.getComputedStyle().
  9643. node = dom.byId(node);
  9644. var me = geom.getMarginExtents(node, computedStyle || style.getComputedStyle(node));
  9645. var size = node.getBoundingClientRect();
  9646. return {
  9647. w: (size.right - size.left) + me.w,
  9648. h: (size.bottom - size.top) + me.h
  9649. };
  9650. };
  9651. geom.normalizeEvent = function(event){
  9652. // summary:
  9653. // Normalizes the geometry of a DOM event, normalizing the pageX, pageY,
  9654. // offsetX, offsetY, layerX, and layerX properties
  9655. // event: Object
  9656. if(!("layerX" in event)){
  9657. event.layerX = event.offsetX;
  9658. event.layerY = event.offsetY;
  9659. }
  9660. if(!has("dom-addeventlistener")){
  9661. // old IE version
  9662. // FIXME: scroll position query is duped from dojo.html to
  9663. // avoid dependency on that entire module. Now that HTML is in
  9664. // Base, we should convert back to something similar there.
  9665. var se = event.target;
  9666. var doc = (se && se.ownerDocument) || document;
  9667. // DO NOT replace the following to use dojo.body(), in IE, document.documentElement should be used
  9668. // here rather than document.body
  9669. var docBody = has("quirks") ? doc.body : doc.documentElement;
  9670. var offset = geom.getIeDocumentElementOffset(doc);
  9671. event.pageX = event.clientX + geom.fixIeBiDiScrollLeft(docBody.scrollLeft || 0, doc) - offset.x;
  9672. event.pageY = event.clientY + (docBody.scrollTop || 0) - offset.y;
  9673. }
  9674. };
  9675. // TODO: evaluate separate getters/setters for position and sizes?
  9676. return geom;
  9677. });
  9678. },
  9679. 'dojo/dom-prop':function(){
  9680. define(["exports", "./_base/kernel", "./sniff", "./_base/lang", "./dom", "./dom-style", "./dom-construct", "./_base/connect"],
  9681. function(exports, dojo, has, lang, dom, style, ctr, conn){
  9682. // module:
  9683. // dojo/dom-prop
  9684. // summary:
  9685. // This module defines the core dojo DOM properties API.
  9686. // Indirectly depends on dojo.empty() and dojo.toDom().
  9687. // TODOC: summary not showing up in output, see https://github.com/csnover/js-doc-parse/issues/42
  9688. // =============================
  9689. // Element properties Functions
  9690. // =============================
  9691. // helper to connect events
  9692. var _evtHdlrMap = {}, _ctr = 0, _attrId = dojo._scopeName + "attrid";
  9693. exports.names = {
  9694. // properties renamed to avoid clashes with reserved words
  9695. "class": "className",
  9696. "for": "htmlFor",
  9697. // properties written as camelCase
  9698. tabindex: "tabIndex",
  9699. readonly: "readOnly",
  9700. colspan: "colSpan",
  9701. frameborder: "frameBorder",
  9702. rowspan: "rowSpan",
  9703. valuetype: "valueType"
  9704. };
  9705. exports.get = function getProp(/*DOMNode|String*/ node, /*String*/ name){
  9706. // summary:
  9707. // Gets a property on an HTML element.
  9708. // description:
  9709. // Handles normalized getting of properties on DOM nodes.
  9710. //
  9711. // node: DOMNode|String
  9712. // id or reference to the element to get the property on
  9713. // name: String
  9714. // the name of the property to get.
  9715. // returns:
  9716. // the value of the requested property or its default value
  9717. //
  9718. // example:
  9719. // | // get the current value of the "foo" property on a node
  9720. // | dojo.getProp(dojo.byId("nodeId"), "foo");
  9721. // | // or we can just pass the id:
  9722. // | dojo.getProp("nodeId", "foo");
  9723. node = dom.byId(node);
  9724. var lc = name.toLowerCase(), propName = exports.names[lc] || name;
  9725. return node[propName]; // Anything
  9726. };
  9727. exports.set = function setProp(/*DOMNode|String*/ node, /*String|Object*/ name, /*String?*/ value){
  9728. // summary:
  9729. // Sets a property on an HTML element.
  9730. // description:
  9731. // Handles normalized setting of properties on DOM nodes.
  9732. //
  9733. // When passing functions as values, note that they will not be
  9734. // directly assigned to slots on the node, but rather the default
  9735. // behavior will be removed and the new behavior will be added
  9736. // using `dojo.connect()`, meaning that event handler properties
  9737. // will be normalized and that some caveats with regards to
  9738. // non-standard behaviors for onsubmit apply. Namely that you
  9739. // should cancel form submission using `dojo.stopEvent()` on the
  9740. // passed event object instead of returning a boolean value from
  9741. // the handler itself.
  9742. // node: DOMNode|String
  9743. // id or reference to the element to set the property on
  9744. // name: String|Object
  9745. // the name of the property to set, or a hash object to set
  9746. // multiple properties at once.
  9747. // value: String?
  9748. // The value to set for the property
  9749. // returns:
  9750. // the DOM node
  9751. //
  9752. // example:
  9753. // | // use prop() to set the tab index
  9754. // | dojo.setProp("nodeId", "tabIndex", 3);
  9755. // |
  9756. //
  9757. // example:
  9758. // Set multiple values at once, including event handlers:
  9759. // | dojo.setProp("formId", {
  9760. // | "foo": "bar",
  9761. // | "tabIndex": -1,
  9762. // | "method": "POST",
  9763. // | "onsubmit": function(e){
  9764. // | // stop submitting the form. Note that the IE behavior
  9765. // | // of returning true or false will have no effect here
  9766. // | // since our handler is connect()ed to the built-in
  9767. // | // onsubmit behavior and so we need to use
  9768. // | // dojo.stopEvent() to ensure that the submission
  9769. // | // doesn't proceed.
  9770. // | dojo.stopEvent(e);
  9771. // |
  9772. // | // submit the form with Ajax
  9773. // | dojo.xhrPost({ form: "formId" });
  9774. // | }
  9775. // | });
  9776. //
  9777. // example:
  9778. // Style is s special case: Only set with an object hash of styles
  9779. // | dojo.setProp("someNode",{
  9780. // | id:"bar",
  9781. // | style:{
  9782. // | width:"200px", height:"100px", color:"#000"
  9783. // | }
  9784. // | });
  9785. //
  9786. // example:
  9787. // Again, only set style as an object hash of styles:
  9788. // | var obj = { color:"#fff", backgroundColor:"#000" };
  9789. // | dojo.setProp("someNode", "style", obj);
  9790. // |
  9791. // | // though shorter to use `dojo.style()` in this case:
  9792. // | dojo.style("someNode", obj);
  9793. node = dom.byId(node);
  9794. var l = arguments.length;
  9795. if(l == 2 && typeof name != "string"){ // inline'd type check
  9796. // the object form of setter: the 2nd argument is a dictionary
  9797. for(var x in name){
  9798. exports.set(node, x, name[x]);
  9799. }
  9800. return node; // DomNode
  9801. }
  9802. var lc = name.toLowerCase(), propName = exports.names[lc] || name;
  9803. if(propName == "style" && typeof value != "string"){ // inline'd type check
  9804. // special case: setting a style
  9805. style.set(node, value);
  9806. return node; // DomNode
  9807. }
  9808. if(propName == "innerHTML"){
  9809. // special case: assigning HTML
  9810. // the hash lists elements with read-only innerHTML on IE
  9811. if(has("ie") && node.tagName.toLowerCase() in {col: 1, colgroup: 1,
  9812. table: 1, tbody: 1, tfoot: 1, thead: 1, tr: 1, title: 1}){
  9813. ctr.empty(node);
  9814. node.appendChild(ctr.toDom(value, node.ownerDocument));
  9815. }else{
  9816. node[propName] = value;
  9817. }
  9818. return node; // DomNode
  9819. }
  9820. if(lang.isFunction(value)){
  9821. // special case: assigning an event handler
  9822. // clobber if we can
  9823. var attrId = node[_attrId];
  9824. if(!attrId){
  9825. attrId = _ctr++;
  9826. node[_attrId] = attrId;
  9827. }
  9828. if(!_evtHdlrMap[attrId]){
  9829. _evtHdlrMap[attrId] = {};
  9830. }
  9831. var h = _evtHdlrMap[attrId][propName];
  9832. if(h){
  9833. //h.remove();
  9834. conn.disconnect(h);
  9835. }else{
  9836. try{
  9837. delete node[propName];
  9838. }catch(e){}
  9839. }
  9840. // ensure that event objects are normalized, etc.
  9841. if(value){
  9842. //_evtHdlrMap[attrId][propName] = on(node, propName, value);
  9843. _evtHdlrMap[attrId][propName] = conn.connect(node, propName, value);
  9844. }else{
  9845. node[propName] = null;
  9846. }
  9847. return node; // DomNode
  9848. }
  9849. node[propName] = value;
  9850. return node; // DomNode
  9851. };
  9852. });
  9853. },
  9854. 'dojo/when':function(){
  9855. define([
  9856. "./Deferred",
  9857. "./promise/Promise"
  9858. ], function(Deferred, Promise){
  9859. "use strict";
  9860. // module:
  9861. // dojo/when
  9862. return function when(valueOrPromise, callback, errback, progback){
  9863. // summary:
  9864. // Transparently applies callbacks to values and/or promises.
  9865. // description:
  9866. // Accepts promises but also transparently handles non-promises. If no
  9867. // callbacks are provided returns a promise, regardless of the initial
  9868. // value. Foreign promises are converted.
  9869. //
  9870. // If callbacks are provided and the initial value is not a promise,
  9871. // the callback is executed immediately with no error handling. Returns
  9872. // a promise if the initial value is a promise, or the result of the
  9873. // callback otherwise.
  9874. // valueOrPromise:
  9875. // Either a regular value or an object with a `then()` method that
  9876. // follows the Promises/A specification.
  9877. // callback: Function?
  9878. // Callback to be invoked when the promise is resolved, or a non-promise
  9879. // is received.
  9880. // errback: Function?
  9881. // Callback to be invoked when the promise is rejected.
  9882. // progback: Function?
  9883. // Callback to be invoked when the promise emits a progress update.
  9884. // returns: dojo/promise/Promise
  9885. // Promise, or if a callback is provided, the result of the callback.
  9886. var receivedPromise = valueOrPromise && typeof valueOrPromise.then === "function";
  9887. var nativePromise = receivedPromise && valueOrPromise instanceof Promise;
  9888. if(!receivedPromise){
  9889. if(callback){
  9890. return callback(valueOrPromise);
  9891. }else{
  9892. return new Deferred().resolve(valueOrPromise);
  9893. }
  9894. }else if(!nativePromise){
  9895. var deferred = new Deferred(valueOrPromise.cancel);
  9896. valueOrPromise.then(deferred.resolve, deferred.reject, deferred.progress);
  9897. valueOrPromise = deferred.promise;
  9898. }
  9899. if(callback || errback || progback){
  9900. return valueOrPromise.then(callback, errback, progback);
  9901. }
  9902. return valueOrPromise;
  9903. };
  9904. });
  9905. },
  9906. 'dojo/dom-attr':function(){
  9907. define(["exports", "./sniff", "./_base/lang", "./dom", "./dom-style", "./dom-prop"],
  9908. function(exports, has, lang, dom, style, prop){
  9909. // module:
  9910. // dojo/dom-attr
  9911. // summary:
  9912. // This module defines the core dojo DOM attributes API.
  9913. // TODOC: summary not showing up in output see https://github.com/csnover/js-doc-parse/issues/42
  9914. // =============================
  9915. // Element attribute Functions
  9916. // =============================
  9917. // This module will be obsolete soon. Use dojo/prop instead.
  9918. // dojo.attr() should conform to http://www.w3.org/TR/DOM-Level-2-Core/
  9919. // attribute-related functions (to be obsolete soon)
  9920. var forcePropNames = {
  9921. innerHTML: 1,
  9922. className: 1,
  9923. htmlFor: has("ie"),
  9924. value: 1
  9925. },
  9926. attrNames = {
  9927. // original attribute names
  9928. classname: "class",
  9929. htmlfor: "for",
  9930. // for IE
  9931. tabindex: "tabIndex",
  9932. readonly: "readOnly"
  9933. };
  9934. function _hasAttr(node, name){
  9935. var attr = node.getAttributeNode && node.getAttributeNode(name);
  9936. return attr && attr.specified; // Boolean
  9937. }
  9938. // There is a difference in the presence of certain properties and their default values
  9939. // between browsers. For example, on IE "disabled" is present on all elements,
  9940. // but it is value is "false"; "tabIndex" of <div> returns 0 by default on IE, yet other browsers
  9941. // can return -1.
  9942. exports.has = function hasAttr(/*DOMNode|String*/ node, /*String*/ name){
  9943. // summary:
  9944. // Returns true if the requested attribute is specified on the
  9945. // given element, and false otherwise.
  9946. // node: DOMNode|String
  9947. // id or reference to the element to check
  9948. // name: String
  9949. // the name of the attribute
  9950. // returns: Boolean
  9951. // true if the requested attribute is specified on the
  9952. // given element, and false otherwise
  9953. var lc = name.toLowerCase();
  9954. return forcePropNames[prop.names[lc] || name] || _hasAttr(dom.byId(node), attrNames[lc] || name); // Boolean
  9955. };
  9956. exports.get = function getAttr(/*DOMNode|String*/ node, /*String*/ name){
  9957. // summary:
  9958. // Gets an attribute on an HTML element.
  9959. // description:
  9960. // Handles normalized getting of attributes on DOM Nodes.
  9961. // node: DOMNode|String
  9962. // id or reference to the element to get the attribute on
  9963. // name: String
  9964. // the name of the attribute to get.
  9965. // returns:
  9966. // the value of the requested attribute or null if that attribute does not have a specified or
  9967. // default value;
  9968. //
  9969. // example:
  9970. // | // get the current value of the "foo" attribute on a node
  9971. // | dojo.getAttr(dojo.byId("nodeId"), "foo");
  9972. // | // or we can just pass the id:
  9973. // | dojo.getAttr("nodeId", "foo");
  9974. node = dom.byId(node);
  9975. var lc = name.toLowerCase(),
  9976. propName = prop.names[lc] || name,
  9977. forceProp = forcePropNames[propName],
  9978. value = node[propName]; // should we access this attribute via a property or via getAttribute()?
  9979. if(forceProp && typeof value != "undefined"){
  9980. // node's property
  9981. return value; // Anything
  9982. }
  9983. if(propName != "href" && (typeof value == "boolean" || lang.isFunction(value))){
  9984. // node's property
  9985. return value; // Anything
  9986. }
  9987. // node's attribute
  9988. // we need _hasAttr() here to guard against IE returning a default value
  9989. var attrName = attrNames[lc] || name;
  9990. return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
  9991. };
  9992. exports.set = function setAttr(/*DOMNode|String*/ node, /*String|Object*/ name, /*String?*/ value){
  9993. // summary:
  9994. // Sets an attribute on an HTML element.
  9995. // description:
  9996. // Handles normalized setting of attributes on DOM Nodes.
  9997. //
  9998. // When passing functions as values, note that they will not be
  9999. // directly assigned to slots on the node, but rather the default
  10000. // behavior will be removed and the new behavior will be added
  10001. // using `dojo.connect()`, meaning that event handler properties
  10002. // will be normalized and that some caveats with regards to
  10003. // non-standard behaviors for onsubmit apply. Namely that you
  10004. // should cancel form submission using `dojo.stopEvent()` on the
  10005. // passed event object instead of returning a boolean value from
  10006. // the handler itself.
  10007. // node: DOMNode|String
  10008. // id or reference to the element to set the attribute on
  10009. // name: String|Object
  10010. // the name of the attribute to set, or a hash of key-value pairs to set.
  10011. // value: String?
  10012. // the value to set for the attribute, if the name is a string.
  10013. // returns:
  10014. // the DOM node
  10015. //
  10016. // example:
  10017. // | // use attr() to set the tab index
  10018. // | dojo.setAttr("nodeId", "tabIndex", 3);
  10019. //
  10020. // example:
  10021. // Set multiple values at once, including event handlers:
  10022. // | dojo.setAttr("formId", {
  10023. // | "foo": "bar",
  10024. // | "tabIndex": -1,
  10025. // | "method": "POST",
  10026. // | "onsubmit": function(e){
  10027. // | // stop submitting the form. Note that the IE behavior
  10028. // | // of returning true or false will have no effect here
  10029. // | // since our handler is connect()ed to the built-in
  10030. // | // onsubmit behavior and so we need to use
  10031. // | // dojo.stopEvent() to ensure that the submission
  10032. // | // doesn't proceed.
  10033. // | dojo.stopEvent(e);
  10034. // |
  10035. // | // submit the form with Ajax
  10036. // | dojo.xhrPost({ form: "formId" });
  10037. // | }
  10038. // | });
  10039. //
  10040. // example:
  10041. // Style is s special case: Only set with an object hash of styles
  10042. // | dojo.setAttr("someNode",{
  10043. // | id:"bar",
  10044. // | style:{
  10045. // | width:"200px", height:"100px", color:"#000"
  10046. // | }
  10047. // | });
  10048. //
  10049. // example:
  10050. // Again, only set style as an object hash of styles:
  10051. // | var obj = { color:"#fff", backgroundColor:"#000" };
  10052. // | dojo.setAttr("someNode", "style", obj);
  10053. // |
  10054. // | // though shorter to use `dojo.style()` in this case:
  10055. // | dojo.setStyle("someNode", obj);
  10056. node = dom.byId(node);
  10057. if(arguments.length == 2){ // inline'd type check
  10058. // the object form of setter: the 2nd argument is a dictionary
  10059. for(var x in name){
  10060. exports.set(node, x, name[x]);
  10061. }
  10062. return node; // DomNode
  10063. }
  10064. var lc = name.toLowerCase(),
  10065. propName = prop.names[lc] || name,
  10066. forceProp = forcePropNames[propName];
  10067. if(propName == "style" && typeof value != "string"){ // inline'd type check
  10068. // special case: setting a style
  10069. style.set(node, value);
  10070. return node; // DomNode
  10071. }
  10072. if(forceProp || typeof value == "boolean" || lang.isFunction(value)){
  10073. return prop.set(node, name, value);
  10074. }
  10075. // node's attribute
  10076. node.setAttribute(attrNames[lc] || name, value);
  10077. return node; // DomNode
  10078. };
  10079. exports.remove = function removeAttr(/*DOMNode|String*/ node, /*String*/ name){
  10080. // summary:
  10081. // Removes an attribute from an HTML element.
  10082. // node: DOMNode|String
  10083. // id or reference to the element to remove the attribute from
  10084. // name: String
  10085. // the name of the attribute to remove
  10086. dom.byId(node).removeAttribute(attrNames[name.toLowerCase()] || name);
  10087. };
  10088. exports.getNodeProp = function getNodeProp(/*DomNode|String*/ node, /*String*/ name){
  10089. // summary:
  10090. // Returns an effective value of a property or an attribute.
  10091. // node: DOMNode|String
  10092. // id or reference to the element to remove the attribute from
  10093. // name: String
  10094. // the name of the attribute
  10095. // returns:
  10096. // the value of the attribute
  10097. node = dom.byId(node);
  10098. var lc = name.toLowerCase(), propName = prop.names[lc] || name;
  10099. if((propName in node) && propName != "href"){
  10100. // node's property
  10101. return node[propName]; // Anything
  10102. }
  10103. // node's attribute
  10104. var attrName = attrNames[lc] || name;
  10105. return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
  10106. };
  10107. });
  10108. },
  10109. 'dojo/dom-construct':function(){
  10110. define(["exports", "./_base/kernel", "./sniff", "./_base/window", "./dom", "./dom-attr", "./on"],
  10111. function(exports, dojo, has, win, dom, attr, on){
  10112. // module:
  10113. // dojo/dom-construct
  10114. // summary:
  10115. // This module defines the core dojo DOM construction API.
  10116. // TODOC: summary not showing up in output, see https://github.com/csnover/js-doc-parse/issues/42
  10117. // support stuff for toDom()
  10118. var tagWrap = {
  10119. option: ["select"],
  10120. tbody: ["table"],
  10121. thead: ["table"],
  10122. tfoot: ["table"],
  10123. tr: ["table", "tbody"],
  10124. td: ["table", "tbody", "tr"],
  10125. th: ["table", "thead", "tr"],
  10126. legend: ["fieldset"],
  10127. caption: ["table"],
  10128. colgroup: ["table"],
  10129. col: ["table", "colgroup"],
  10130. li: ["ul"]
  10131. },
  10132. reTag = /<\s*([\w\:]+)/,
  10133. masterNode = {}, masterNum = 0,
  10134. masterName = "__" + dojo._scopeName + "ToDomId";
  10135. // generate start/end tag strings to use
  10136. // for the injection for each special tag wrap case.
  10137. for(var param in tagWrap){
  10138. if(tagWrap.hasOwnProperty(param)){
  10139. var tw = tagWrap[param];
  10140. tw.pre = param == "option" ? '<select multiple="multiple">' : "<" + tw.join("><") + ">";
  10141. tw.post = "</" + tw.reverse().join("></") + ">";
  10142. // the last line is destructive: it reverses the array,
  10143. // but we don't care at this point
  10144. }
  10145. }
  10146. function _insertBefore(/*DomNode*/ node, /*DomNode*/ ref){
  10147. var parent = ref.parentNode;
  10148. if(parent){
  10149. parent.insertBefore(node, ref);
  10150. }
  10151. }
  10152. function _insertAfter(/*DomNode*/ node, /*DomNode*/ ref){
  10153. // summary:
  10154. // Try to insert node after ref
  10155. var parent = ref.parentNode;
  10156. if(parent){
  10157. if(parent.lastChild == ref){
  10158. parent.appendChild(node);
  10159. }else{
  10160. parent.insertBefore(node, ref.nextSibling);
  10161. }
  10162. }
  10163. }
  10164. var _destroyContainer = null,
  10165. _destroyDoc;
  10166. on(window, "unload", function(){
  10167. _destroyContainer = null; //prevent IE leak
  10168. });
  10169. exports.toDom = function toDom(frag, doc){
  10170. // summary:
  10171. // instantiates an HTML fragment returning the corresponding DOM.
  10172. // frag: String
  10173. // the HTML fragment
  10174. // doc: DocumentNode?
  10175. // optional document to use when creating DOM nodes, defaults to
  10176. // dojo.doc if not specified.
  10177. // returns:
  10178. // Document fragment, unless it's a single node in which case it returns the node itself
  10179. // example:
  10180. // Create a table row:
  10181. // | var tr = dojo.toDom("<tr><td>First!</td></tr>");
  10182. doc = doc || win.doc;
  10183. var masterId = doc[masterName];
  10184. if(!masterId){
  10185. doc[masterName] = masterId = ++masterNum + "";
  10186. masterNode[masterId] = doc.createElement("div");
  10187. }
  10188. // make sure the frag is a string.
  10189. frag += "";
  10190. // find the starting tag, and get node wrapper
  10191. var match = frag.match(reTag),
  10192. tag = match ? match[1].toLowerCase() : "",
  10193. master = masterNode[masterId],
  10194. wrap, i, fc, df;
  10195. if(match && tagWrap[tag]){
  10196. wrap = tagWrap[tag];
  10197. master.innerHTML = wrap.pre + frag + wrap.post;
  10198. for(i = wrap.length; i; --i){
  10199. master = master.firstChild;
  10200. }
  10201. }else{
  10202. master.innerHTML = frag;
  10203. }
  10204. // one node shortcut => return the node itself
  10205. if(master.childNodes.length == 1){
  10206. return master.removeChild(master.firstChild); // DOMNode
  10207. }
  10208. // return multiple nodes as a document fragment
  10209. df = doc.createDocumentFragment();
  10210. while(fc = master.firstChild){ // intentional assignment
  10211. df.appendChild(fc);
  10212. }
  10213. return df; // DocumentFragment
  10214. };
  10215. exports.place = function place(/*DOMNode|String*/ node, /*DOMNode|String*/ refNode, /*String|Number?*/ position){
  10216. // summary:
  10217. // Attempt to insert node into the DOM, choosing from various positioning options.
  10218. // Returns the first argument resolved to a DOM node.
  10219. // node: DOMNode|String
  10220. // id or node reference, or HTML fragment starting with "<" to place relative to refNode
  10221. // refNode: DOMNode|String
  10222. // id or node reference to use as basis for placement
  10223. // position: String|Number?
  10224. // string noting the position of node relative to refNode or a
  10225. // number indicating the location in the childNodes collection of refNode.
  10226. // Accepted string values are:
  10227. //
  10228. // - before
  10229. // - after
  10230. // - replace
  10231. // - only
  10232. // - first
  10233. // - last
  10234. //
  10235. // "first" and "last" indicate positions as children of refNode, "replace" replaces refNode,
  10236. // "only" replaces all children. position defaults to "last" if not specified
  10237. // returns: DOMNode
  10238. // Returned values is the first argument resolved to a DOM node.
  10239. //
  10240. // .place() is also a method of `dojo/NodeList`, allowing `dojo.query` node lookups.
  10241. // example:
  10242. // Place a node by string id as the last child of another node by string id:
  10243. // | dojo.place("someNode", "anotherNode");
  10244. // example:
  10245. // Place a node by string id before another node by string id
  10246. // | dojo.place("someNode", "anotherNode", "before");
  10247. // example:
  10248. // Create a Node, and place it in the body element (last child):
  10249. // | dojo.place("<div></div>", dojo.body());
  10250. // example:
  10251. // Put a new LI as the first child of a list by id:
  10252. // | dojo.place("<li></li>", "someUl", "first");
  10253. refNode = dom.byId(refNode);
  10254. if(typeof node == "string"){ // inline'd type check
  10255. node = /^\s*</.test(node) ? exports.toDom(node, refNode.ownerDocument) : dom.byId(node);
  10256. }
  10257. if(typeof position == "number"){ // inline'd type check
  10258. var cn = refNode.childNodes;
  10259. if(!cn.length || cn.length <= position){
  10260. refNode.appendChild(node);
  10261. }else{
  10262. _insertBefore(node, cn[position < 0 ? 0 : position]);
  10263. }
  10264. }else{
  10265. switch(position){
  10266. case "before":
  10267. _insertBefore(node, refNode);
  10268. break;
  10269. case "after":
  10270. _insertAfter(node, refNode);
  10271. break;
  10272. case "replace":
  10273. refNode.parentNode.replaceChild(node, refNode);
  10274. break;
  10275. case "only":
  10276. exports.empty(refNode);
  10277. refNode.appendChild(node);
  10278. break;
  10279. case "first":
  10280. if(refNode.firstChild){
  10281. _insertBefore(node, refNode.firstChild);
  10282. break;
  10283. }
  10284. // else fallthrough...
  10285. default: // aka: last
  10286. refNode.appendChild(node);
  10287. }
  10288. }
  10289. return node; // DomNode
  10290. };
  10291. exports.create = function create(/*DOMNode|String*/ tag, /*Object*/ attrs, /*DOMNode|String?*/ refNode, /*String?*/ pos){
  10292. // summary:
  10293. // Create an element, allowing for optional attribute decoration
  10294. // and placement.
  10295. // description:
  10296. // A DOM Element creation function. A shorthand method for creating a node or
  10297. // a fragment, and allowing for a convenient optional attribute setting step,
  10298. // as well as an optional DOM placement reference.
  10299. //
  10300. // Attributes are set by passing the optional object through `dojo.setAttr`.
  10301. // See `dojo.setAttr` for noted caveats and nuances, and API if applicable.
  10302. //
  10303. // Placement is done via `dojo.place`, assuming the new node to be the action
  10304. // node, passing along the optional reference node and position.
  10305. // tag: DOMNode|String
  10306. // A string of the element to create (eg: "div", "a", "p", "li", "script", "br"),
  10307. // or an existing DOM node to process.
  10308. // attrs: Object
  10309. // An object-hash of attributes to set on the newly created node.
  10310. // Can be null, if you don't want to set any attributes/styles.
  10311. // See: `dojo.setAttr` for a description of available attributes.
  10312. // refNode: DOMNode|String?
  10313. // Optional reference node. Used by `dojo.place` to place the newly created
  10314. // node somewhere in the dom relative to refNode. Can be a DomNode reference
  10315. // or String ID of a node.
  10316. // pos: String?
  10317. // Optional positional reference. Defaults to "last" by way of `dojo.place`,
  10318. // though can be set to "first","after","before","last", "replace" or "only"
  10319. // to further control the placement of the new node relative to the refNode.
  10320. // 'refNode' is required if a 'pos' is specified.
  10321. // example:
  10322. // Create a DIV:
  10323. // | var n = dojo.create("div");
  10324. //
  10325. // example:
  10326. // Create a DIV with content:
  10327. // | var n = dojo.create("div", { innerHTML:"<p>hi</p>" });
  10328. //
  10329. // example:
  10330. // Place a new DIV in the BODY, with no attributes set
  10331. // | var n = dojo.create("div", null, dojo.body());
  10332. //
  10333. // example:
  10334. // Create an UL, and populate it with LI's. Place the list as the first-child of a
  10335. // node with id="someId":
  10336. // | var ul = dojo.create("ul", null, "someId", "first");
  10337. // | var items = ["one", "two", "three", "four"];
  10338. // | dojo.forEach(items, function(data){
  10339. // | dojo.create("li", { innerHTML: data }, ul);
  10340. // | });
  10341. //
  10342. // example:
  10343. // Create an anchor, with an href. Place in BODY:
  10344. // | dojo.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body());
  10345. //
  10346. // example:
  10347. // Create a `dojo/NodeList()` from a new element (for syntactic sugar):
  10348. // | dojo.query(dojo.create('div'))
  10349. // | .addClass("newDiv")
  10350. // | .onclick(function(e){ console.log('clicked', e.target) })
  10351. // | .place("#someNode"); // redundant, but cleaner.
  10352. var doc = win.doc;
  10353. if(refNode){
  10354. refNode = dom.byId(refNode);
  10355. doc = refNode.ownerDocument;
  10356. }
  10357. if(typeof tag == "string"){ // inline'd type check
  10358. tag = doc.createElement(tag);
  10359. }
  10360. if(attrs){ attr.set(tag, attrs); }
  10361. if(refNode){ exports.place(tag, refNode, pos); }
  10362. return tag; // DomNode
  10363. };
  10364. exports.empty =
  10365. has("ie") ? function(node){
  10366. node = dom.byId(node);
  10367. for(var c; c = node.lastChild;){ // intentional assignment
  10368. exports.destroy(c);
  10369. }
  10370. } :
  10371. function(node){
  10372. dom.byId(node).innerHTML = "";
  10373. };
  10374. /*=====
  10375. exports.empty = function(node){
  10376. // summary:
  10377. // safely removes all children of the node.
  10378. // node: DOMNode|String
  10379. // a reference to a DOM node or an id.
  10380. // example:
  10381. // Destroy node's children byId:
  10382. // | dojo.empty("someId");
  10383. //
  10384. // example:
  10385. // Destroy all nodes' children in a list by reference:
  10386. // | dojo.query(".someNode").forEach(dojo.empty);
  10387. };
  10388. =====*/
  10389. exports.destroy = function destroy(/*DOMNode|String*/ node){
  10390. // summary:
  10391. // Removes a node from its parent, clobbering it and all of its
  10392. // children.
  10393. //
  10394. // description:
  10395. // Removes a node from its parent, clobbering it and all of its
  10396. // children. Function only works with DomNodes, and returns nothing.
  10397. //
  10398. // node: DOMNode|String
  10399. // A String ID or DomNode reference of the element to be destroyed
  10400. //
  10401. // example:
  10402. // Destroy a node byId:
  10403. // | dojo.destroy("someId");
  10404. //
  10405. // example:
  10406. // Destroy all nodes in a list by reference:
  10407. // | dojo.query(".someNode").forEach(dojo.destroy);
  10408. node = dom.byId(node);
  10409. try{
  10410. var doc = node.ownerDocument;
  10411. // cannot use _destroyContainer.ownerDocument since this can throw an exception on IE
  10412. if(!_destroyContainer || _destroyDoc != doc){
  10413. _destroyContainer = doc.createElement("div");
  10414. _destroyDoc = doc;
  10415. }
  10416. _destroyContainer.appendChild(node.parentNode ? node.parentNode.removeChild(node) : node);
  10417. // NOTE: see http://trac.dojotoolkit.org/ticket/2931. This may be a bug and not a feature
  10418. _destroyContainer.innerHTML = "";
  10419. }catch(e){
  10420. /* squelch */
  10421. }
  10422. };
  10423. });
  10424. },
  10425. 'dojo/request/xhr':function(){
  10426. define("dojo/request/xhr", [
  10427. '../errors/RequestError',
  10428. './watch',
  10429. './handlers',
  10430. './util',
  10431. '../has'/*=====,
  10432. '../request',
  10433. '../_base/declare' =====*/
  10434. ], function(RequestError, watch, handlers, util, has/*=====, request, declare =====*/){
  10435. has.add('native-xhr', function(){
  10436. // if true, the environment has a native XHR implementation
  10437. return typeof XMLHttpRequest !== 'undefined';
  10438. });
  10439. has.add('dojo-force-activex-xhr', function(){
  10440. return has('activex') && !document.addEventListener && window.location.protocol === 'file:';
  10441. });
  10442. has.add('native-xhr2', function(){
  10443. if(!has('native-xhr')){ return; }
  10444. var x = new XMLHttpRequest();
  10445. return typeof x['addEventListener'] !== 'undefined' &&
  10446. (typeof opera === 'undefined' || typeof x['upload'] !== 'undefined');
  10447. });
  10448. has.add('native-formdata', function(){
  10449. // if true, the environment has a native FormData implementation
  10450. return typeof FormData === 'function';
  10451. });
  10452. function handleResponse(response, error){
  10453. var _xhr = response.xhr;
  10454. response.status = response.xhr.status;
  10455. response.text = _xhr.responseText;
  10456. if(response.options.handleAs === 'xml'){
  10457. response.data = _xhr.responseXML;
  10458. }
  10459. if(!error){
  10460. try{
  10461. handlers(response);
  10462. }catch(e){
  10463. error = e;
  10464. }
  10465. }
  10466. if(error){
  10467. this.reject(error);
  10468. }else if(util.checkStatus(_xhr.status)){
  10469. this.resolve(response);
  10470. }else{
  10471. error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
  10472. this.reject(error);
  10473. }
  10474. }
  10475. var isValid, isReady, addListeners, cancel;
  10476. if(has('native-xhr2')){
  10477. // Any platform with XHR2 will only use the watch mechanism for timeout.
  10478. isValid = function(response){
  10479. // summary:
  10480. // Check to see if the request should be taken out of the watch queue
  10481. return !this.isFulfilled();
  10482. };
  10483. cancel = function(dfd, response){
  10484. // summary:
  10485. // Canceler for deferred
  10486. response.xhr.abort();
  10487. };
  10488. addListeners = function(_xhr, dfd, response){
  10489. // summary:
  10490. // Adds event listeners to the XMLHttpRequest object
  10491. function onLoad(evt){
  10492. dfd.handleResponse(response);
  10493. }
  10494. function onError(evt){
  10495. var _xhr = evt.target;
  10496. var error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
  10497. dfd.handleResponse(response, error);
  10498. }
  10499. function onProgress(evt){
  10500. if(evt.lengthComputable){
  10501. response.loaded = evt.loaded;
  10502. response.total = evt.total;
  10503. dfd.progress(response);
  10504. }
  10505. }
  10506. _xhr.addEventListener('load', onLoad, false);
  10507. _xhr.addEventListener('error', onError, false);
  10508. _xhr.addEventListener('progress', onProgress, false);
  10509. return function(){
  10510. _xhr.removeEventListener('load', onLoad, false);
  10511. _xhr.removeEventListener('error', onError, false);
  10512. _xhr.removeEventListener('progress', onProgress, false);
  10513. };
  10514. };
  10515. }else{
  10516. isValid = function(response){
  10517. return response.xhr.readyState; //boolean
  10518. };
  10519. isReady = function(response){
  10520. return 4 === response.xhr.readyState; //boolean
  10521. };
  10522. cancel = function(dfd, response){
  10523. // summary:
  10524. // canceller function for util.deferred call.
  10525. var xhr = response.xhr;
  10526. var _at = typeof xhr.abort;
  10527. if(_at === 'function' || _at === 'object' || _at === 'unknown'){
  10528. xhr.abort();
  10529. }
  10530. };
  10531. }
  10532. var undefined,
  10533. defaultOptions = {
  10534. data: null,
  10535. query: null,
  10536. sync: false,
  10537. method: 'GET',
  10538. headers: {
  10539. 'Content-Type': 'application/x-www-form-urlencoded'
  10540. }
  10541. };
  10542. function xhr(url, options, returnDeferred){
  10543. var response = util.parseArgs(
  10544. url,
  10545. util.deepCreate(defaultOptions, options),
  10546. has('native-formdata') && options && options.data && options.data instanceof FormData
  10547. );
  10548. url = response.url;
  10549. options = response.options;
  10550. var remover,
  10551. last = function(){
  10552. remover && remover();
  10553. };
  10554. //Make the Deferred object for this xhr request.
  10555. var dfd = util.deferred(
  10556. response,
  10557. cancel,
  10558. isValid,
  10559. isReady,
  10560. handleResponse,
  10561. last
  10562. );
  10563. var _xhr = response.xhr = xhr._create();
  10564. if(!_xhr){
  10565. // If XHR factory somehow returns nothings,
  10566. // cancel the deferred.
  10567. dfd.cancel(new RequestError('XHR was not created'));
  10568. return returnDeferred ? dfd : dfd.promise;
  10569. }
  10570. response.getHeader = function(headerName){
  10571. return this.xhr.getResponseHeader(headerName);
  10572. };
  10573. if(addListeners){
  10574. remover = addListeners(_xhr, dfd, response);
  10575. }
  10576. var data = options.data,
  10577. async = !options.sync,
  10578. method = options.method;
  10579. try{
  10580. // IE6 won't let you call apply() on the native function.
  10581. _xhr.open(method, url, async, options.user || undefined, options.password || undefined);
  10582. if(options.withCredentials){
  10583. _xhr.withCredentials = options.withCredentials;
  10584. }
  10585. var headers = options.headers,
  10586. contentType;
  10587. if(headers){
  10588. for(var hdr in headers){
  10589. if(hdr.toLowerCase() === 'content-type'){
  10590. contentType = headers[hdr];
  10591. }else if(headers[hdr]){
  10592. //Only add header if it has a value. This allows for instance, skipping
  10593. //insertion of X-Requested-With by specifying empty value.
  10594. _xhr.setRequestHeader(hdr, headers[hdr]);
  10595. }
  10596. }
  10597. }
  10598. if(contentType && contentType !== false){
  10599. _xhr.setRequestHeader('Content-Type', contentType);
  10600. }
  10601. if(!headers || !('X-Requested-With' in headers)){
  10602. _xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  10603. }
  10604. if(util.notify){
  10605. util.notify.emit('send', response, dfd.promise.cancel);
  10606. }
  10607. _xhr.send(data);
  10608. }catch(e){
  10609. dfd.reject(e);
  10610. }
  10611. watch(dfd);
  10612. _xhr = null;
  10613. return returnDeferred ? dfd : dfd.promise;
  10614. }
  10615. /*=====
  10616. xhr = function(url, options){
  10617. // summary:
  10618. // Sends a request using XMLHttpRequest with the given URL and options.
  10619. // url: String
  10620. // URL to request
  10621. // options: dojo/request/xhr.__Options?
  10622. // Options for the request.
  10623. // returns: dojo/request.__Promise
  10624. };
  10625. xhr.__BaseOptions = declare(request.__BaseOptions, {
  10626. // sync: Boolean?
  10627. // Whether to make a synchronous request or not. Default
  10628. // is `false` (asynchronous).
  10629. // data: String|Object|FormData?
  10630. // Data to transfer. This is ignored for GET and DELETE
  10631. // requests.
  10632. // headers: Object?
  10633. // Headers to use for the request.
  10634. // user: String?
  10635. // Username to use during the request.
  10636. // password: String?
  10637. // Password to use during the request.
  10638. // withCredentials: Boolean?
  10639. // For cross-site requests, whether to send credentials
  10640. // or not.
  10641. });
  10642. xhr.__MethodOptions = declare(null, {
  10643. // method: String?
  10644. // The HTTP method to use to make the request. Must be
  10645. // uppercase. Default is `"GET"`.
  10646. });
  10647. xhr.__Options = declare([xhr.__BaseOptions, xhr.__MethodOptions]);
  10648. xhr.get = function(url, options){
  10649. // summary:
  10650. // Send an HTTP GET request using XMLHttpRequest with the given URL and options.
  10651. // url: String
  10652. // URL to request
  10653. // options: dojo/request/xhr.__BaseOptions?
  10654. // Options for the request.
  10655. // returns: dojo/request.__Promise
  10656. };
  10657. xhr.post = function(url, options){
  10658. // summary:
  10659. // Send an HTTP POST request using XMLHttpRequest with the given URL and options.
  10660. // url: String
  10661. // URL to request
  10662. // options: dojo/request/xhr.__BaseOptions?
  10663. // Options for the request.
  10664. // returns: dojo/request.__Promise
  10665. };
  10666. xhr.put = function(url, options){
  10667. // summary:
  10668. // Send an HTTP PUT request using XMLHttpRequest with the given URL and options.
  10669. // url: String
  10670. // URL to request
  10671. // options: dojo/request/xhr.__BaseOptions?
  10672. // Options for the request.
  10673. // returns: dojo/request.__Promise
  10674. };
  10675. xhr.del = function(url, options){
  10676. // summary:
  10677. // Send an HTTP DELETE request using XMLHttpRequest with the given URL and options.
  10678. // url: String
  10679. // URL to request
  10680. // options: dojo/request/xhr.__BaseOptions?
  10681. // Options for the request.
  10682. // returns: dojo/request.__Promise
  10683. };
  10684. =====*/
  10685. xhr._create = function(){
  10686. // summary:
  10687. // does the work of portably generating a new XMLHTTPRequest object.
  10688. throw new Error('XMLHTTP not available');
  10689. };
  10690. if(has('native-xhr') && !has('dojo-force-activex-xhr')){
  10691. xhr._create = function(){
  10692. return new XMLHttpRequest();
  10693. };
  10694. }else if(has('activex')){
  10695. try{
  10696. new ActiveXObject('Msxml2.XMLHTTP');
  10697. xhr._create = function(){
  10698. return new ActiveXObject('Msxml2.XMLHTTP');
  10699. };
  10700. }catch(e){
  10701. try{
  10702. new ActiveXObject('Microsoft.XMLHTTP');
  10703. xhr._create = function(){
  10704. return new ActiveXObject('Microsoft.XMLHTTP');
  10705. };
  10706. }catch(e){}
  10707. }
  10708. }
  10709. util.addCommonMethods(xhr);
  10710. return xhr;
  10711. });
  10712. },
  10713. 'dojo/text':function(){
  10714. define(["./_base/kernel", "require", "./has", "./_base/xhr"], function(dojo, require, has, xhr){
  10715. // module:
  10716. // dojo/text
  10717. var getText;
  10718. if( 1 ){
  10719. getText= function(url, sync, load){
  10720. xhr("GET", {url: url, sync:!!sync, load: load, headers: dojo.config.textPluginHeaders || {}});
  10721. };
  10722. }else{
  10723. // TODOC: only works for dojo AMD loader
  10724. if(require.getText){
  10725. getText= require.getText;
  10726. }else{
  10727. console.error("dojo/text plugin failed to load because loader does not support getText");
  10728. }
  10729. }
  10730. var
  10731. theCache = {},
  10732. strip= function(text){
  10733. //Strips <?xml ...?> declarations so that external SVG and XML
  10734. //documents can be added to a document without worry. Also, if the string
  10735. //is an HTML document, only the part inside the body tag is returned.
  10736. if(text){
  10737. text= text.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, "");
  10738. var matches= text.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
  10739. if(matches){
  10740. text= matches[1];
  10741. }
  10742. }else{
  10743. text = "";
  10744. }
  10745. return text;
  10746. },
  10747. notFound = {},
  10748. pending = {};
  10749. dojo.cache = function(/*String||Object*/module, /*String*/url, /*String||Object?*/value){
  10750. // summary:
  10751. // A getter and setter for storing the string content associated with the
  10752. // module and url arguments.
  10753. // description:
  10754. // If module is a string that contains slashes, then it is interpretted as a fully
  10755. // resolved path (typically a result returned by require.toUrl), and url should not be
  10756. // provided. This is the preferred signature. If module is a string that does not
  10757. // contain slashes, then url must also be provided and module and url are used to
  10758. // call `dojo.moduleUrl()` to generate a module URL. This signature is deprecated.
  10759. // If value is specified, the cache value for the moduleUrl will be set to
  10760. // that value. Otherwise, dojo.cache will fetch the moduleUrl and store it
  10761. // in its internal cache and return that cached value for the URL. To clear
  10762. // a cache value pass null for value. Since XMLHttpRequest (XHR) is used to fetch the
  10763. // the URL contents, only modules on the same domain of the page can use this capability.
  10764. // The build system can inline the cache values though, to allow for xdomain hosting.
  10765. // module: String||Object
  10766. // If a String with slashes, a fully resolved path; if a String without slashes, the
  10767. // module name to use for the base part of the URL, similar to module argument
  10768. // to `dojo.moduleUrl`. If an Object, something that has a .toString() method that
  10769. // generates a valid path for the cache item. For example, a dojo._Url object.
  10770. // url: String
  10771. // The rest of the path to append to the path derived from the module argument. If
  10772. // module is an object, then this second argument should be the "value" argument instead.
  10773. // value: String||Object?
  10774. // If a String, the value to use in the cache for the module/url combination.
  10775. // If an Object, it can have two properties: value and sanitize. The value property
  10776. // should be the value to use in the cache, and sanitize can be set to true or false,
  10777. // to indicate if XML declarations should be removed from the value and if the HTML
  10778. // inside a body tag in the value should be extracted as the real value. The value argument
  10779. // or the value property on the value argument are usually only used by the build system
  10780. // as it inlines cache content.
  10781. // example:
  10782. // To ask dojo.cache to fetch content and store it in the cache (the dojo["cache"] style
  10783. // of call is used to avoid an issue with the build system erroneously trying to intern
  10784. // this example. To get the build system to intern your dojo.cache calls, use the
  10785. // "dojo.cache" style of call):
  10786. // | //If template.html contains "<h1>Hello</h1>" that will be
  10787. // | //the value for the text variable.
  10788. // | var text = dojo["cache"]("my.module", "template.html");
  10789. // example:
  10790. // To ask dojo.cache to fetch content and store it in the cache, and sanitize the input
  10791. // (the dojo["cache"] style of call is used to avoid an issue with the build system
  10792. // erroneously trying to intern this example. To get the build system to intern your
  10793. // dojo.cache calls, use the "dojo.cache" style of call):
  10794. // | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
  10795. // | //text variable will contain just "<h1>Hello</h1>".
  10796. // | var text = dojo["cache"]("my.module", "template.html", {sanitize: true});
  10797. // example:
  10798. // Same example as previous, but demonstrates how an object can be passed in as
  10799. // the first argument, then the value argument can then be the second argument.
  10800. // | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
  10801. // | //text variable will contain just "<h1>Hello</h1>".
  10802. // | var text = dojo["cache"](new dojo._Url("my/module/template.html"), {sanitize: true});
  10803. // * (string string [value]) => (module, url, value)
  10804. // * (object [value]) => (module, value), url defaults to ""
  10805. //
  10806. // * if module is an object, then it must be convertable to a string
  10807. // * (module, url) module + (url ? ("/" + url) : "") must be a legal argument to require.toUrl
  10808. // * value may be a string or an object; if an object then may have the properties "value" and/or "sanitize"
  10809. var key;
  10810. if(typeof module=="string"){
  10811. if(/\//.test(module)){
  10812. // module is a version 1.7+ resolved path
  10813. key = module;
  10814. value = url;
  10815. }else{
  10816. // module is a version 1.6- argument to dojo.moduleUrl
  10817. key = require.toUrl(module.replace(/\./g, "/") + (url ? ("/" + url) : ""));
  10818. }
  10819. }else{
  10820. key = module + "";
  10821. value = url;
  10822. }
  10823. var
  10824. val = (value != undefined && typeof value != "string") ? value.value : value,
  10825. sanitize = value && value.sanitize;
  10826. if(typeof val == "string"){
  10827. //We have a string, set cache value
  10828. theCache[key] = val;
  10829. return sanitize ? strip(val) : val;
  10830. }else if(val === null){
  10831. //Remove cached value
  10832. delete theCache[key];
  10833. return null;
  10834. }else{
  10835. //Allow cache values to be empty strings. If key property does
  10836. //not exist, fetch it.
  10837. if(!(key in theCache)){
  10838. getText(key, true, function(text){
  10839. theCache[key]= text;
  10840. });
  10841. }
  10842. return sanitize ? strip(theCache[key]) : theCache[key];
  10843. }
  10844. };
  10845. return {
  10846. // summary:
  10847. // This module implements the dojo/text! plugin and the dojo.cache API.
  10848. // description:
  10849. // We choose to include our own plugin to leverage functionality already contained in dojo
  10850. // and thereby reduce the size of the plugin compared to various foreign loader implementations.
  10851. // Also, this allows foreign AMD loaders to be used without their plugins.
  10852. //
  10853. // CAUTION: this module is designed to optionally function synchronously to support the dojo v1.x synchronous
  10854. // loader. This feature is outside the scope of the CommonJS plugins specification.
  10855. // the dojo/text caches it's own resources because of dojo.cache
  10856. dynamic: true,
  10857. normalize: function(id, toAbsMid){
  10858. // id is something like (path may be relative):
  10859. //
  10860. // "path/to/text.html"
  10861. // "path/to/text.html!strip"
  10862. var parts= id.split("!"),
  10863. url= parts[0];
  10864. return (/^\./.test(url) ? toAbsMid(url) : url) + (parts[1] ? "!" + parts[1] : "");
  10865. },
  10866. load: function(id, require, load){
  10867. // id: String
  10868. // Path to the resource.
  10869. // require: Function
  10870. // Object that include the function toUrl with given id returns a valid URL from which to load the text.
  10871. // load: Function
  10872. // Callback function which will be called, when the loading finished.
  10873. // id is something like (path is always absolute):
  10874. //
  10875. // "path/to/text.html"
  10876. // "path/to/text.html!strip"
  10877. var
  10878. parts= id.split("!"),
  10879. stripFlag= parts.length>1,
  10880. absMid= parts[0],
  10881. url = require.toUrl(parts[0]),
  10882. requireCacheUrl = "url:" + url,
  10883. text = notFound,
  10884. finish = function(text){
  10885. load(stripFlag ? strip(text) : text);
  10886. };
  10887. if(absMid in theCache){
  10888. text = theCache[absMid];
  10889. }else if(requireCacheUrl in require.cache){
  10890. text = require.cache[requireCacheUrl];
  10891. }else if(url in theCache){
  10892. text = theCache[url];
  10893. }
  10894. if(text===notFound){
  10895. if(pending[url]){
  10896. pending[url].push(finish);
  10897. }else{
  10898. var pendingList = pending[url] = [finish];
  10899. getText(url, !require.async, function(text){
  10900. theCache[absMid]= theCache[url]= text;
  10901. for(var i = 0; i<pendingList.length;){
  10902. pendingList[i++](text);
  10903. }
  10904. delete pending[url];
  10905. });
  10906. }
  10907. }else{
  10908. finish(text);
  10909. }
  10910. }
  10911. };
  10912. });
  10913. },
  10914. 'dojo/keys':function(){
  10915. define("dojo/keys", ["./_base/kernel", "./sniff"], function(dojo, has){
  10916. // module:
  10917. // dojo/keys
  10918. return dojo.keys = {
  10919. // summary:
  10920. // Definitions for common key values. Client code should test keyCode against these named constants,
  10921. // as the actual codes can vary by browser.
  10922. BACKSPACE: 8,
  10923. TAB: 9,
  10924. CLEAR: 12,
  10925. ENTER: 13,
  10926. SHIFT: 16,
  10927. CTRL: 17,
  10928. ALT: 18,
  10929. META: has("webkit") ? 91 : 224, // the apple key on macs
  10930. PAUSE: 19,
  10931. CAPS_LOCK: 20,
  10932. ESCAPE: 27,
  10933. SPACE: 32,
  10934. PAGE_UP: 33,
  10935. PAGE_DOWN: 34,
  10936. END: 35,
  10937. HOME: 36,
  10938. LEFT_ARROW: 37,
  10939. UP_ARROW: 38,
  10940. RIGHT_ARROW: 39,
  10941. DOWN_ARROW: 40,
  10942. INSERT: 45,
  10943. DELETE: 46,
  10944. HELP: 47,
  10945. LEFT_WINDOW: 91,
  10946. RIGHT_WINDOW: 92,
  10947. SELECT: 93,
  10948. NUMPAD_0: 96,
  10949. NUMPAD_1: 97,
  10950. NUMPAD_2: 98,
  10951. NUMPAD_3: 99,
  10952. NUMPAD_4: 100,
  10953. NUMPAD_5: 101,
  10954. NUMPAD_6: 102,
  10955. NUMPAD_7: 103,
  10956. NUMPAD_8: 104,
  10957. NUMPAD_9: 105,
  10958. NUMPAD_MULTIPLY: 106,
  10959. NUMPAD_PLUS: 107,
  10960. NUMPAD_ENTER: 108,
  10961. NUMPAD_MINUS: 109,
  10962. NUMPAD_PERIOD: 110,
  10963. NUMPAD_DIVIDE: 111,
  10964. F1: 112,
  10965. F2: 113,
  10966. F3: 114,
  10967. F4: 115,
  10968. F5: 116,
  10969. F6: 117,
  10970. F7: 118,
  10971. F8: 119,
  10972. F9: 120,
  10973. F10: 121,
  10974. F11: 122,
  10975. F12: 123,
  10976. F13: 124,
  10977. F14: 125,
  10978. F15: 126,
  10979. NUM_LOCK: 144,
  10980. SCROLL_LOCK: 145,
  10981. UP_DPAD: 175,
  10982. DOWN_DPAD: 176,
  10983. LEFT_DPAD: 177,
  10984. RIGHT_DPAD: 178,
  10985. // virtual key mapping
  10986. copyKey: has("mac") && !has("air") ? (has("safari") ? 91 : 224 ) : 17
  10987. };
  10988. });
  10989. },
  10990. 'dojo/domReady':function(){
  10991. define(['./has'], function(has){
  10992. var global = this,
  10993. doc = document,
  10994. readyStates = { 'loaded': 1, 'complete': 1 },
  10995. fixReadyState = typeof doc.readyState != "string",
  10996. ready = !!readyStates[doc.readyState];
  10997. // For FF <= 3.5
  10998. if(fixReadyState){ doc.readyState = "loading"; }
  10999. if(!ready){
  11000. var readyQ = [], tests = [],
  11001. detectReady = function(evt){
  11002. evt = evt || global.event;
  11003. if(ready || (evt.type == "readystatechange" && !readyStates[doc.readyState])){ return; }
  11004. ready = 1;
  11005. // For FF <= 3.5
  11006. if(fixReadyState){ doc.readyState = "complete"; }
  11007. while(readyQ.length){
  11008. (readyQ.shift())(doc);
  11009. }
  11010. },
  11011. on = function(node, event){
  11012. node.addEventListener(event, detectReady, false);
  11013. readyQ.push(function(){ node.removeEventListener(event, detectReady, false); });
  11014. };
  11015. if(!has("dom-addeventlistener")){
  11016. on = function(node, event){
  11017. event = "on" + event;
  11018. node.attachEvent(event, detectReady);
  11019. readyQ.push(function(){ node.detachEvent(event, detectReady); });
  11020. };
  11021. var div = doc.createElement("div");
  11022. try{
  11023. if(div.doScroll && global.frameElement === null){
  11024. // the doScroll test is only useful if we're in the top-most frame
  11025. tests.push(function(){
  11026. // Derived with permission from Diego Perini's IEContentLoaded
  11027. // http://javascript.nwbox.com/IEContentLoaded/
  11028. try{
  11029. div.doScroll("left");
  11030. return 1;
  11031. }catch(e){}
  11032. });
  11033. }
  11034. }catch(e){}
  11035. }
  11036. on(doc, "DOMContentLoaded");
  11037. on(global, "load");
  11038. if("onreadystatechange" in doc){
  11039. on(doc, "readystatechange");
  11040. }else if(!fixReadyState){
  11041. // if the ready state property exists and there's
  11042. // no readystatechange event, poll for the state
  11043. // to change
  11044. tests.push(function(){
  11045. return readyStates[doc.readyState];
  11046. });
  11047. }
  11048. if(tests.length){
  11049. var poller = function(){
  11050. if(ready){ return; }
  11051. var i = tests.length;
  11052. while(i--){
  11053. if(tests[i]()){
  11054. detectReady("poller");
  11055. return;
  11056. }
  11057. }
  11058. setTimeout(poller, 30);
  11059. };
  11060. poller();
  11061. }
  11062. }
  11063. function domReady(callback){
  11064. // summary:
  11065. // Plugin to delay require()/define() callback from firing until the DOM has finished loading.
  11066. if(ready){
  11067. callback(doc);
  11068. }else{
  11069. readyQ.push(callback);
  11070. }
  11071. }
  11072. domReady.load = function(id, req, load){
  11073. domReady(load);
  11074. };
  11075. return domReady;
  11076. });
  11077. },
  11078. 'dojo/_base/lang':function(){
  11079. define("dojo/_base/lang", ["./kernel", "../has", "../sniff"], function(dojo, has){
  11080. // module:
  11081. // dojo/_base/lang
  11082. has.add("bug-for-in-skips-shadowed", function(){
  11083. // if true, the for-in iterator skips object properties that exist in Object's prototype (IE 6 - ?)
  11084. for(var i in {toString: 1}){
  11085. return 0;
  11086. }
  11087. return 1;
  11088. });
  11089. // Helper methods
  11090. var _extraNames =
  11091. has("bug-for-in-skips-shadowed") ?
  11092. "hasOwnProperty.valueOf.isPrototypeOf.propertyIsEnumerable.toLocaleString.toString.constructor".split(".") : [],
  11093. _extraLen = _extraNames.length,
  11094. getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){
  11095. var p, i = 0, dojoGlobal = dojo.global;
  11096. if(!context){
  11097. if(!parts.length){
  11098. return dojoGlobal;
  11099. }else{
  11100. p = parts[i++];
  11101. try{
  11102. context = dojo.scopeMap[p] && dojo.scopeMap[p][1];
  11103. }catch(e){}
  11104. context = context || (p in dojoGlobal ? dojoGlobal[p] : (create ? dojoGlobal[p] = {} : undefined));
  11105. }
  11106. }
  11107. while(context && (p = parts[i++])){
  11108. context = (p in context ? context[p] : (create ? context[p] = {} : undefined));
  11109. }
  11110. return context; // mixed
  11111. },
  11112. opts = Object.prototype.toString,
  11113. efficient = function(obj, offset, startWith){
  11114. return (startWith||[]).concat(Array.prototype.slice.call(obj, offset||0));
  11115. },
  11116. _pattern = /\{([^\}]+)\}/g;
  11117. // Module export
  11118. var lang = {
  11119. // summary:
  11120. // This module defines Javascript language extensions.
  11121. // _extraNames: String[]
  11122. // Lists property names that must be explicitly processed during for-in iteration
  11123. // in environments that have has("bug-for-in-skips-shadowed") true.
  11124. _extraNames:_extraNames,
  11125. _mixin: function(dest, source, copyFunc){
  11126. // summary:
  11127. // Copies/adds all properties of source to dest; returns dest.
  11128. // dest: Object
  11129. // The object to which to copy/add all properties contained in source.
  11130. // source: Object
  11131. // The object from which to draw all properties to copy into dest.
  11132. // copyFunc: Function?
  11133. // The process used to copy/add a property in source; defaults to the Javascript assignment operator.
  11134. // returns:
  11135. // dest, as modified
  11136. // description:
  11137. // All properties, including functions (sometimes termed "methods"), excluding any non-standard extensions
  11138. // found in Object.prototype, are copied/added to dest. Copying/adding each particular property is
  11139. // delegated to copyFunc (if any); copyFunc defaults to the Javascript assignment operator if not provided.
  11140. // Notice that by default, _mixin executes a so-called "shallow copy" and aggregate types are copied/added by reference.
  11141. var name, s, i, empty = {};
  11142. for(name in source){
  11143. // the (!(name in empty) || empty[name] !== s) condition avoids copying properties in "source"
  11144. // inherited from Object.prototype. For example, if dest has a custom toString() method,
  11145. // don't overwrite it with the toString() method that source inherited from Object.prototype
  11146. s = source[name];
  11147. if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
  11148. dest[name] = copyFunc ? copyFunc(s) : s;
  11149. }
  11150. }
  11151. if(has("bug-for-in-skips-shadowed")){
  11152. if(source){
  11153. for(i = 0; i < _extraLen; ++i){
  11154. name = _extraNames[i];
  11155. s = source[name];
  11156. if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
  11157. dest[name] = copyFunc ? copyFunc(s) : s;
  11158. }
  11159. }
  11160. }
  11161. }
  11162. return dest; // Object
  11163. },
  11164. mixin: function(dest, sources){
  11165. // summary:
  11166. // Copies/adds all properties of one or more sources to dest; returns dest.
  11167. // dest: Object
  11168. // The object to which to copy/add all properties contained in source. If dest is falsy, then
  11169. // a new object is manufactured before copying/adding properties begins.
  11170. // sources: Object...
  11171. // One of more objects from which to draw all properties to copy into dest. sources are processed
  11172. // left-to-right and if more than one of these objects contain the same property name, the right-most
  11173. // value "wins".
  11174. // returns: Object
  11175. // dest, as modified
  11176. // description:
  11177. // All properties, including functions (sometimes termed "methods"), excluding any non-standard extensions
  11178. // found in Object.prototype, are copied/added from sources to dest. sources are processed left to right.
  11179. // The Javascript assignment operator is used to copy/add each property; therefore, by default, mixin
  11180. // executes a so-called "shallow copy" and aggregate types are copied/added by reference.
  11181. // example:
  11182. // make a shallow copy of an object
  11183. // | var copy = lang.mixin({}, source);
  11184. // example:
  11185. // many class constructors often take an object which specifies
  11186. // values to be configured on the object. In this case, it is
  11187. // often simplest to call `lang.mixin` on the `this` object:
  11188. // | declare("acme.Base", null, {
  11189. // | constructor: function(properties){
  11190. // | // property configuration:
  11191. // | lang.mixin(this, properties);
  11192. // |
  11193. // | console.log(this.quip);
  11194. // | // ...
  11195. // | },
  11196. // | quip: "I wasn't born yesterday, you know - I've seen movies.",
  11197. // | // ...
  11198. // | });
  11199. // |
  11200. // | // create an instance of the class and configure it
  11201. // | var b = new acme.Base({quip: "That's what it does!" });
  11202. // example:
  11203. // copy in properties from multiple objects
  11204. // | var flattened = lang.mixin(
  11205. // | {
  11206. // | name: "Frylock",
  11207. // | braces: true
  11208. // | },
  11209. // | {
  11210. // | name: "Carl Brutanananadilewski"
  11211. // | }
  11212. // | );
  11213. // |
  11214. // | // will print "Carl Brutanananadilewski"
  11215. // | console.log(flattened.name);
  11216. // | // will print "true"
  11217. // | console.log(flattened.braces);
  11218. if(!dest){ dest = {}; }
  11219. for(var i = 1, l = arguments.length; i < l; i++){
  11220. lang._mixin(dest, arguments[i]);
  11221. }
  11222. return dest; // Object
  11223. },
  11224. setObject: function(name, value, context){
  11225. // summary:
  11226. // Set a property from a dot-separated string, such as "A.B.C"
  11227. // description:
  11228. // Useful for longer api chains where you have to test each object in
  11229. // the chain, or when you have an object reference in string format.
  11230. // Objects are created as needed along `path`. Returns the passed
  11231. // value if setting is successful or `undefined` if not.
  11232. // name: String
  11233. // Path to a property, in the form "A.B.C".
  11234. // value: anything
  11235. // value or object to place at location given by name
  11236. // context: Object?
  11237. // Optional. Object to use as root of path. Defaults to
  11238. // `dojo.global`.
  11239. // example:
  11240. // set the value of `foo.bar.baz`, regardless of whether
  11241. // intermediate objects already exist:
  11242. // | lang.setObject("foo.bar.baz", value);
  11243. // example:
  11244. // without `lang.setObject`, we often see code like this:
  11245. // | // ensure that intermediate objects are available
  11246. // | if(!obj["parent"]){ obj.parent = {}; }
  11247. // | if(!obj.parent["child"]){ obj.parent.child = {}; }
  11248. // | // now we can safely set the property
  11249. // | obj.parent.child.prop = "some value";
  11250. // whereas with `lang.setObject`, we can shorten that to:
  11251. // | lang.setObject("parent.child.prop", "some value", obj);
  11252. var parts = name.split("."), p = parts.pop(), obj = getProp(parts, true, context);
  11253. return obj && p ? (obj[p] = value) : undefined; // Object
  11254. },
  11255. getObject: function(name, create, context){
  11256. // summary:
  11257. // Get a property from a dot-separated string, such as "A.B.C"
  11258. // description:
  11259. // Useful for longer api chains where you have to test each object in
  11260. // the chain, or when you have an object reference in string format.
  11261. // name: String
  11262. // Path to an property, in the form "A.B.C".
  11263. // create: Boolean?
  11264. // Optional. Defaults to `false`. If `true`, Objects will be
  11265. // created at any point along the 'path' that is undefined.
  11266. // context: Object?
  11267. // Optional. Object to use as root of path. Defaults to
  11268. // 'dojo.global'. Null may be passed.
  11269. return getProp(name.split("."), create, context); // Object
  11270. },
  11271. exists: function(name, obj){
  11272. // summary:
  11273. // determine if an object supports a given method
  11274. // description:
  11275. // useful for longer api chains where you have to test each object in
  11276. // the chain. Useful for object and method detection.
  11277. // name: String
  11278. // Path to an object, in the form "A.B.C".
  11279. // obj: Object?
  11280. // Object to use as root of path. Defaults to
  11281. // 'dojo.global'. Null may be passed.
  11282. // example:
  11283. // | // define an object
  11284. // | var foo = {
  11285. // | bar: { }
  11286. // | };
  11287. // |
  11288. // | // search the global scope
  11289. // | lang.exists("foo.bar"); // true
  11290. // | lang.exists("foo.bar.baz"); // false
  11291. // |
  11292. // | // search from a particular scope
  11293. // | lang.exists("bar", foo); // true
  11294. // | lang.exists("bar.baz", foo); // false
  11295. return lang.getObject(name, false, obj) !== undefined; // Boolean
  11296. },
  11297. // Crockford (ish) functions
  11298. isString: function(it){
  11299. // summary:
  11300. // Return true if it is a String
  11301. // it: anything
  11302. // Item to test.
  11303. return (typeof it == "string" || it instanceof String); // Boolean
  11304. },
  11305. isArray: function(it){
  11306. // summary:
  11307. // Return true if it is an Array.
  11308. // Does not work on Arrays created in other windows.
  11309. // it: anything
  11310. // Item to test.
  11311. return it && (it instanceof Array || typeof it == "array"); // Boolean
  11312. },
  11313. isFunction: function(it){
  11314. // summary:
  11315. // Return true if it is a Function
  11316. // it: anything
  11317. // Item to test.
  11318. return opts.call(it) === "[object Function]";
  11319. },
  11320. isObject: function(it){
  11321. // summary:
  11322. // Returns true if it is a JavaScript object (or an Array, a Function
  11323. // or null)
  11324. // it: anything
  11325. // Item to test.
  11326. return it !== undefined &&
  11327. (it === null || typeof it == "object" || lang.isArray(it) || lang.isFunction(it)); // Boolean
  11328. },
  11329. isArrayLike: function(it){
  11330. // summary:
  11331. // similar to isArray() but more permissive
  11332. // it: anything
  11333. // Item to test.
  11334. // returns:
  11335. // If it walks like a duck and quacks like a duck, return `true`
  11336. // description:
  11337. // Doesn't strongly test for "arrayness". Instead, settles for "isn't
  11338. // a string or number and has a length property". Arguments objects
  11339. // and DOM collections will return true when passed to
  11340. // isArrayLike(), but will return false when passed to
  11341. // isArray().
  11342. return it && it !== undefined && // Boolean
  11343. // keep out built-in constructors (Number, String, ...) which have length
  11344. // properties
  11345. !lang.isString(it) && !lang.isFunction(it) &&
  11346. !(it.tagName && it.tagName.toLowerCase() == 'form') &&
  11347. (lang.isArray(it) || isFinite(it.length));
  11348. },
  11349. isAlien: function(it){
  11350. // summary:
  11351. // Returns true if it is a built-in function or some other kind of
  11352. // oddball that *should* report as a function but doesn't
  11353. return it && !lang.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
  11354. },
  11355. extend: function(ctor, props){
  11356. // summary:
  11357. // Adds all properties and methods of props to constructor's
  11358. // prototype, making them available to all instances created with
  11359. // constructor.
  11360. // ctor: Object
  11361. // Target constructor to extend.
  11362. // props: Object
  11363. // One or more objects to mix into ctor.prototype
  11364. for(var i=1, l=arguments.length; i<l; i++){
  11365. lang._mixin(ctor.prototype, arguments[i]);
  11366. }
  11367. return ctor; // Object
  11368. },
  11369. _hitchArgs: function(scope, method){
  11370. var pre = lang._toArray(arguments, 2);
  11371. var named = lang.isString(method);
  11372. return function(){
  11373. // arrayify arguments
  11374. var args = lang._toArray(arguments);
  11375. // locate our method
  11376. var f = named ? (scope||dojo.global)[method] : method;
  11377. // invoke with collected args
  11378. return f && f.apply(scope || this, pre.concat(args)); // mixed
  11379. }; // Function
  11380. },
  11381. hitch: function(scope, method){
  11382. // summary:
  11383. // Returns a function that will only ever execute in the a given scope.
  11384. // This allows for easy use of object member functions
  11385. // in callbacks and other places in which the "this" keyword may
  11386. // otherwise not reference the expected scope.
  11387. // Any number of default positional arguments may be passed as parameters
  11388. // beyond "method".
  11389. // Each of these values will be used to "placehold" (similar to curry)
  11390. // for the hitched function.
  11391. // scope: Object
  11392. // The scope to use when method executes. If method is a string,
  11393. // scope is also the object containing method.
  11394. // method: Function|String...
  11395. // A function to be hitched to scope, or the name of the method in
  11396. // scope to be hitched.
  11397. // example:
  11398. // | lang.hitch(foo, "bar")();
  11399. // runs foo.bar() in the scope of foo
  11400. // example:
  11401. // | lang.hitch(foo, myFunction);
  11402. // returns a function that runs myFunction in the scope of foo
  11403. // example:
  11404. // Expansion on the default positional arguments passed along from
  11405. // hitch. Passed args are mixed first, additional args after.
  11406. // | var foo = { bar: function(a, b, c){ console.log(a, b, c); } };
  11407. // | var fn = lang.hitch(foo, "bar", 1, 2);
  11408. // | fn(3); // logs "1, 2, 3"
  11409. // example:
  11410. // | var foo = { bar: 2 };
  11411. // | lang.hitch(foo, function(){ this.bar = 10; })();
  11412. // execute an anonymous function in scope of foo
  11413. if(arguments.length > 2){
  11414. return lang._hitchArgs.apply(dojo, arguments); // Function
  11415. }
  11416. if(!method){
  11417. method = scope;
  11418. scope = null;
  11419. }
  11420. if(lang.isString(method)){
  11421. scope = scope || dojo.global;
  11422. if(!scope[method]){ throw(['lang.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); }
  11423. return function(){ return scope[method].apply(scope, arguments || []); }; // Function
  11424. }
  11425. return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
  11426. },
  11427. delegate: (function(){
  11428. // boodman/crockford delegation w/ cornford optimization
  11429. function TMP(){}
  11430. return function(obj, props){
  11431. TMP.prototype = obj;
  11432. var tmp = new TMP();
  11433. TMP.prototype = null;
  11434. if(props){
  11435. lang._mixin(tmp, props);
  11436. }
  11437. return tmp; // Object
  11438. };
  11439. })(),
  11440. /*=====
  11441. delegate: function(obj, props){
  11442. // summary:
  11443. // Returns a new object which "looks" to obj for properties which it
  11444. // does not have a value for. Optionally takes a bag of properties to
  11445. // seed the returned object with initially.
  11446. // description:
  11447. // This is a small implementation of the Boodman/Crockford delegation
  11448. // pattern in JavaScript. An intermediate object constructor mediates
  11449. // the prototype chain for the returned object, using it to delegate
  11450. // down to obj for property lookup when object-local lookup fails.
  11451. // This can be thought of similarly to ES4's "wrap", save that it does
  11452. // not act on types but rather on pure objects.
  11453. // obj: Object
  11454. // The object to delegate to for properties not found directly on the
  11455. // return object or in props.
  11456. // props: Object...
  11457. // an object containing properties to assign to the returned object
  11458. // returns:
  11459. // an Object of anonymous type
  11460. // example:
  11461. // | var foo = { bar: "baz" };
  11462. // | var thinger = lang.delegate(foo, { thud: "xyzzy"});
  11463. // | thinger.bar == "baz"; // delegated to foo
  11464. // | foo.thud == undefined; // by definition
  11465. // | thinger.thud == "xyzzy"; // mixed in from props
  11466. // | foo.bar = "thonk";
  11467. // | thinger.bar == "thonk"; // still delegated to foo's bar
  11468. },
  11469. =====*/
  11470. _toArray: has("ie") ?
  11471. (function(){
  11472. function slow(obj, offset, startWith){
  11473. var arr = startWith||[];
  11474. for(var x = offset || 0; x < obj.length; x++){
  11475. arr.push(obj[x]);
  11476. }
  11477. return arr;
  11478. }
  11479. return function(obj){
  11480. return ((obj.item) ? slow : efficient).apply(this, arguments);
  11481. };
  11482. })() : efficient,
  11483. /*=====
  11484. _toArray: function(obj, offset, startWith){
  11485. // summary:
  11486. // Converts an array-like object (i.e. arguments, DOMCollection) to an
  11487. // array. Returns a new Array with the elements of obj.
  11488. // obj: Object
  11489. // the object to "arrayify". We expect the object to have, at a
  11490. // minimum, a length property which corresponds to integer-indexed
  11491. // properties.
  11492. // offset: Number?
  11493. // the location in obj to start iterating from. Defaults to 0.
  11494. // Optional.
  11495. // startWith: Array?
  11496. // An array to pack with the properties of obj. If provided,
  11497. // properties in obj are appended at the end of startWith and
  11498. // startWith is the returned array.
  11499. },
  11500. =====*/
  11501. partial: function(/*Function|String*/ method /*, ...*/){
  11502. // summary:
  11503. // similar to hitch() except that the scope object is left to be
  11504. // whatever the execution context eventually becomes.
  11505. // description:
  11506. // Calling lang.partial is the functional equivalent of calling:
  11507. // | lang.hitch(null, funcName, ...);
  11508. // method:
  11509. // The function to "wrap"
  11510. var arr = [ null ];
  11511. return lang.hitch.apply(dojo, arr.concat(lang._toArray(arguments))); // Function
  11512. },
  11513. clone: function(/*anything*/ src){
  11514. // summary:
  11515. // Clones objects (including DOM nodes) and all children.
  11516. // Warning: do not clone cyclic structures.
  11517. // src:
  11518. // The object to clone
  11519. if(!src || typeof src != "object" || lang.isFunction(src)){
  11520. // null, undefined, any non-object, or function
  11521. return src; // anything
  11522. }
  11523. if(src.nodeType && "cloneNode" in src){
  11524. // DOM Node
  11525. return src.cloneNode(true); // Node
  11526. }
  11527. if(src instanceof Date){
  11528. // Date
  11529. return new Date(src.getTime()); // Date
  11530. }
  11531. if(src instanceof RegExp){
  11532. // RegExp
  11533. return new RegExp(src); // RegExp
  11534. }
  11535. var r, i, l;
  11536. if(lang.isArray(src)){
  11537. // array
  11538. r = [];
  11539. for(i = 0, l = src.length; i < l; ++i){
  11540. if(i in src){
  11541. r.push(lang.clone(src[i]));
  11542. }
  11543. }
  11544. // we don't clone functions for performance reasons
  11545. // }else if(d.isFunction(src)){
  11546. // // function
  11547. // r = function(){ return src.apply(this, arguments); };
  11548. }else{
  11549. // generic objects
  11550. r = src.constructor ? new src.constructor() : {};
  11551. }
  11552. return lang._mixin(r, src, lang.clone);
  11553. },
  11554. trim: String.prototype.trim ?
  11555. function(str){ return str.trim(); } :
  11556. function(str){ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); },
  11557. /*=====
  11558. trim: function(str){
  11559. // summary:
  11560. // Trims whitespace from both sides of the string
  11561. // str: String
  11562. // String to be trimmed
  11563. // returns: String
  11564. // Returns the trimmed string
  11565. // description:
  11566. // This version of trim() was selected for inclusion into the base due
  11567. // to its compact size and relatively good performance
  11568. // (see [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript)
  11569. // Uses String.prototype.trim instead, if available.
  11570. // The fastest but longest version of this function is located at
  11571. // lang.string.trim()
  11572. },
  11573. =====*/
  11574. replace: function(tmpl, map, pattern){
  11575. // summary:
  11576. // Performs parameterized substitutions on a string. Throws an
  11577. // exception if any parameter is unmatched.
  11578. // tmpl: String
  11579. // String to be used as a template.
  11580. // map: Object|Function
  11581. // If an object, it is used as a dictionary to look up substitutions.
  11582. // If a function, it is called for every substitution with following parameters:
  11583. // a whole match, a name, an offset, and the whole template
  11584. // string (see https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/replace
  11585. // for more details).
  11586. // pattern: RegEx?
  11587. // Optional regular expression objects that overrides the default pattern.
  11588. // Must be global and match one item. The default is: /\{([^\}]+)\}/g,
  11589. // which matches patterns like that: "{xxx}", where "xxx" is any sequence
  11590. // of characters, which doesn't include "}".
  11591. // returns: String
  11592. // Returns the substituted string.
  11593. // example:
  11594. // | // uses a dictionary for substitutions:
  11595. // | lang.replace("Hello, {name.first} {name.last} AKA {nick}!",
  11596. // | {
  11597. // | nick: "Bob",
  11598. // | name: {
  11599. // | first: "Robert",
  11600. // | middle: "X",
  11601. // | last: "Cringely"
  11602. // | }
  11603. // | });
  11604. // | // returns: Hello, Robert Cringely AKA Bob!
  11605. // example:
  11606. // | // uses an array for substitutions:
  11607. // | lang.replace("Hello, {0} {2}!",
  11608. // | ["Robert", "X", "Cringely"]);
  11609. // | // returns: Hello, Robert Cringely!
  11610. // example:
  11611. // | // uses a function for substitutions:
  11612. // | function sum(a){
  11613. // | var t = 0;
  11614. // | arrayforEach(a, function(x){ t += x; });
  11615. // | return t;
  11616. // | }
  11617. // | lang.replace(
  11618. // | "{count} payments averaging {avg} USD per payment.",
  11619. // | lang.hitch(
  11620. // | { payments: [11, 16, 12] },
  11621. // | function(_, key){
  11622. // | switch(key){
  11623. // | case "count": return this.payments.length;
  11624. // | case "min": return Math.min.apply(Math, this.payments);
  11625. // | case "max": return Math.max.apply(Math, this.payments);
  11626. // | case "sum": return sum(this.payments);
  11627. // | case "avg": return sum(this.payments) / this.payments.length;
  11628. // | }
  11629. // | }
  11630. // | )
  11631. // | );
  11632. // | // prints: 3 payments averaging 13 USD per payment.
  11633. // example:
  11634. // | // uses an alternative PHP-like pattern for substitutions:
  11635. // | lang.replace("Hello, ${0} ${2}!",
  11636. // | ["Robert", "X", "Cringely"], /\$\{([^\}]+)\}/g);
  11637. // | // returns: Hello, Robert Cringely!
  11638. return tmpl.replace(pattern || _pattern, lang.isFunction(map) ?
  11639. map : function(_, k){ return lang.getObject(k, false, map); });
  11640. }
  11641. };
  11642. 1 && lang.mixin(dojo, lang);
  11643. return lang;
  11644. });
  11645. },
  11646. 'dojo/request/util':function(){
  11647. define("dojo/request/util", [
  11648. 'exports',
  11649. '../errors/RequestError',
  11650. '../errors/CancelError',
  11651. '../Deferred',
  11652. '../io-query',
  11653. '../_base/array',
  11654. '../_base/lang'
  11655. ], function(exports, RequestError, CancelError, Deferred, ioQuery, array, lang){
  11656. exports.deepCopy = function deepCopy(target, source){
  11657. for(var name in source){
  11658. var tval = target[name],
  11659. sval = source[name];
  11660. if(tval !== sval){
  11661. if(tval && typeof tval === 'object' && sval && typeof sval === 'object'){
  11662. exports.deepCopy(tval, sval);
  11663. }else{
  11664. target[name] = sval;
  11665. }
  11666. }
  11667. }
  11668. return target;
  11669. };
  11670. exports.deepCreate = function deepCreate(source, properties){
  11671. properties = properties || {};
  11672. var target = lang.delegate(source),
  11673. name, value;
  11674. for(name in source){
  11675. value = source[name];
  11676. if(value && typeof value === 'object'){
  11677. target[name] = exports.deepCreate(value, properties[name]);
  11678. }
  11679. }
  11680. return exports.deepCopy(target, properties);
  11681. };
  11682. var freeze = Object.freeze || function(obj){ return obj; };
  11683. function okHandler(response){
  11684. return freeze(response);
  11685. }
  11686. exports.deferred = function deferred(response, cancel, isValid, isReady, handleResponse, last){
  11687. var def = new Deferred(function(reason){
  11688. cancel && cancel(def, response);
  11689. if(!reason || !(reason instanceof RequestError) && !(reason instanceof CancelError)){
  11690. return new CancelError('Request canceled', response);
  11691. }
  11692. return reason;
  11693. });
  11694. def.response = response;
  11695. def.isValid = isValid;
  11696. def.isReady = isReady;
  11697. def.handleResponse = handleResponse;
  11698. function errHandler(error){
  11699. error.response = response;
  11700. throw error;
  11701. }
  11702. var responsePromise = def.then(okHandler).otherwise(errHandler);
  11703. if(exports.notify){
  11704. responsePromise.then(
  11705. lang.hitch(exports.notify, 'emit', 'load'),
  11706. lang.hitch(exports.notify, 'emit', 'error')
  11707. );
  11708. }
  11709. var dataPromise = responsePromise.then(function(response){
  11710. return response.data || response.text;
  11711. });
  11712. var promise = freeze(lang.delegate(dataPromise, {
  11713. response: responsePromise
  11714. }));
  11715. if(last){
  11716. def.then(function(response){
  11717. last.call(def, response);
  11718. }, function(error){
  11719. last.call(def, response, error);
  11720. });
  11721. }
  11722. def.promise = promise;
  11723. def.then = promise.then;
  11724. return def;
  11725. };
  11726. exports.addCommonMethods = function addCommonMethods(provider, methods){
  11727. array.forEach(methods||['GET', 'POST', 'PUT', 'DELETE'], function(method){
  11728. provider[(method === 'DELETE' ? 'DEL' : method).toLowerCase()] = function(url, options){
  11729. options = lang.delegate(options||{});
  11730. options.method = method;
  11731. return provider(url, options);
  11732. };
  11733. });
  11734. };
  11735. exports.parseArgs = function parseArgs(url, options, skipData){
  11736. var data = options.data,
  11737. query = options.query;
  11738. if(data && !skipData){
  11739. if(typeof data === 'object'){
  11740. options.data = ioQuery.objectToQuery(data);
  11741. }
  11742. }
  11743. if(query){
  11744. if(typeof query === 'object'){
  11745. query = ioQuery.objectToQuery(query);
  11746. }
  11747. if(options.preventCache){
  11748. query += (query ? '&' : '') + 'request.preventCache=' + (+(new Date));
  11749. }
  11750. }else if(options.preventCache){
  11751. query = 'request.preventCache=' + (+(new Date));
  11752. }
  11753. if(url && query){
  11754. url += (~url.indexOf('?') ? '&' : '?') + query;
  11755. }
  11756. return {
  11757. url: url,
  11758. options: options,
  11759. getHeader: function(headerName){ return null; }
  11760. };
  11761. };
  11762. exports.checkStatus = function(stat){
  11763. stat = stat || 0;
  11764. return (stat >= 200 && stat < 300) || // allow any 2XX response code
  11765. stat === 304 || // or, get it out of the cache
  11766. stat === 1223 || // or, Internet Explorer mangled the status code
  11767. !stat; // or, we're Titanium/browser chrome/chrome extension requesting a local file
  11768. };
  11769. });
  11770. },
  11771. 'dojo/Evented':function(){
  11772. define("dojo/Evented", ["./aspect", "./on"], function(aspect, on){
  11773. // module:
  11774. // dojo/Evented
  11775. "use strict";
  11776. var after = aspect.after;
  11777. function Evented(){
  11778. // summary:
  11779. // A class that can be used as a mixin or base class,
  11780. // to add on() and emit() methods to a class
  11781. // for listening for events and emitting events:
  11782. //
  11783. // | define(["dojo/Evented"], function(Evented){
  11784. // | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...});
  11785. // | widget = new EventedWidget();
  11786. // | widget.on("open", function(event){
  11787. // | ... do something with event
  11788. // | });
  11789. // |
  11790. // | widget.emit("open", {name:"some event", ...});
  11791. }
  11792. Evented.prototype = {
  11793. on: function(type, listener){
  11794. return on.parse(this, type, listener, function(target, type){
  11795. return after(target, 'on' + type, listener, true);
  11796. });
  11797. },
  11798. emit: function(type, event){
  11799. var args = [this];
  11800. args.push.apply(args, arguments);
  11801. return on.emit.apply(on, args);
  11802. }
  11803. };
  11804. return Evented;
  11805. });
  11806. },
  11807. 'dojo/mouse':function(){
  11808. define("dojo/mouse", ["./_base/kernel", "./on", "./has", "./dom", "./_base/window"], function(dojo, on, has, dom, win){
  11809. // module:
  11810. // dojo/mouse
  11811. has.add("dom-quirks", win.doc && win.doc.compatMode == "BackCompat");
  11812. has.add("events-mouseenter", win.doc && "onmouseenter" in win.doc.createElement("div"));
  11813. has.add("events-mousewheel", win.doc && 'onmousewheel' in win.doc);
  11814. var mouseButtons;
  11815. if((has("dom-quirks") && has("ie")) || !has("dom-addeventlistener")){
  11816. mouseButtons = {
  11817. LEFT: 1,
  11818. MIDDLE: 4,
  11819. RIGHT: 2,
  11820. // helper functions
  11821. isButton: function(e, button){ return e.button & button; },
  11822. isLeft: function(e){ return e.button & 1; },
  11823. isMiddle: function(e){ return e.button & 4; },
  11824. isRight: function(e){ return e.button & 2; }
  11825. };
  11826. }else{
  11827. mouseButtons = {
  11828. LEFT: 0,
  11829. MIDDLE: 1,
  11830. RIGHT: 2,
  11831. // helper functions
  11832. isButton: function(e, button){ return e.button == button; },
  11833. isLeft: function(e){ return e.button == 0; },
  11834. isMiddle: function(e){ return e.button == 1; },
  11835. isRight: function(e){ return e.button == 2; }
  11836. };
  11837. }
  11838. dojo.mouseButtons = mouseButtons;
  11839. /*=====
  11840. dojo.mouseButtons = {
  11841. // LEFT: Number
  11842. // Numeric value of the left mouse button for the platform.
  11843. LEFT: 0,
  11844. // MIDDLE: Number
  11845. // Numeric value of the middle mouse button for the platform.
  11846. MIDDLE: 1,
  11847. // RIGHT: Number
  11848. // Numeric value of the right mouse button for the platform.
  11849. RIGHT: 2,
  11850. isButton: function(e, button){
  11851. // summary:
  11852. // Checks an event object for a pressed button
  11853. // e: Event
  11854. // Event object to examine
  11855. // button: Number
  11856. // The button value (example: dojo.mouseButton.LEFT)
  11857. return e.button == button; // Boolean
  11858. },
  11859. isLeft: function(e){
  11860. // summary:
  11861. // Checks an event object for the pressed left button
  11862. // e: Event
  11863. // Event object to examine
  11864. return e.button == 0; // Boolean
  11865. },
  11866. isMiddle: function(e){
  11867. // summary:
  11868. // Checks an event object for the pressed middle button
  11869. // e: Event
  11870. // Event object to examine
  11871. return e.button == 1; // Boolean
  11872. },
  11873. isRight: function(e){
  11874. // summary:
  11875. // Checks an event object for the pressed right button
  11876. // e: Event
  11877. // Event object to examine
  11878. return e.button == 2; // Boolean
  11879. }
  11880. };
  11881. =====*/
  11882. function eventHandler(type, selectHandler){
  11883. // emulation of mouseenter/leave with mouseover/out using descendant checking
  11884. var handler = function(node, listener){
  11885. return on(node, type, function(evt){
  11886. if(selectHandler){
  11887. return selectHandler(evt, listener);
  11888. }
  11889. if(!dom.isDescendant(evt.relatedTarget, node)){
  11890. return listener.call(this, evt);
  11891. }
  11892. });
  11893. };
  11894. handler.bubble = function(select){
  11895. return eventHandler(type, function(evt, listener){
  11896. // using a selector, use the select function to determine if the mouse moved inside the selector and was previously outside the selector
  11897. var target = select(evt.target);
  11898. var relatedTarget = evt.relatedTarget;
  11899. if(target && (target != (relatedTarget && relatedTarget.nodeType == 1 && select(relatedTarget)))){
  11900. return listener.call(target, evt);
  11901. }
  11902. });
  11903. };
  11904. return handler;
  11905. }
  11906. var wheel;
  11907. if(has("events-mousewheel")){
  11908. wheel = 'mousewheel';
  11909. }else{ //firefox
  11910. wheel = function(node, listener){
  11911. return on(node, 'DOMMouseScroll', function(evt){
  11912. evt.wheelDelta = -evt.detail;
  11913. listener.call(this, evt);
  11914. });
  11915. };
  11916. }
  11917. return {
  11918. // summary:
  11919. // This module provide mouse event handling utility functions and exports
  11920. // mouseenter and mouseleave event emulation.
  11921. // example:
  11922. // To use these events, you register a mouseenter like this:
  11923. // | define(["dojo/on", dojo/mouse"], function(on, mouse){
  11924. // | on(targetNode, mouse.enter, function(event){
  11925. // | dojo.addClass(targetNode, "highlighted");
  11926. // | });
  11927. // | on(targetNode, mouse.leave, function(event){
  11928. // | dojo.removeClass(targetNode, "highlighted");
  11929. // | });
  11930. _eventHandler: eventHandler, // for dojo/touch
  11931. // enter: Synthetic Event
  11932. // This is an extension event for the mouseenter that IE provides, emulating the
  11933. // behavior on other browsers.
  11934. enter: eventHandler("mouseover"),
  11935. // leave: Synthetic Event
  11936. // This is an extension event for the mouseleave that IE provides, emulating the
  11937. // behavior on other browsers.
  11938. leave: eventHandler("mouseout"),
  11939. // wheel: Normalized Mouse Wheel Event
  11940. // This is an extension event for the mousewheel that non-Mozilla browsers provide,
  11941. // emulating the behavior on Mozilla based browsers.
  11942. wheel: wheel,
  11943. isLeft: mouseButtons.isLeft,
  11944. /*=====
  11945. isLeft: function(){
  11946. // summary:
  11947. // Test an event object (from a mousedown event) to see if the left button was pressed.
  11948. },
  11949. =====*/
  11950. isMiddle: mouseButtons.isMiddle,
  11951. /*=====
  11952. isMiddle: function(){
  11953. // summary:
  11954. // Test an event object (from a mousedown event) to see if the middle button was pressed.
  11955. },
  11956. =====*/
  11957. isRight: mouseButtons.isRight
  11958. /*=====
  11959. , isRight: function(){
  11960. // summary:
  11961. // Test an event object (from a mousedown event) to see if the right button was pressed.
  11962. }
  11963. =====*/
  11964. };
  11965. });
  11966. },
  11967. 'dojo/topic':function(){
  11968. define("dojo/topic", ["./Evented"], function(Evented){
  11969. // module:
  11970. // dojo/topic
  11971. var hub = new Evented;
  11972. return {
  11973. // summary:
  11974. // Pubsub hub.
  11975. // example:
  11976. // | topic.subscribe("some/topic", function(event){
  11977. // | ... do something with event
  11978. // | });
  11979. // | topic.publish("some/topic", {name:"some event", ...});
  11980. publish: function(topic, event){
  11981. // summary:
  11982. // Publishes a message to a topic on the pub/sub hub. All arguments after
  11983. // the first will be passed to the subscribers, so any number of arguments
  11984. // can be provided (not just event).
  11985. // topic: String
  11986. // The name of the topic to publish to
  11987. // event: Object
  11988. // An event to distribute to the topic listeners
  11989. return hub.emit.apply(hub, arguments);
  11990. },
  11991. subscribe: function(topic, listener){
  11992. // summary:
  11993. // Subscribes to a topic on the pub/sub hub
  11994. // topic: String
  11995. // The topic to subscribe to
  11996. // listener: Function
  11997. // A function to call when a message is published to the given topic
  11998. return hub.on.apply(hub, arguments);
  11999. }
  12000. };
  12001. });
  12002. },
  12003. 'dojo/_base/xhr':function(){
  12004. define("dojo/_base/xhr", [
  12005. "./kernel",
  12006. "./sniff",
  12007. "require",
  12008. "../io-query",
  12009. /*===== "./declare", =====*/
  12010. "../dom",
  12011. "../dom-form",
  12012. "./Deferred",
  12013. "./config",
  12014. "./json",
  12015. "./lang",
  12016. "./array",
  12017. "../on",
  12018. "../aspect",
  12019. "../request/watch",
  12020. "../request/xhr",
  12021. "../request/util"
  12022. ], function(dojo, has, require, ioq, /*===== declare, =====*/ dom, domForm, Deferred, config, json, lang, array, on, aspect, watch, _xhr, util){
  12023. // module:
  12024. // dojo/_base/xhr
  12025. /*=====
  12026. dojo._xhrObj = function(){
  12027. // summary:
  12028. // does the work of portably generating a new XMLHTTPRequest object.
  12029. };
  12030. =====*/
  12031. dojo._xhrObj = _xhr._create;
  12032. var cfg = dojo.config;
  12033. // mix in io-query and dom-form
  12034. dojo.objectToQuery = ioq.objectToQuery;
  12035. dojo.queryToObject = ioq.queryToObject;
  12036. dojo.fieldToObject = domForm.fieldToObject;
  12037. dojo.formToObject = domForm.toObject;
  12038. dojo.formToQuery = domForm.toQuery;
  12039. dojo.formToJson = domForm.toJson;
  12040. // need to block async callbacks from snatching this thread as the result
  12041. // of an async callback might call another sync XHR, this hangs khtml forever
  12042. // must checked by watchInFlight()
  12043. dojo._blockAsync = false;
  12044. // MOW: remove dojo._contentHandlers alias in 2.0
  12045. var handlers = dojo._contentHandlers = dojo.contentHandlers = {
  12046. // summary:
  12047. // A map of available XHR transport handle types. Name matches the
  12048. // `handleAs` attribute passed to XHR calls.
  12049. // description:
  12050. // A map of available XHR transport handle types. Name matches the
  12051. // `handleAs` attribute passed to XHR calls. Each contentHandler is
  12052. // called, passing the xhr object for manipulation. The return value
  12053. // from the contentHandler will be passed to the `load` or `handle`
  12054. // functions defined in the original xhr call.
  12055. // example:
  12056. // Creating a custom content-handler:
  12057. // | xhr.contentHandlers.makeCaps = function(xhr){
  12058. // | return xhr.responseText.toUpperCase();
  12059. // | }
  12060. // | // and later:
  12061. // | dojo.xhrGet({
  12062. // | url:"foo.txt",
  12063. // | handleAs:"makeCaps",
  12064. // | load: function(data){ /* data is a toUpper version of foo.txt */ }
  12065. // | });
  12066. "text": function(xhr){
  12067. // summary:
  12068. // A contentHandler which simply returns the plaintext response data
  12069. return xhr.responseText;
  12070. },
  12071. "json": function(xhr){
  12072. // summary:
  12073. // A contentHandler which returns a JavaScript object created from the response data
  12074. return json.fromJson(xhr.responseText || null);
  12075. },
  12076. "json-comment-filtered": function(xhr){
  12077. // summary:
  12078. // A contentHandler which expects comment-filtered JSON.
  12079. // description:
  12080. // A contentHandler which expects comment-filtered JSON.
  12081. // the json-comment-filtered option was implemented to prevent
  12082. // "JavaScript Hijacking", but it is less secure than standard JSON. Use
  12083. // standard JSON instead. JSON prefixing can be used to subvert hijacking.
  12084. //
  12085. // Will throw a notice suggesting to use application/json mimetype, as
  12086. // json-commenting can introduce security issues. To decrease the chances of hijacking,
  12087. // use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
  12088. //
  12089. // use djConfig.useCommentedJson = true to turn off the notice
  12090. if(!config.useCommentedJson){
  12091. console.warn("Consider using the standard mimetype:application/json."
  12092. + " json-commenting can introduce security issues. To"
  12093. + " decrease the chances of hijacking, use the standard the 'json' handler and"
  12094. + " prefix your json with: {}&&\n"
  12095. + "Use djConfig.useCommentedJson=true to turn off this message.");
  12096. }
  12097. var value = xhr.responseText;
  12098. var cStartIdx = value.indexOf("\/*");
  12099. var cEndIdx = value.lastIndexOf("*\/");
  12100. if(cStartIdx == -1 || cEndIdx == -1){
  12101. throw new Error("JSON was not comment filtered");
  12102. }
  12103. return json.fromJson(value.substring(cStartIdx+2, cEndIdx));
  12104. },
  12105. "javascript": function(xhr){
  12106. // summary:
  12107. // A contentHandler which evaluates the response data, expecting it to be valid JavaScript
  12108. // FIXME: try Moz and IE specific eval variants?
  12109. return dojo.eval(xhr.responseText);
  12110. },
  12111. "xml": function(xhr){
  12112. // summary:
  12113. // A contentHandler returning an XML Document parsed from the response data
  12114. var result = xhr.responseXML;
  12115. if(has("ie")){
  12116. if((!result || !result.documentElement)){
  12117. //WARNING: this branch used by the xml handling in dojo.io.iframe,
  12118. //so be sure to test dojo.io.iframe if making changes below.
  12119. var ms = function(n){ return "MSXML" + n + ".DOMDocument"; };
  12120. var dp = ["Microsoft.XMLDOM", ms(6), ms(4), ms(3), ms(2)];
  12121. array.some(dp, function(p){
  12122. try{
  12123. var dom = new ActiveXObject(p);
  12124. dom.async = false;
  12125. dom.loadXML(xhr.responseText);
  12126. result = dom;
  12127. }catch(e){ return false; }
  12128. return true;
  12129. });
  12130. }
  12131. }
  12132. return result; // DOMDocument
  12133. },
  12134. "json-comment-optional": function(xhr){
  12135. // summary:
  12136. // A contentHandler which checks the presence of comment-filtered JSON and
  12137. // alternates between the `json` and `json-comment-filtered` contentHandlers.
  12138. if(xhr.responseText && /^[^{\[]*\/\*/.test(xhr.responseText)){
  12139. return handlers["json-comment-filtered"](xhr);
  12140. }else{
  12141. return handlers["json"](xhr);
  12142. }
  12143. }
  12144. };
  12145. /*=====
  12146. // kwargs function parameter definitions. Assigning to dojo namespace rather than making them local variables
  12147. // because they are used by dojo/io modules too
  12148. dojo.__IoArgs = declare(null, {
  12149. // url: String
  12150. // URL to server endpoint.
  12151. // content: Object?
  12152. // Contains properties with string values. These
  12153. // properties will be serialized as name1=value2 and
  12154. // passed in the request.
  12155. // timeout: Integer?
  12156. // Milliseconds to wait for the response. If this time
  12157. // passes, the then error callbacks are called.
  12158. // form: DOMNode?
  12159. // DOM node for a form. Used to extract the form values
  12160. // and send to the server.
  12161. // preventCache: Boolean?
  12162. // Default is false. If true, then a
  12163. // "dojo.preventCache" parameter is sent in the request
  12164. // with a value that changes with each request
  12165. // (timestamp). Useful only with GET-type requests.
  12166. // handleAs: String?
  12167. // Acceptable values depend on the type of IO
  12168. // transport (see specific IO calls for more information).
  12169. // rawBody: String?
  12170. // Sets the raw body for an HTTP request. If this is used, then the content
  12171. // property is ignored. This is mostly useful for HTTP methods that have
  12172. // a body to their requests, like PUT or POST. This property can be used instead
  12173. // of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.
  12174. // ioPublish: Boolean?
  12175. // Set this explicitly to false to prevent publishing of topics related to
  12176. // IO operations. Otherwise, if djConfig.ioPublish is set to true, topics
  12177. // will be published via dojo/topic.publish() for different phases of an IO operation.
  12178. // See dojo/main.__IoPublish for a list of topics that are published.
  12179. load: function(response, ioArgs){
  12180. // summary:
  12181. // This function will be
  12182. // called on a successful HTTP response code.
  12183. // ioArgs: dojo/main.__IoCallbackArgs
  12184. // Provides additional information about the request.
  12185. // response: Object
  12186. // The response in the format as defined with handleAs.
  12187. },
  12188. error: function(response, ioArgs){
  12189. // summary:
  12190. // This function will
  12191. // be called when the request fails due to a network or server error, the url
  12192. // is invalid, etc. It will also be called if the load or handle callback throws an
  12193. // exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications
  12194. // to continue to run even when a logic error happens in the callback, while making
  12195. // it easier to troubleshoot while in debug mode.
  12196. // ioArgs: dojo/main.__IoCallbackArgs
  12197. // Provides additional information about the request.
  12198. // response: Object
  12199. // The response in the format as defined with handleAs.
  12200. },
  12201. handle: function(loadOrError, response, ioArgs){
  12202. // summary:
  12203. // This function will
  12204. // be called at the end of every request, whether or not an error occurs.
  12205. // loadOrError: String
  12206. // Provides a string that tells you whether this function
  12207. // was called because of success (load) or failure (error).
  12208. // response: Object
  12209. // The response in the format as defined with handleAs.
  12210. // ioArgs: dojo/main.__IoCallbackArgs
  12211. // Provides additional information about the request.
  12212. }
  12213. });
  12214. dojo.__IoCallbackArgs = declare(null, {
  12215. // args: Object
  12216. // the original object argument to the IO call.
  12217. // xhr: XMLHttpRequest
  12218. // For XMLHttpRequest calls only, the
  12219. // XMLHttpRequest object that was used for the
  12220. // request.
  12221. // url: String
  12222. // The final URL used for the call. Many times it
  12223. // will be different than the original args.url
  12224. // value.
  12225. // query: String
  12226. // For non-GET requests, the
  12227. // name1=value1&name2=value2 parameters sent up in
  12228. // the request.
  12229. // handleAs: String
  12230. // The final indicator on how the response will be
  12231. // handled.
  12232. // id: String
  12233. // For dojo/io/script calls only, the internal
  12234. // script ID used for the request.
  12235. // canDelete: Boolean
  12236. // For dojo/io/script calls only, indicates
  12237. // whether the script tag that represents the
  12238. // request can be deleted after callbacks have
  12239. // been called. Used internally to know when
  12240. // cleanup can happen on JSONP-type requests.
  12241. // json: Object
  12242. // For dojo/io/script calls only: holds the JSON
  12243. // response for JSONP-type requests. Used
  12244. // internally to hold on to the JSON responses.
  12245. // You should not need to access it directly --
  12246. // the same object should be passed to the success
  12247. // callbacks directly.
  12248. });
  12249. dojo.__IoPublish = declare(null, {
  12250. // summary:
  12251. // This is a list of IO topics that can be published
  12252. // if djConfig.ioPublish is set to true. IO topics can be
  12253. // published for any Input/Output, network operation. So,
  12254. // dojo.xhr, dojo.io.script and dojo.io.iframe can all
  12255. // trigger these topics to be published.
  12256. // start: String
  12257. // "/dojo/io/start" is sent when there are no outstanding IO
  12258. // requests, and a new IO request is started. No arguments
  12259. // are passed with this topic.
  12260. // send: String
  12261. // "/dojo/io/send" is sent whenever a new IO request is started.
  12262. // It passes the dojo.Deferred for the request with the topic.
  12263. // load: String
  12264. // "/dojo/io/load" is sent whenever an IO request has loaded
  12265. // successfully. It passes the response and the dojo.Deferred
  12266. // for the request with the topic.
  12267. // error: String
  12268. // "/dojo/io/error" is sent whenever an IO request has errored.
  12269. // It passes the error and the dojo.Deferred
  12270. // for the request with the topic.
  12271. // done: String
  12272. // "/dojo/io/done" is sent whenever an IO request has completed,
  12273. // either by loading or by erroring. It passes the error and
  12274. // the dojo.Deferred for the request with the topic.
  12275. // stop: String
  12276. // "/dojo/io/stop" is sent when all outstanding IO requests have
  12277. // finished. No arguments are passed with this topic.
  12278. });
  12279. =====*/
  12280. dojo._ioSetArgs = function(/*dojo/main.__IoArgs*/args,
  12281. /*Function*/canceller,
  12282. /*Function*/okHandler,
  12283. /*Function*/errHandler){
  12284. // summary:
  12285. // sets up the Deferred and ioArgs property on the Deferred so it
  12286. // can be used in an io call.
  12287. // args:
  12288. // The args object passed into the public io call. Recognized properties on
  12289. // the args object are:
  12290. // canceller:
  12291. // The canceller function used for the Deferred object. The function
  12292. // will receive one argument, the Deferred object that is related to the
  12293. // canceller.
  12294. // okHandler:
  12295. // The first OK callback to be registered with Deferred. It has the opportunity
  12296. // to transform the OK response. It will receive one argument -- the Deferred
  12297. // object returned from this function.
  12298. // errHandler:
  12299. // The first error callback to be registered with Deferred. It has the opportunity
  12300. // to do cleanup on an error. It will receive two arguments: error (the
  12301. // Error object) and dfd, the Deferred object returned from this function.
  12302. var ioArgs = {args: args, url: args.url};
  12303. //Get values from form if requested.
  12304. var formObject = null;
  12305. if(args.form){
  12306. var form = dom.byId(args.form);
  12307. //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
  12308. //so use it for all. See #2844
  12309. var actnNode = form.getAttributeNode("action");
  12310. ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : null);
  12311. formObject = domForm.toObject(form);
  12312. }
  12313. // set up the query params
  12314. var miArgs = [{}];
  12315. if(formObject){
  12316. // potentially over-ride url-provided params w/ form values
  12317. miArgs.push(formObject);
  12318. }
  12319. if(args.content){
  12320. // stuff in content over-rides what's set by form
  12321. miArgs.push(args.content);
  12322. }
  12323. if(args.preventCache){
  12324. miArgs.push({"dojo.preventCache": new Date().valueOf()});
  12325. }
  12326. ioArgs.query = ioq.objectToQuery(lang.mixin.apply(null, miArgs));
  12327. // .. and the real work of getting the deferred in order, etc.
  12328. ioArgs.handleAs = args.handleAs || "text";
  12329. var d = new Deferred(function(dfd){
  12330. dfd.canceled = true;
  12331. canceller && canceller(dfd);
  12332. var err = dfd.ioArgs.error;
  12333. if(!err){
  12334. err = new Error("request cancelled");
  12335. err.dojoType="cancel";
  12336. dfd.ioArgs.error = err;
  12337. }
  12338. return err;
  12339. });
  12340. d.addCallback(okHandler);
  12341. //Support specifying load, error and handle callback functions from the args.
  12342. //For those callbacks, the "this" object will be the args object.
  12343. //The callbacks will get the deferred result value as the
  12344. //first argument and the ioArgs object as the second argument.
  12345. var ld = args.load;
  12346. if(ld && lang.isFunction(ld)){
  12347. d.addCallback(function(value){
  12348. return ld.call(args, value, ioArgs);
  12349. });
  12350. }
  12351. var err = args.error;
  12352. if(err && lang.isFunction(err)){
  12353. d.addErrback(function(value){
  12354. return err.call(args, value, ioArgs);
  12355. });
  12356. }
  12357. var handle = args.handle;
  12358. if(handle && lang.isFunction(handle)){
  12359. d.addBoth(function(value){
  12360. return handle.call(args, value, ioArgs);
  12361. });
  12362. }
  12363. // Attach error handler last (not including topic publishing)
  12364. // to catch any errors that may have been generated from load
  12365. // or handle functions.
  12366. d.addErrback(function(error){
  12367. return errHandler(error, d);
  12368. });
  12369. //Plug in topic publishing, if dojo.publish is loaded.
  12370. if(cfg.ioPublish && dojo.publish && ioArgs.args.ioPublish !== false){
  12371. d.addCallbacks(
  12372. function(res){
  12373. dojo.publish("/dojo/io/load", [d, res]);
  12374. return res;
  12375. },
  12376. function(res){
  12377. dojo.publish("/dojo/io/error", [d, res]);
  12378. return res;
  12379. }
  12380. );
  12381. d.addBoth(function(res){
  12382. dojo.publish("/dojo/io/done", [d, res]);
  12383. return res;
  12384. });
  12385. }
  12386. d.ioArgs = ioArgs;
  12387. // FIXME: need to wire up the xhr object's abort method to something
  12388. // analogous in the Deferred
  12389. return d;
  12390. };
  12391. var _deferredOk = function(/*Deferred*/dfd){
  12392. // summary:
  12393. // okHandler function for dojo._ioSetArgs call.
  12394. var ret = handlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr);
  12395. return ret === undefined ? null : ret;
  12396. };
  12397. var _deferError = function(/*Error*/error, /*Deferred*/dfd){
  12398. // summary:
  12399. // errHandler function for dojo._ioSetArgs call.
  12400. if(!dfd.ioArgs.args.failOk){
  12401. console.error(error);
  12402. }
  12403. return error;
  12404. };
  12405. //Use a separate count for knowing if we are starting/stopping io calls.
  12406. var _checkPubCount = function(dfd){
  12407. if(_pubCount <= 0){
  12408. _pubCount = 0;
  12409. if(cfg.ioPublish && dojo.publish && (!dfd || dfd && dfd.ioArgs.args.ioPublish !== false)){
  12410. dojo.publish("/dojo/io/stop");
  12411. }
  12412. }
  12413. };
  12414. var _pubCount = 0;
  12415. aspect.after(watch, "_onAction", function(){
  12416. _pubCount -= 1;
  12417. });
  12418. aspect.after(watch, "_onInFlight", _checkPubCount);
  12419. dojo._ioCancelAll = watch.cancelAll;
  12420. /*=====
  12421. dojo._ioCancelAll = function(){
  12422. // summary:
  12423. // Cancels all pending IO requests, regardless of IO type
  12424. // (xhr, script, iframe).
  12425. };
  12426. =====*/
  12427. dojo._ioNotifyStart = function(/*Deferred*/dfd){
  12428. // summary:
  12429. // If dojo.publish is available, publish topics
  12430. // about the start of a request queue and/or the
  12431. // the beginning of request.
  12432. //
  12433. // Used by IO transports. An IO transport should
  12434. // call this method before making the network connection.
  12435. if(cfg.ioPublish && dojo.publish && dfd.ioArgs.args.ioPublish !== false){
  12436. if(!_pubCount){
  12437. dojo.publish("/dojo/io/start");
  12438. }
  12439. _pubCount += 1;
  12440. dojo.publish("/dojo/io/send", [dfd]);
  12441. }
  12442. };
  12443. dojo._ioWatch = function(dfd, validCheck, ioCheck, resHandle){
  12444. // summary:
  12445. // Watches the io request represented by dfd to see if it completes.
  12446. // dfd: Deferred
  12447. // The Deferred object to watch.
  12448. // validCheck: Function
  12449. // Function used to check if the IO request is still valid. Gets the dfd
  12450. // object as its only argument.
  12451. // ioCheck: Function
  12452. // Function used to check if basic IO call worked. Gets the dfd
  12453. // object as its only argument.
  12454. // resHandle: Function
  12455. // Function used to process response. Gets the dfd
  12456. // object as its only argument.
  12457. var args = dfd.ioArgs.options = dfd.ioArgs.args;
  12458. lang.mixin(dfd, {
  12459. response: dfd.ioArgs,
  12460. isValid: function(response){
  12461. return validCheck(dfd);
  12462. },
  12463. isReady: function(response){
  12464. return ioCheck(dfd);
  12465. },
  12466. handleResponse: function(response){
  12467. return resHandle(dfd);
  12468. }
  12469. });
  12470. watch(dfd);
  12471. _checkPubCount(dfd);
  12472. };
  12473. var _defaultContentType = "application/x-www-form-urlencoded";
  12474. dojo._ioAddQueryToUrl = function(/*dojo.__IoCallbackArgs*/ioArgs){
  12475. // summary:
  12476. // Adds query params discovered by the io deferred construction to the URL.
  12477. // Only use this for operations which are fundamentally GET-type operations.
  12478. if(ioArgs.query.length){
  12479. ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
  12480. ioArgs.query = null;
  12481. }
  12482. };
  12483. /*=====
  12484. dojo.__XhrArgs = declare(dojo.__IoArgs, {
  12485. // summary:
  12486. // In addition to the properties listed for the dojo._IoArgs type,
  12487. // the following properties are allowed for dojo.xhr* methods.
  12488. // handleAs: String?
  12489. // Acceptable values are: text (default), json, json-comment-optional,
  12490. // json-comment-filtered, javascript, xml. See `dojo/_base/xhr.contentHandlers`
  12491. // sync: Boolean?
  12492. // false is default. Indicates whether the request should
  12493. // be a synchronous (blocking) request.
  12494. // headers: Object?
  12495. // Additional HTTP headers to send in the request.
  12496. // failOk: Boolean?
  12497. // false is default. Indicates whether a request should be
  12498. // allowed to fail (and therefore no console error message in
  12499. // the event of a failure)
  12500. // contentType: String|Boolean
  12501. // "application/x-www-form-urlencoded" is default. Set to false to
  12502. // prevent a Content-Type header from being sent, or to a string
  12503. // to send a different Content-Type.
  12504. });
  12505. =====*/
  12506. dojo.xhr = function(/*String*/ method, /*dojo.__XhrArgs*/ args, /*Boolean?*/ hasBody){
  12507. // summary:
  12508. // Deprecated. Use dojo/request instead.
  12509. // description:
  12510. // Sends an HTTP request with the given method.
  12511. // See also dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts
  12512. // for those HTTP methods. There are also methods for "raw" PUT and POST methods
  12513. // via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
  12514. // method:
  12515. // HTTP method to be used, such as GET, POST, PUT, DELETE. Should be uppercase.
  12516. // hasBody:
  12517. // If the request has an HTTP body, then pass true for hasBody.
  12518. var rDfd;
  12519. //Make the Deferred object for this xhr request.
  12520. var dfd = dojo._ioSetArgs(args, function(dfd){
  12521. rDfd && rDfd.cancel();
  12522. }, _deferredOk, _deferError);
  12523. var ioArgs = dfd.ioArgs;
  12524. //Allow for specifying the HTTP body completely.
  12525. if("postData" in args){
  12526. ioArgs.query = args.postData;
  12527. }else if("putData" in args){
  12528. ioArgs.query = args.putData;
  12529. }else if("rawBody" in args){
  12530. ioArgs.query = args.rawBody;
  12531. }else if((arguments.length > 2 && !hasBody) || "POST|PUT".indexOf(method.toUpperCase()) === -1){
  12532. //Check for hasBody being passed. If no hasBody,
  12533. //then only append query string if not a POST or PUT request.
  12534. dojo._ioAddQueryToUrl(ioArgs);
  12535. }
  12536. var options = {
  12537. method: method,
  12538. handleAs: "text",
  12539. timeout: args.timeout,
  12540. withCredentials: args.withCredentials,
  12541. ioArgs: ioArgs
  12542. };
  12543. if(typeof args.headers !== 'undefined'){
  12544. options.headers = args.headers;
  12545. }
  12546. if(typeof args.contentType !== 'undefined'){
  12547. if(!options.headers){
  12548. options.headers = {};
  12549. }
  12550. options.headers['Content-Type'] = args.contentType;
  12551. }
  12552. if(typeof ioArgs.query !== 'undefined'){
  12553. options.data = ioArgs.query;
  12554. }
  12555. if(typeof args.sync !== 'undefined'){
  12556. options.sync = args.sync;
  12557. }
  12558. dojo._ioNotifyStart(dfd);
  12559. try{
  12560. rDfd = _xhr(ioArgs.url, options, true);
  12561. }catch(e){
  12562. // If XHR creation fails, dojo/request/xhr throws
  12563. // When this happens, cancel the deferred
  12564. dfd.cancel();
  12565. return dfd;
  12566. }
  12567. // sync ioArgs
  12568. dfd.ioArgs.xhr = rDfd.response.xhr;
  12569. rDfd.then(function(){
  12570. dfd.resolve(dfd);
  12571. }).otherwise(function(error){
  12572. ioArgs.error = error;
  12573. if(error.response){
  12574. error.status = error.response.status;
  12575. error.responseText = error.response.text;
  12576. error.xhr = error.response.xhr;
  12577. }
  12578. dfd.reject(error);
  12579. });
  12580. return dfd; // dojo/_base/Deferred
  12581. };
  12582. dojo.xhrGet = function(/*dojo.__XhrArgs*/ args){
  12583. // summary:
  12584. // Sends an HTTP GET request to the server.
  12585. return dojo.xhr("GET", args); // dojo/_base/Deferred
  12586. };
  12587. dojo.rawXhrPost = dojo.xhrPost = function(/*dojo.__XhrArgs*/ args){
  12588. // summary:
  12589. // Sends an HTTP POST request to the server. In addition to the properties
  12590. // listed for the dojo.__XhrArgs type, the following property is allowed:
  12591. // postData:
  12592. // String. Send raw data in the body of the POST request.
  12593. return dojo.xhr("POST", args, true); // dojo/_base/Deferred
  12594. };
  12595. dojo.rawXhrPut = dojo.xhrPut = function(/*dojo.__XhrArgs*/ args){
  12596. // summary:
  12597. // Sends an HTTP PUT request to the server. In addition to the properties
  12598. // listed for the dojo.__XhrArgs type, the following property is allowed:
  12599. // putData:
  12600. // String. Send raw data in the body of the PUT request.
  12601. return dojo.xhr("PUT", args, true); // dojo/_base/Deferred
  12602. };
  12603. dojo.xhrDelete = function(/*dojo.__XhrArgs*/ args){
  12604. // summary:
  12605. // Sends an HTTP DELETE request to the server.
  12606. return dojo.xhr("DELETE", args); // dojo/_base/Deferred
  12607. };
  12608. /*
  12609. dojo.wrapForm = function(formNode){
  12610. // summary:
  12611. // A replacement for FormBind, but not implemented yet.
  12612. // FIXME: need to think harder about what extensions to this we might
  12613. // want. What should we allow folks to do w/ this? What events to
  12614. // set/send?
  12615. throw new Error("dojo.wrapForm not yet implemented");
  12616. }
  12617. */
  12618. dojo._isDocumentOk = function(x){
  12619. return util.checkStatus(x.status);
  12620. };
  12621. dojo._getText = function(url){
  12622. var result;
  12623. dojo.xhrGet({url:url, sync:true, load:function(text){
  12624. result = text;
  12625. }});
  12626. return result;
  12627. };
  12628. // Add aliases for static functions to dojo.xhr since dojo.xhr is what's returned from this module
  12629. lang.mixin(dojo.xhr, {
  12630. _xhrObj: dojo._xhrObj,
  12631. fieldToObject: domForm.fieldToObject,
  12632. formToObject: domForm.toObject,
  12633. objectToQuery: ioq.objectToQuery,
  12634. formToQuery: domForm.toQuery,
  12635. formToJson: domForm.toJson,
  12636. queryToObject: ioq.queryToObject,
  12637. contentHandlers: handlers,
  12638. _ioSetArgs: dojo._ioSetArgs,
  12639. _ioCancelAll: dojo._ioCancelAll,
  12640. _ioNotifyStart: dojo._ioNotifyStart,
  12641. _ioWatch: dojo._ioWatch,
  12642. _ioAddQueryToUrl: dojo._ioAddQueryToUrl,
  12643. _isDocumentOk: dojo._isDocumentOk,
  12644. _getText: dojo._getText,
  12645. get: dojo.xhrGet,
  12646. post: dojo.xhrPost,
  12647. put: dojo.xhrPut,
  12648. del: dojo.xhrDelete // because "delete" is a reserved word
  12649. });
  12650. return dojo.xhr;
  12651. });
  12652. },
  12653. 'dojo/loadInit':function(){
  12654. define("dojo/loadInit", ["./_base/loader"], function(loader){
  12655. return {
  12656. dynamic:0,
  12657. normalize:function(id){return id;},
  12658. load:loader.loadInit
  12659. };
  12660. });
  12661. },
  12662. 'dojo/_base/unload':function(){
  12663. define(["./kernel", "./lang", "../on"], function(dojo, lang, on){
  12664. // module:
  12665. // dojo/unload
  12666. var win = window;
  12667. var unload = {
  12668. // summary:
  12669. // This module contains the document and window unload detection API.
  12670. addOnWindowUnload: function(/*Object|Function?*/ obj, /*String|Function?*/ functionName){
  12671. // summary:
  12672. // registers a function to be triggered when window.onunload
  12673. // fires.
  12674. // description:
  12675. // The first time that addOnWindowUnload is called Dojo
  12676. // will register a page listener to trigger your unload
  12677. // handler with. Note that registering these handlers may
  12678. // destroy "fastback" page caching in browsers that support
  12679. // it. Be careful trying to modify the DOM or access
  12680. // JavaScript properties during this phase of page unloading:
  12681. // they may not always be available. Consider
  12682. // addOnUnload() if you need to modify the DOM or do
  12683. // heavy JavaScript work since it fires at the equivalent of
  12684. // the page's "onbeforeunload" event.
  12685. // example:
  12686. // | unload.addOnWindowUnload(functionPointer)
  12687. // | unload.addOnWindowUnload(object, "functionName");
  12688. // | unload.addOnWindowUnload(object, function(){ /* ... */});
  12689. if (!dojo.windowUnloaded){
  12690. on(win, "unload", (dojo.windowUnloaded = function(){
  12691. // summary:
  12692. // signal fired by impending window destruction. You may use
  12693. // dojo.addOnWindowUnload() to register a listener for this
  12694. // event. NOTE: if you wish to dojo.connect() to this method
  12695. // to perform page/application cleanup, be aware that this
  12696. // event WILL NOT fire if no handler has been registered with
  12697. // addOnWindowUnload(). This behavior started in Dojo 1.3.
  12698. // Previous versions always triggered windowUnloaded(). See
  12699. // addOnWindowUnload for more info.
  12700. }));
  12701. }
  12702. on(win, "unload", lang.hitch(obj, functionName));
  12703. },
  12704. addOnUnload: function(/*Object?|Function?*/ obj, /*String|Function?*/ functionName){
  12705. // summary:
  12706. // registers a function to be triggered when the page unloads.
  12707. // description:
  12708. // The first time that addOnUnload is called Dojo will
  12709. // register a page listener to trigger your unload handler
  12710. // with.
  12711. //
  12712. // In a browser environment, the functions will be triggered
  12713. // during the window.onbeforeunload event. Be careful of doing
  12714. // too much work in an unload handler. onbeforeunload can be
  12715. // triggered if a link to download a file is clicked, or if
  12716. // the link is a javascript: link. In these cases, the
  12717. // onbeforeunload event fires, but the document is not
  12718. // actually destroyed. So be careful about doing destructive
  12719. // operations in a dojo.addOnUnload callback.
  12720. //
  12721. // Further note that calling dojo.addOnUnload will prevent
  12722. // browsers from using a "fast back" cache to make page
  12723. // loading via back button instantaneous.
  12724. // example:
  12725. // | dojo.addOnUnload(functionPointer)
  12726. // | dojo.addOnUnload(object, "functionName")
  12727. // | dojo.addOnUnload(object, function(){ /* ... */});
  12728. on(win, "beforeunload", lang.hitch(obj, functionName));
  12729. }
  12730. };
  12731. dojo.addOnWindowUnload = unload.addOnWindowUnload;
  12732. dojo.addOnUnload = unload.addOnUnload;
  12733. return unload;
  12734. });
  12735. },
  12736. 'dojo/Deferred':function(){
  12737. define([
  12738. "./has",
  12739. "./_base/lang",
  12740. "./errors/CancelError",
  12741. "./promise/Promise",
  12742. "./promise/instrumentation"
  12743. ], function(has, lang, CancelError, Promise, instrumentation){
  12744. "use strict";
  12745. // module:
  12746. // dojo/Deferred
  12747. var PROGRESS = 0,
  12748. RESOLVED = 1,
  12749. REJECTED = 2;
  12750. var FULFILLED_ERROR_MESSAGE = "This deferred has already been fulfilled.";
  12751. var freezeObject = Object.freeze || function(){};
  12752. var signalWaiting = function(waiting, type, result, rejection, deferred){
  12753. if( 1 ){
  12754. if(type === REJECTED && Deferred.instrumentRejected && waiting.length === 0){
  12755. Deferred.instrumentRejected(result, false, rejection, deferred);
  12756. }
  12757. }
  12758. for(var i = 0; i < waiting.length; i++){
  12759. signalListener(waiting[i], type, result, rejection);
  12760. }
  12761. };
  12762. var signalListener = function(listener, type, result, rejection){
  12763. var func = listener[type];
  12764. var deferred = listener.deferred;
  12765. if(func){
  12766. try{
  12767. var newResult = func(result);
  12768. if(type === PROGRESS){
  12769. if(typeof newResult !== "undefined"){
  12770. signalDeferred(deferred, type, newResult);
  12771. }
  12772. }else{
  12773. if(newResult && typeof newResult.then === "function"){
  12774. listener.cancel = newResult.cancel;
  12775. newResult.then(
  12776. // Only make resolvers if they're actually going to be used
  12777. makeDeferredSignaler(deferred, RESOLVED),
  12778. makeDeferredSignaler(deferred, REJECTED),
  12779. makeDeferredSignaler(deferred, PROGRESS));
  12780. return;
  12781. }
  12782. signalDeferred(deferred, RESOLVED, newResult);
  12783. }
  12784. }catch(error){
  12785. signalDeferred(deferred, REJECTED, error);
  12786. }
  12787. }else{
  12788. signalDeferred(deferred, type, result);
  12789. }
  12790. if( 1 ){
  12791. if(type === REJECTED && Deferred.instrumentRejected){
  12792. Deferred.instrumentRejected(result, !!func, rejection, deferred.promise);
  12793. }
  12794. }
  12795. };
  12796. var makeDeferredSignaler = function(deferred, type){
  12797. return function(value){
  12798. signalDeferred(deferred, type, value);
  12799. };
  12800. };
  12801. var signalDeferred = function(deferred, type, result){
  12802. if(!deferred.isCanceled()){
  12803. switch(type){
  12804. case PROGRESS:
  12805. deferred.progress(result);
  12806. break;
  12807. case RESOLVED:
  12808. deferred.resolve(result);
  12809. break;
  12810. case REJECTED:
  12811. deferred.reject(result);
  12812. break;
  12813. }
  12814. }
  12815. };
  12816. var Deferred = function(canceler){
  12817. // summary:
  12818. // Creates a new deferred. This API is preferred over
  12819. // `dojo/_base/Deferred`.
  12820. // description:
  12821. // Creates a new deferred, as an abstraction over (primarily)
  12822. // asynchronous operations. The deferred is the private interface
  12823. // that should not be returned to calling code. That's what the
  12824. // `promise` is for. See `dojo/promise/Promise`.
  12825. // canceler: Function?
  12826. // Will be invoked if the deferred is canceled. The canceler
  12827. // receives the reason the deferred was canceled as its argument.
  12828. // The deferred is rejected with its return value, or a new
  12829. // `dojo/errors/CancelError` instance.
  12830. // promise: dojo/promise/Promise
  12831. // The public promise object that clients can add callbacks to.
  12832. var promise = this.promise = new Promise();
  12833. var deferred = this;
  12834. var fulfilled, result, rejection;
  12835. var canceled = false;
  12836. var waiting = [];
  12837. if( 1 && Error.captureStackTrace){
  12838. Error.captureStackTrace(deferred, Deferred);
  12839. Error.captureStackTrace(promise, Deferred);
  12840. }
  12841. this.isResolved = promise.isResolved = function(){
  12842. // summary:
  12843. // Checks whether the deferred has been resolved.
  12844. // returns: Boolean
  12845. return fulfilled === RESOLVED;
  12846. };
  12847. this.isRejected = promise.isRejected = function(){
  12848. // summary:
  12849. // Checks whether the deferred has been rejected.
  12850. // returns: Boolean
  12851. return fulfilled === REJECTED;
  12852. };
  12853. this.isFulfilled = promise.isFulfilled = function(){
  12854. // summary:
  12855. // Checks whether the deferred has been resolved or rejected.
  12856. // returns: Boolean
  12857. return !!fulfilled;
  12858. };
  12859. this.isCanceled = promise.isCanceled = function(){
  12860. // summary:
  12861. // Checks whether the deferred has been canceled.
  12862. // returns: Boolean
  12863. return canceled;
  12864. };
  12865. this.progress = function(update, strict){
  12866. // summary:
  12867. // Emit a progress update on the deferred.
  12868. // description:
  12869. // Emit a progress update on the deferred. Progress updates
  12870. // can be used to communicate updates about the asynchronous
  12871. // operation before it has finished.
  12872. // update: any
  12873. // The progress update. Passed to progbacks.
  12874. // strict: Boolean?
  12875. // If strict, will throw an error if the deferred has already
  12876. // been fulfilled and consequently no progress can be emitted.
  12877. // returns: dojo/promise/Promise
  12878. // Returns the original promise for the deferred.
  12879. if(!fulfilled){
  12880. signalWaiting(waiting, PROGRESS, update, null, deferred);
  12881. return promise;
  12882. }else if(strict === true){
  12883. throw new Error(FULFILLED_ERROR_MESSAGE);
  12884. }else{
  12885. return promise;
  12886. }
  12887. };
  12888. this.resolve = function(value, strict){
  12889. // summary:
  12890. // Resolve the deferred.
  12891. // description:
  12892. // Resolve the deferred, putting it in a success state.
  12893. // value: any
  12894. // The result of the deferred. Passed to callbacks.
  12895. // strict: Boolean?
  12896. // If strict, will throw an error if the deferred has already
  12897. // been fulfilled and consequently cannot be resolved.
  12898. // returns: dojo/promise/Promise
  12899. // Returns the original promise for the deferred.
  12900. if(!fulfilled){
  12901. // Set fulfilled, store value. After signaling waiting listeners unset
  12902. // waiting.
  12903. signalWaiting(waiting, fulfilled = RESOLVED, result = value, null, deferred);
  12904. waiting = null;
  12905. return promise;
  12906. }else if(strict === true){
  12907. throw new Error(FULFILLED_ERROR_MESSAGE);
  12908. }else{
  12909. return promise;
  12910. }
  12911. };
  12912. var reject = this.reject = function(error, strict){
  12913. // summary:
  12914. // Reject the deferred.
  12915. // description:
  12916. // Reject the deferred, putting it in an error state.
  12917. // error: any
  12918. // The error result of the deferred. Passed to errbacks.
  12919. // strict: Boolean?
  12920. // If strict, will throw an error if the deferred has already
  12921. // been fulfilled and consequently cannot be rejected.
  12922. // returns: dojo/promise/Promise
  12923. // Returns the original promise for the deferred.
  12924. if(!fulfilled){
  12925. if( 1 && Error.captureStackTrace){
  12926. Error.captureStackTrace(rejection = {}, reject);
  12927. }
  12928. signalWaiting(waiting, fulfilled = REJECTED, result = error, rejection, deferred);
  12929. waiting = null;
  12930. return promise;
  12931. }else if(strict === true){
  12932. throw new Error(FULFILLED_ERROR_MESSAGE);
  12933. }else{
  12934. return promise;
  12935. }
  12936. };
  12937. this.then = promise.then = function(callback, errback, progback){
  12938. // summary:
  12939. // Add new callbacks to the deferred.
  12940. // description:
  12941. // Add new callbacks to the deferred. Callbacks can be added
  12942. // before or after the deferred is fulfilled.
  12943. // callback: Function?
  12944. // Callback to be invoked when the promise is resolved.
  12945. // Receives the resolution value.
  12946. // errback: Function?
  12947. // Callback to be invoked when the promise is rejected.
  12948. // Receives the rejection error.
  12949. // progback: Function?
  12950. // Callback to be invoked when the promise emits a progress
  12951. // update. Receives the progress update.
  12952. // returns: dojo/promise/Promise
  12953. // Returns a new promise for the result of the callback(s).
  12954. // This can be used for chaining many asynchronous operations.
  12955. var listener = [progback, callback, errback];
  12956. // Ensure we cancel the promise we're waiting for, or if callback/errback
  12957. // have returned a promise, cancel that one.
  12958. listener.cancel = promise.cancel;
  12959. listener.deferred = new Deferred(function(reason){
  12960. // Check whether cancel is really available, returned promises are not
  12961. // required to expose `cancel`
  12962. return listener.cancel && listener.cancel(reason);
  12963. });
  12964. if(fulfilled && !waiting){
  12965. signalListener(listener, fulfilled, result, rejection);
  12966. }else{
  12967. waiting.push(listener);
  12968. }
  12969. return listener.deferred.promise;
  12970. };
  12971. this.cancel = promise.cancel = function(reason, strict){
  12972. // summary:
  12973. // Inform the deferred it may cancel its asynchronous operation.
  12974. // description:
  12975. // Inform the deferred it may cancel its asynchronous operation.
  12976. // The deferred's (optional) canceler is invoked and the
  12977. // deferred will be left in a rejected state. Can affect other
  12978. // promises that originate with the same deferred.
  12979. // reason: any
  12980. // A message that may be sent to the deferred's canceler,
  12981. // explaining why it's being canceled.
  12982. // strict: Boolean?
  12983. // If strict, will throw an error if the deferred has already
  12984. // been fulfilled and consequently cannot be canceled.
  12985. // returns: any
  12986. // Returns the rejection reason if the deferred was canceled
  12987. // normally.
  12988. if(!fulfilled){
  12989. // Cancel can be called even after the deferred is fulfilled
  12990. if(canceler){
  12991. var returnedReason = canceler(reason);
  12992. reason = typeof returnedReason === "undefined" ? reason : returnedReason;
  12993. }
  12994. canceled = true;
  12995. if(!fulfilled){
  12996. // Allow canceler to provide its own reason, but fall back to a CancelError
  12997. if(typeof reason === "undefined"){
  12998. reason = new CancelError();
  12999. }
  13000. reject(reason);
  13001. return reason;
  13002. }else if(fulfilled === REJECTED && result === reason){
  13003. return reason;
  13004. }
  13005. }else if(strict === true){
  13006. throw new Error(FULFILLED_ERROR_MESSAGE);
  13007. }
  13008. };
  13009. freezeObject(promise);
  13010. };
  13011. Deferred.prototype.toString = function(){
  13012. // returns: String
  13013. // Returns `[object Deferred]`.
  13014. return "[object Deferred]";
  13015. };
  13016. if(instrumentation){
  13017. instrumentation(Deferred);
  13018. }
  13019. return Deferred;
  13020. });
  13021. },
  13022. 'dojo/_base/NodeList':function(){
  13023. define("dojo/_base/NodeList", ["./kernel", "../query", "./array", "./html", "../NodeList-dom"], function(dojo, query, array){
  13024. // module:
  13025. // dojo/_base/NodeList
  13026. /*=====
  13027. return {
  13028. // summary:
  13029. // This module extends dojo/NodeList with the legacy connect(), coords(),
  13030. // blur(), focus(), change(), click(), error(), keydown(), keypress(),
  13031. // keyup(), load(), mousedown(), mouseenter(), mouseleave(), mousemove(),
  13032. // mouseout(), mouseover(), mouseup(), and submit() methods.
  13033. };
  13034. =====*/
  13035. var NodeList = query.NodeList,
  13036. nlp = NodeList.prototype;
  13037. nlp.connect = NodeList._adaptAsForEach(function(){
  13038. // don't bind early to dojo.connect since we no longer explicitly depend on it
  13039. return dojo.connect.apply(this, arguments);
  13040. });
  13041. /*=====
  13042. nlp.connect = function(methodName, objOrFunc, funcName){
  13043. // summary:
  13044. // Attach event handlers to every item of the NodeList. Uses dojo.connect()
  13045. // so event properties are normalized.
  13046. //
  13047. // Application must manually require() "dojo/_base/connect" before using this method.
  13048. // methodName: String
  13049. // the name of the method to attach to. For DOM events, this should be
  13050. // the lower-case name of the event
  13051. // objOrFunc: Object|Function|String
  13052. // if 2 arguments are passed (methodName, objOrFunc), objOrFunc should
  13053. // reference a function or be the name of the function in the global
  13054. // namespace to attach. If 3 arguments are provided
  13055. // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
  13056. // locate the bound function in
  13057. // funcName: String?
  13058. // optional. A string naming the function in objOrFunc to bind to the
  13059. // event. May also be a function reference.
  13060. // example:
  13061. // add an onclick handler to every button on the page
  13062. // | query("div:nth-child(odd)").connect("onclick", function(e){
  13063. // | console.log("clicked!");
  13064. // | });
  13065. // example:
  13066. // attach foo.bar() to every odd div's onmouseover
  13067. // | query("div:nth-child(odd)").connect("onmouseover", foo, "bar");
  13068. return null; // NodeList
  13069. };
  13070. =====*/
  13071. nlp.coords = NodeList._adaptAsMap(dojo.coords);
  13072. /*=====
  13073. nlp.coords = function(){
  13074. // summary:
  13075. // Deprecated: Use position() for border-box x/y/w/h
  13076. // or marginBox() for margin-box w/h/l/t.
  13077. // Returns the box objects of all elements in a node list as
  13078. // an Array (*not* a NodeList). Acts like `domGeom.coords`, though assumes
  13079. // the node passed is each node in this list.
  13080. return []; // Array
  13081. };
  13082. =====*/
  13083. NodeList.events = [
  13084. // summary:
  13085. // list of all DOM events used in NodeList
  13086. "blur", "focus", "change", "click", "error", "keydown", "keypress",
  13087. "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
  13088. "mouseout", "mouseover", "mouseup", "submit"
  13089. ];
  13090. // FIXME: pseudo-doc the above automatically generated on-event functions
  13091. // syntactic sugar for DOM events
  13092. array.forEach(NodeList.events, function(evt){
  13093. var _oe = "on" + evt;
  13094. nlp[_oe] = function(a, b){
  13095. return this.connect(_oe, a, b);
  13096. };
  13097. // FIXME: should these events trigger publishes?
  13098. /*
  13099. return (a ? this.connect(_oe, a, b) :
  13100. this.forEach(function(n){
  13101. // FIXME:
  13102. // listeners get buried by
  13103. // addEventListener and can't be dug back
  13104. // out to be triggered externally.
  13105. // see:
  13106. // http://developer.mozilla.org/en/docs/DOM:element
  13107. console.log(n, evt, _oe);
  13108. // FIXME: need synthetic event support!
  13109. var _e = { target: n, faux: true, type: evt };
  13110. // dojo._event_listener._synthesizeEvent({}, { target: n, faux: true, type: evt });
  13111. try{ n[evt](_e); }catch(e){ console.log(e); }
  13112. try{ n[_oe](_e); }catch(e){ console.log(e); }
  13113. })
  13114. );
  13115. */
  13116. }
  13117. );
  13118. dojo.NodeList = NodeList;
  13119. return NodeList;
  13120. });
  13121. },
  13122. 'dojo/_base/Color':function(){
  13123. define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, ArrayUtil, config){
  13124. var Color = dojo.Color = function(/*Array|String|Object*/ color){
  13125. // summary:
  13126. // Takes a named string, hex string, array of rgb or rgba values,
  13127. // an object with r, g, b, and a properties, or another `Color` object
  13128. // and creates a new Color instance to work from.
  13129. //
  13130. // example:
  13131. // Work with a Color instance:
  13132. // | var c = new Color();
  13133. // | c.setColor([0,0,0]); // black
  13134. // | var hex = c.toHex(); // #000000
  13135. //
  13136. // example:
  13137. // Work with a node's color:
  13138. // | var color = dojo.style("someNode", "backgroundColor");
  13139. // | var n = new Color(color);
  13140. // | // adjust the color some
  13141. // | n.r *= .5;
  13142. // | console.log(n.toString()); // rgb(128, 255, 255);
  13143. if(color){ this.setColor(color); }
  13144. };
  13145. // FIXME:
  13146. // there's got to be a more space-efficient way to encode or discover
  13147. // these!! Use hex?
  13148. Color.named = {
  13149. // summary:
  13150. // Dictionary list of all CSS named colors, by name. Values are 3-item arrays with corresponding RG and B values.
  13151. "black": [0,0,0],
  13152. "silver": [192,192,192],
  13153. "gray": [128,128,128],
  13154. "white": [255,255,255],
  13155. "maroon": [128,0,0],
  13156. "red": [255,0,0],
  13157. "purple": [128,0,128],
  13158. "fuchsia":[255,0,255],
  13159. "green": [0,128,0],
  13160. "lime": [0,255,0],
  13161. "olive": [128,128,0],
  13162. "yellow": [255,255,0],
  13163. "navy": [0,0,128],
  13164. "blue": [0,0,255],
  13165. "teal": [0,128,128],
  13166. "aqua": [0,255,255],
  13167. "transparent": config.transparentColor || [0,0,0,0]
  13168. };
  13169. lang.extend(Color, {
  13170. r: 255, g: 255, b: 255, a: 1,
  13171. _set: function(r, g, b, a){
  13172. var t = this; t.r = r; t.g = g; t.b = b; t.a = a;
  13173. },
  13174. setColor: function(/*Array|String|Object*/ color){
  13175. // summary:
  13176. // Takes a named string, hex string, array of rgb or rgba values,
  13177. // an object with r, g, b, and a properties, or another `Color` object
  13178. // and sets this color instance to that value.
  13179. //
  13180. // example:
  13181. // | var c = new Color(); // no color
  13182. // | c.setColor("#ededed"); // greyish
  13183. if(lang.isString(color)){
  13184. Color.fromString(color, this);
  13185. }else if(lang.isArray(color)){
  13186. Color.fromArray(color, this);
  13187. }else{
  13188. this._set(color.r, color.g, color.b, color.a);
  13189. if(!(color instanceof Color)){ this.sanitize(); }
  13190. }
  13191. return this; // Color
  13192. },
  13193. sanitize: function(){
  13194. // summary:
  13195. // Ensures the object has correct attributes
  13196. // description:
  13197. // the default implementation does nothing, include dojo.colors to
  13198. // augment it with real checks
  13199. return this; // Color
  13200. },
  13201. toRgb: function(){
  13202. // summary:
  13203. // Returns 3 component array of rgb values
  13204. // example:
  13205. // | var c = new Color("#000000");
  13206. // | console.log(c.toRgb()); // [0,0,0]
  13207. var t = this;
  13208. return [t.r, t.g, t.b]; // Array
  13209. },
  13210. toRgba: function(){
  13211. // summary:
  13212. // Returns a 4 component array of rgba values from the color
  13213. // represented by this object.
  13214. var t = this;
  13215. return [t.r, t.g, t.b, t.a]; // Array
  13216. },
  13217. toHex: function(){
  13218. // summary:
  13219. // Returns a CSS color string in hexadecimal representation
  13220. // example:
  13221. // | console.log(new Color([0,0,0]).toHex()); // #000000
  13222. var arr = ArrayUtil.map(["r", "g", "b"], function(x){
  13223. var s = this[x].toString(16);
  13224. return s.length < 2 ? "0" + s : s;
  13225. }, this);
  13226. return "#" + arr.join(""); // String
  13227. },
  13228. toCss: function(/*Boolean?*/ includeAlpha){
  13229. // summary:
  13230. // Returns a css color string in rgb(a) representation
  13231. // example:
  13232. // | var c = new Color("#FFF").toCss();
  13233. // | console.log(c); // rgb('255','255','255')
  13234. var t = this, rgb = t.r + ", " + t.g + ", " + t.b;
  13235. return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")"; // String
  13236. },
  13237. toString: function(){
  13238. // summary:
  13239. // Returns a visual representation of the color
  13240. return this.toCss(true); // String
  13241. }
  13242. });
  13243. Color.blendColors = dojo.blendColors = function(
  13244. /*Color*/ start,
  13245. /*Color*/ end,
  13246. /*Number*/ weight,
  13247. /*Color?*/ obj
  13248. ){
  13249. // summary:
  13250. // Blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend,
  13251. // can reuse a previously allocated Color object for the result
  13252. var t = obj || new Color();
  13253. ArrayUtil.forEach(["r", "g", "b", "a"], function(x){
  13254. t[x] = start[x] + (end[x] - start[x]) * weight;
  13255. if(x != "a"){ t[x] = Math.round(t[x]); }
  13256. });
  13257. return t.sanitize(); // Color
  13258. };
  13259. Color.fromRgb = dojo.colorFromRgb = function(/*String*/ color, /*Color?*/ obj){
  13260. // summary:
  13261. // Returns a `Color` instance from a string of the form
  13262. // "rgb(...)" or "rgba(...)". Optionally accepts a `Color`
  13263. // object to update with the parsed value and return instead of
  13264. // creating a new object.
  13265. // returns:
  13266. // A Color object. If obj is passed, it will be the return value.
  13267. var m = color.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);
  13268. return m && Color.fromArray(m[1].split(/\s*,\s*/), obj); // Color
  13269. };
  13270. Color.fromHex = dojo.colorFromHex = function(/*String*/ color, /*Color?*/ obj){
  13271. // summary:
  13272. // Converts a hex string with a '#' prefix to a color object.
  13273. // Supports 12-bit #rgb shorthand. Optionally accepts a
  13274. // `Color` object to update with the parsed value.
  13275. //
  13276. // returns:
  13277. // A Color object. If obj is passed, it will be the return value.
  13278. //
  13279. // example:
  13280. // | var thing = dojo.colorFromHex("#ededed"); // grey, longhand
  13281. //
  13282. // example:
  13283. // | var thing = dojo.colorFromHex("#000"); // black, shorthand
  13284. var t = obj || new Color(),
  13285. bits = (color.length == 4) ? 4 : 8,
  13286. mask = (1 << bits) - 1;
  13287. color = Number("0x" + color.substr(1));
  13288. if(isNaN(color)){
  13289. return null; // Color
  13290. }
  13291. ArrayUtil.forEach(["b", "g", "r"], function(x){
  13292. var c = color & mask;
  13293. color >>= bits;
  13294. t[x] = bits == 4 ? 17 * c : c;
  13295. });
  13296. t.a = 1;
  13297. return t; // Color
  13298. };
  13299. Color.fromArray = dojo.colorFromArray = function(/*Array*/ a, /*Color?*/ obj){
  13300. // summary:
  13301. // Builds a `Color` from a 3 or 4 element array, mapping each
  13302. // element in sequence to the rgb(a) values of the color.
  13303. // example:
  13304. // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
  13305. // returns:
  13306. // A Color object. If obj is passed, it will be the return value.
  13307. var t = obj || new Color();
  13308. t._set(Number(a[0]), Number(a[1]), Number(a[2]), Number(a[3]));
  13309. if(isNaN(t.a)){ t.a = 1; }
  13310. return t.sanitize(); // Color
  13311. };
  13312. Color.fromString = dojo.colorFromString = function(/*String*/ str, /*Color?*/ obj){
  13313. // summary:
  13314. // Parses `str` for a color value. Accepts hex, rgb, and rgba
  13315. // style color values.
  13316. // description:
  13317. // Acceptable input values for str may include arrays of any form
  13318. // accepted by dojo.colorFromArray, hex strings such as "#aaaaaa", or
  13319. // rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10,
  13320. // 10, 50)"
  13321. // returns:
  13322. // A Color object. If obj is passed, it will be the return value.
  13323. var a = Color.named[str];
  13324. return a && Color.fromArray(a, obj) || Color.fromRgb(str, obj) || Color.fromHex(str, obj); // Color
  13325. };
  13326. return Color;
  13327. });
  13328. },
  13329. 'dojo/promise/instrumentation':function(){
  13330. define([
  13331. "./tracer",
  13332. "../has",
  13333. "../_base/lang",
  13334. "../_base/array"
  13335. ], function(tracer, has, lang, arrayUtil){
  13336. function logError(error, rejection, deferred){
  13337. var stack = "";
  13338. if(error && error.stack){
  13339. stack += error.stack;
  13340. }
  13341. if(rejection && rejection.stack){
  13342. stack += "\n ----------------------------------------\n rejected" + rejection.stack.split("\n").slice(1).join("\n").replace(/^\s+/, " ");
  13343. }
  13344. if(deferred && deferred.stack){
  13345. stack += "\n ----------------------------------------\n" + deferred.stack;
  13346. }
  13347. console.error(error, stack);
  13348. }
  13349. function reportRejections(error, handled, rejection, deferred){
  13350. if(!handled){
  13351. logError(error, rejection, deferred);
  13352. }
  13353. }
  13354. var errors = [];
  13355. var activeTimeout = false;
  13356. var unhandledWait = 1000;
  13357. function trackUnhandledRejections(error, handled, rejection, deferred){
  13358. if(handled){
  13359. arrayUtil.some(errors, function(obj, ix){
  13360. if(obj.error === error){
  13361. errors.splice(ix, 1);
  13362. return true;
  13363. }
  13364. });
  13365. }else if(!arrayUtil.some(errors, function(obj){ return obj.error === error; })){
  13366. errors.push({
  13367. error: error,
  13368. rejection: rejection,
  13369. deferred: deferred,
  13370. timestamp: new Date().getTime()
  13371. });
  13372. }
  13373. if(!activeTimeout){
  13374. activeTimeout = setTimeout(logRejected, unhandledWait);
  13375. }
  13376. }
  13377. function logRejected(){
  13378. var now = new Date().getTime();
  13379. var reportBefore = now - unhandledWait;
  13380. errors = arrayUtil.filter(errors, function(obj){
  13381. if(obj.timestamp < reportBefore){
  13382. logError(obj.error, obj.rejection, obj.deferred);
  13383. return false;
  13384. }
  13385. return true;
  13386. });
  13387. if(errors.length){
  13388. activeTimeout = setTimeout(logRejected, errors[0].timestamp + unhandledWait - now);
  13389. }
  13390. }
  13391. return function(Deferred){
  13392. // summary:
  13393. // Initialize instrumentation for the Deferred class.
  13394. // description:
  13395. // Initialize instrumentation for the Deferred class.
  13396. // Done automatically by `dojo/Deferred` if the
  13397. // `deferredInstrumentation` and `useDeferredInstrumentation`
  13398. // config options are set.
  13399. //
  13400. // Sets up `dojo/promise/tracer` to log to the console.
  13401. //
  13402. // Sets up instrumentation of rejected deferreds so unhandled
  13403. // errors are logged to the console.
  13404. var usage = has("config-useDeferredInstrumentation");
  13405. if(usage){
  13406. tracer.on("resolved", lang.hitch(console, "log", "resolved"));
  13407. tracer.on("rejected", lang.hitch(console, "log", "rejected"));
  13408. tracer.on("progress", lang.hitch(console, "log", "progress"));
  13409. var args = [];
  13410. if(typeof usage === "string"){
  13411. args = usage.split(",");
  13412. usage = args.shift();
  13413. }
  13414. if(usage === "report-rejections"){
  13415. Deferred.instrumentRejected = reportRejections;
  13416. }else if(usage === "report-unhandled-rejections" || usage === true || usage === 1){
  13417. Deferred.instrumentRejected = trackUnhandledRejections;
  13418. unhandledWait = parseInt(args[0], 10) || unhandledWait;
  13419. }else{
  13420. throw new Error("Unsupported instrumentation usage <" + usage + ">");
  13421. }
  13422. }
  13423. };
  13424. });
  13425. },
  13426. 'dojo/selector/_loader':function(){
  13427. define(["../has", "require"],
  13428. function(has, require){
  13429. "use strict";
  13430. var testDiv = document.createElement("div");
  13431. has.add("dom-qsa2.1", !!testDiv.querySelectorAll);
  13432. has.add("dom-qsa3", function(){
  13433. // test to see if we have a reasonable native selector engine available
  13434. try{
  13435. testDiv.innerHTML = "<p class='TEST'></p>"; // test kind of from sizzle
  13436. // Safari can't handle uppercase or unicode characters when
  13437. // in quirks mode, IE8 can't handle pseudos like :empty
  13438. return testDiv.querySelectorAll(".TEST:empty").length == 1;
  13439. }catch(e){}
  13440. });
  13441. var fullEngine;
  13442. var acme = "./acme", lite = "./lite";
  13443. return {
  13444. // summary:
  13445. // This module handles loading the appropriate selector engine for the given browser
  13446. load: function(id, parentRequire, loaded, config){
  13447. var req = require;
  13448. // here we implement the default logic for choosing a selector engine
  13449. id = id == "default" ? has("config-selectorEngine") || "css3" : id;
  13450. id = id == "css2" || id == "lite" ? lite :
  13451. id == "css2.1" ? has("dom-qsa2.1") ? lite : acme :
  13452. id == "css3" ? has("dom-qsa3") ? lite : acme :
  13453. id == "acme" ? acme : (req = parentRequire) && id;
  13454. if(id.charAt(id.length-1) == '?'){
  13455. id = id.substring(0,id.length - 1);
  13456. var optionalLoad = true;
  13457. }
  13458. // the query engine is optional, only load it if a native one is not available or existing one has not been loaded
  13459. if(optionalLoad && (has("dom-compliant-qsa") || fullEngine)){
  13460. return loaded(fullEngine);
  13461. }
  13462. // load the referenced selector engine
  13463. req([id], function(engine){
  13464. if(id != "./lite"){
  13465. fullEngine = engine;
  13466. }
  13467. loaded(engine);
  13468. });
  13469. }
  13470. };
  13471. });
  13472. },
  13473. 'dojo/promise/Promise':function(){
  13474. define([
  13475. "../_base/lang"
  13476. ], function(lang){
  13477. "use strict";
  13478. // module:
  13479. // dojo/promise/Promise
  13480. function throwAbstract(){
  13481. throw new TypeError("abstract");
  13482. }
  13483. return lang.extend(function Promise(){
  13484. // summary:
  13485. // The public interface to a deferred.
  13486. // description:
  13487. // The public interface to a deferred. All promises in Dojo are
  13488. // instances of this class.
  13489. }, {
  13490. then: function(callback, errback, progback){
  13491. // summary:
  13492. // Add new callbacks to the promise.
  13493. // description:
  13494. // Add new callbacks to the deferred. Callbacks can be added
  13495. // before or after the deferred is fulfilled.
  13496. // callback: Function?
  13497. // Callback to be invoked when the promise is resolved.
  13498. // Receives the resolution value.
  13499. // errback: Function?
  13500. // Callback to be invoked when the promise is rejected.
  13501. // Receives the rejection error.
  13502. // progback: Function?
  13503. // Callback to be invoked when the promise emits a progress
  13504. // update. Receives the progress update.
  13505. // returns: dojo/promise/Promise
  13506. // Returns a new promise for the result of the callback(s).
  13507. // This can be used for chaining many asynchronous operations.
  13508. throwAbstract();
  13509. },
  13510. cancel: function(reason, strict){
  13511. // summary:
  13512. // Inform the deferred it may cancel its asynchronous operation.
  13513. // description:
  13514. // Inform the deferred it may cancel its asynchronous operation.
  13515. // The deferred's (optional) canceler is invoked and the
  13516. // deferred will be left in a rejected state. Can affect other
  13517. // promises that originate with the same deferred.
  13518. // reason: any
  13519. // A message that may be sent to the deferred's canceler,
  13520. // explaining why it's being canceled.
  13521. // strict: Boolean?
  13522. // If strict, will throw an error if the deferred has already
  13523. // been fulfilled and consequently cannot be canceled.
  13524. // returns: any
  13525. // Returns the rejection reason if the deferred was canceled
  13526. // normally.
  13527. throwAbstract();
  13528. },
  13529. isResolved: function(){
  13530. // summary:
  13531. // Checks whether the promise has been resolved.
  13532. // returns: Boolean
  13533. throwAbstract();
  13534. },
  13535. isRejected: function(){
  13536. // summary:
  13537. // Checks whether the promise has been rejected.
  13538. // returns: Boolean
  13539. throwAbstract();
  13540. },
  13541. isFulfilled: function(){
  13542. // summary:
  13543. // Checks whether the promise has been resolved or rejected.
  13544. // returns: Boolean
  13545. throwAbstract();
  13546. },
  13547. isCanceled: function(){
  13548. // summary:
  13549. // Checks whether the promise has been canceled.
  13550. // returns: Boolean
  13551. throwAbstract();
  13552. },
  13553. always: function(callbackOrErrback){
  13554. // summary:
  13555. // Add a callback to be invoked when the promise is resolved
  13556. // or rejected.
  13557. // callbackOrErrback: Function?
  13558. // A function that is used both as a callback and errback.
  13559. // returns: dojo/promise/Promise
  13560. // Returns a new promise for the result of the callback/errback.
  13561. return this.then(callbackOrErrback, callbackOrErrback);
  13562. },
  13563. otherwise: function(errback){
  13564. // summary:
  13565. // Add new errbacks to the promise.
  13566. // errback: Function?
  13567. // Callback to be invoked when the promise is rejected.
  13568. // returns: dojo/promise/Promise
  13569. // Returns a new promise for the result of the errback.
  13570. return this.then(null, errback);
  13571. },
  13572. trace: function(){
  13573. return this;
  13574. },
  13575. traceRejected: function(){
  13576. return this;
  13577. },
  13578. toString: function(){
  13579. // returns: string
  13580. // Returns `[object Promise]`.
  13581. return "[object Promise]";
  13582. }
  13583. });
  13584. });
  13585. },
  13586. 'dojo/request/watch':function(){
  13587. define([
  13588. './util',
  13589. '../errors/RequestTimeoutError',
  13590. '../errors/CancelError',
  13591. '../_base/array',
  13592. '../_base/window',
  13593. '../has!host-browser?dom-addeventlistener?:../on:'
  13594. ], function(util, RequestTimeoutError, CancelError, array, win, on){
  13595. // avoid setting a timer per request. It degrades performance on IE
  13596. // something fierece if we don't use unified loops.
  13597. var _inFlightIntvl = null,
  13598. _inFlight = [];
  13599. function watchInFlight(){
  13600. // summary:
  13601. // internal method that checks each inflight XMLHttpRequest to see
  13602. // if it has completed or if the timeout situation applies.
  13603. var now = +(new Date);
  13604. // we need manual loop because we often modify _inFlight (and therefore 'i') while iterating
  13605. for(var i = 0, dfd; i < _inFlight.length && (dfd = _inFlight[i]); i++){
  13606. var response = dfd.response,
  13607. options = response.options;
  13608. if((dfd.isCanceled && dfd.isCanceled()) || (dfd.isValid && !dfd.isValid(response))){
  13609. _inFlight.splice(i--, 1);
  13610. watch._onAction && watch._onAction();
  13611. }else if(dfd.isReady && dfd.isReady(response)){
  13612. _inFlight.splice(i--, 1);
  13613. dfd.handleResponse(response);
  13614. watch._onAction && watch._onAction();
  13615. }else if(dfd.startTime){
  13616. // did we timeout?
  13617. if(dfd.startTime + (options.timeout || 0) < now){
  13618. _inFlight.splice(i--, 1);
  13619. // Cancel the request so the io module can do appropriate cleanup.
  13620. dfd.cancel(new RequestTimeoutError('Timeout exceeded', response));
  13621. watch._onAction && watch._onAction();
  13622. }
  13623. }
  13624. }
  13625. watch._onInFlight && watch._onInFlight(dfd);
  13626. if(!_inFlight.length){
  13627. clearInterval(_inFlightIntvl);
  13628. _inFlightIntvl = null;
  13629. }
  13630. }
  13631. function watch(dfd){
  13632. // summary:
  13633. // Watches the io request represented by dfd to see if it completes.
  13634. // dfd: Deferred
  13635. // The Deferred object to watch.
  13636. // response: Object
  13637. // The object used as the value of the request promise.
  13638. // validCheck: Function
  13639. // Function used to check if the IO request is still valid. Gets the dfd
  13640. // object as its only argument.
  13641. // ioCheck: Function
  13642. // Function used to check if basic IO call worked. Gets the dfd
  13643. // object as its only argument.
  13644. // resHandle: Function
  13645. // Function used to process response. Gets the dfd
  13646. // object as its only argument.
  13647. if(dfd.response.options.timeout){
  13648. dfd.startTime = +(new Date);
  13649. }
  13650. if(dfd.isFulfilled()){
  13651. // bail out if the deferred is already fulfilled
  13652. return;
  13653. }
  13654. _inFlight.push(dfd);
  13655. if(!_inFlightIntvl){
  13656. _inFlightIntvl = setInterval(watchInFlight, 50);
  13657. }
  13658. // handle sync requests separately from async:
  13659. // http://bugs.dojotoolkit.org/ticket/8467
  13660. if(dfd.response.options.sync){
  13661. watchInFlight();
  13662. }
  13663. }
  13664. watch.cancelAll = function cancelAll(){
  13665. // summary:
  13666. // Cancels all pending IO requests, regardless of IO type
  13667. try{
  13668. array.forEach(_inFlight, function(dfd){
  13669. try{
  13670. dfd.cancel(new CancelError('All requests canceled.'));
  13671. }catch(e){}
  13672. });
  13673. }catch(e){}
  13674. };
  13675. if(win && on && win.doc.attachEvent){
  13676. // Automatically call cancel all io calls on unload in IE
  13677. // http://bugs.dojotoolkit.org/ticket/2357
  13678. on(win.global, 'unload', function(){
  13679. watch.cancelAll();
  13680. });
  13681. }
  13682. return watch;
  13683. });
  13684. },
  13685. 'dojo/on':function(){
  13686. define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], function(aspect, dojo, has){
  13687. "use strict";
  13688. if( 1 ){ // check to make sure we are in a browser, this module should work anywhere
  13689. var major = window.ScriptEngineMajorVersion;
  13690. has.add("jscript", major && (major() + ScriptEngineMinorVersion() / 10));
  13691. has.add("event-orientationchange", has("touch") && !has("android")); // TODO: how do we detect this?
  13692. has.add("event-stopimmediatepropagation", window.Event && !!window.Event.prototype && !!window.Event.prototype.stopImmediatePropagation);
  13693. }
  13694. var on = function(target, type, listener, dontFix){
  13695. // summary:
  13696. // A function that provides core event listening functionality. With this function
  13697. // you can provide a target, event type, and listener to be notified of
  13698. // future matching events that are fired.
  13699. // target: Element|Object
  13700. // This is the target object or DOM element that to receive events from
  13701. // type: String|Function
  13702. // This is the name of the event to listen for or an extension event type.
  13703. // listener: Function
  13704. // This is the function that should be called when the event fires.
  13705. // returns: Object
  13706. // An object with a remove() method that can be used to stop listening for this
  13707. // event.
  13708. // description:
  13709. // To listen for "click" events on a button node, we can do:
  13710. // | define(["dojo/on"], function(listen){
  13711. // | on(button, "click", clickHandler);
  13712. // | ...
  13713. // Evented JavaScript objects can also have their own events.
  13714. // | var obj = new Evented;
  13715. // | on(obj, "foo", fooHandler);
  13716. // And then we could publish a "foo" event:
  13717. // | on.emit(obj, "foo", {key: "value"});
  13718. // We can use extension events as well. For example, you could listen for a tap gesture:
  13719. // | define(["dojo/on", "dojo/gesture/tap", function(listen, tap){
  13720. // | on(button, tap, tapHandler);
  13721. // | ...
  13722. // which would trigger fooHandler. Note that for a simple object this is equivalent to calling:
  13723. // | obj.onfoo({key:"value"});
  13724. // If you use on.emit on a DOM node, it will use native event dispatching when possible.
  13725. if(typeof target.on == "function" && typeof type != "function"){
  13726. // delegate to the target's on() method, so it can handle it's own listening if it wants
  13727. return target.on(type, listener);
  13728. }
  13729. // delegate to main listener code
  13730. return on.parse(target, type, listener, addListener, dontFix, this);
  13731. };
  13732. on.pausable = function(target, type, listener, dontFix){
  13733. // summary:
  13734. // This function acts the same as on(), but with pausable functionality. The
  13735. // returned signal object has pause() and resume() functions. Calling the
  13736. // pause() method will cause the listener to not be called for future events. Calling the
  13737. // resume() method will cause the listener to again be called for future events.
  13738. var paused;
  13739. var signal = on(target, type, function(){
  13740. if(!paused){
  13741. return listener.apply(this, arguments);
  13742. }
  13743. }, dontFix);
  13744. signal.pause = function(){
  13745. paused = true;
  13746. };
  13747. signal.resume = function(){
  13748. paused = false;
  13749. };
  13750. return signal;
  13751. };
  13752. on.once = function(target, type, listener, dontFix){
  13753. // summary:
  13754. // This function acts the same as on(), but will only call the listener once. The
  13755. // listener will be called for the first
  13756. // event that takes place and then listener will automatically be removed.
  13757. var signal = on(target, type, function(){
  13758. // remove this listener
  13759. signal.remove();
  13760. // proceed to call the listener
  13761. return listener.apply(this, arguments);
  13762. });
  13763. return signal;
  13764. };
  13765. on.parse = function(target, type, listener, addListener, dontFix, matchesTarget){
  13766. if(type.call){
  13767. // event handler function
  13768. // on(node, touch.press, touchListener);
  13769. return type.call(matchesTarget, target, listener);
  13770. }
  13771. if(type.indexOf(",") > -1){
  13772. // we allow comma delimited event names, so you can register for multiple events at once
  13773. var events = type.split(/\s*,\s*/);
  13774. var handles = [];
  13775. var i = 0;
  13776. var eventName;
  13777. while(eventName = events[i++]){
  13778. handles.push(addListener(target, eventName, listener, dontFix, matchesTarget));
  13779. }
  13780. handles.remove = function(){
  13781. for(var i = 0; i < handles.length; i++){
  13782. handles[i].remove();
  13783. }
  13784. };
  13785. return handles;
  13786. }
  13787. return addListener(target, type, listener, dontFix, matchesTarget);
  13788. };
  13789. var touchEvents = /^touch/;
  13790. function addListener(target, type, listener, dontFix, matchesTarget){
  13791. // event delegation:
  13792. var selector = type.match(/(.*):(.*)/);
  13793. // if we have a selector:event, the last one is interpreted as an event, and we use event delegation
  13794. if(selector){
  13795. type = selector[2];
  13796. selector = selector[1];
  13797. // create the extension event for selectors and directly call it
  13798. return on.selector(selector, type).call(matchesTarget, target, listener);
  13799. }
  13800. // test to see if it a touch event right now, so we don't have to do it every time it fires
  13801. if(has("touch")){
  13802. if(touchEvents.test(type)){
  13803. // touch event, fix it
  13804. listener = fixTouchListener(listener);
  13805. }
  13806. if(!has("event-orientationchange") && (type == "orientationchange")){
  13807. //"orientationchange" not supported <= Android 2.1,
  13808. //but works through "resize" on window
  13809. type = "resize";
  13810. target = window;
  13811. listener = fixTouchListener(listener);
  13812. }
  13813. }
  13814. if(addStopImmediate){
  13815. // add stopImmediatePropagation if it doesn't exist
  13816. listener = addStopImmediate(listener);
  13817. }
  13818. // normal path, the target is |this|
  13819. if(target.addEventListener){
  13820. // the target has addEventListener, which should be used if available (might or might not be a node, non-nodes can implement this method as well)
  13821. // check for capture conversions
  13822. var capture = type in captures,
  13823. adjustedType = capture ? captures[type] : type;
  13824. target.addEventListener(adjustedType, listener, capture);
  13825. // create and return the signal
  13826. return {
  13827. remove: function(){
  13828. target.removeEventListener(adjustedType, listener, capture);
  13829. }
  13830. };
  13831. }
  13832. type = "on" + type;
  13833. if(fixAttach && target.attachEvent){
  13834. return fixAttach(target, type, listener);
  13835. }
  13836. throw new Error("Target must be an event emitter");
  13837. }
  13838. on.selector = function(selector, eventType, children){
  13839. // summary:
  13840. // Creates a new extension event with event delegation. This is based on
  13841. // the provided event type (can be extension event) that
  13842. // only calls the listener when the CSS selector matches the target of the event.
  13843. //
  13844. // The application must require() an appropriate level of dojo/query to handle the selector.
  13845. // selector:
  13846. // The CSS selector to use for filter events and determine the |this| of the event listener.
  13847. // eventType:
  13848. // The event to listen for
  13849. // children:
  13850. // Indicates if children elements of the selector should be allowed. This defaults to
  13851. // true
  13852. // example:
  13853. // | require(["dojo/on", "dojo/mouse", "dojo/query!css2"], function(listen, mouse){
  13854. // | on(node, on.selector(".my-class", mouse.enter), handlerForMyHover);
  13855. return function(target, listener){
  13856. // if the selector is function, use it to select the node, otherwise use the matches method
  13857. var matchesTarget = typeof selector == "function" ? {matches: selector} : this,
  13858. bubble = eventType.bubble;
  13859. function select(eventTarget){
  13860. // see if we have a valid matchesTarget or default to dojo.query
  13861. matchesTarget = matchesTarget && matchesTarget.matches ? matchesTarget : dojo.query;
  13862. // there is a selector, so make sure it matches
  13863. while(!matchesTarget.matches(eventTarget, selector, target)){
  13864. if(eventTarget == target || children === false || !(eventTarget = eventTarget.parentNode) || eventTarget.nodeType != 1){ // intentional assignment
  13865. return;
  13866. }
  13867. }
  13868. return eventTarget;
  13869. }
  13870. if(bubble){
  13871. // the event type doesn't naturally bubble, but has a bubbling form, use that, and give it the selector so it can perform the select itself
  13872. return on(target, bubble(select), listener);
  13873. }
  13874. // standard event delegation
  13875. return on(target, eventType, function(event){
  13876. // call select to see if we match
  13877. var eventTarget = select(event.target);
  13878. // if it matches we call the listener
  13879. return eventTarget && listener.call(eventTarget, event);
  13880. });
  13881. };
  13882. };
  13883. function syntheticPreventDefault(){
  13884. this.cancelable = false;
  13885. }
  13886. function syntheticStopPropagation(){
  13887. this.bubbles = false;
  13888. }
  13889. var slice = [].slice,
  13890. syntheticDispatch = on.emit = function(target, type, event){
  13891. // summary:
  13892. // Fires an event on the target object.
  13893. // target:
  13894. // The target object to fire the event on. This can be a DOM element or a plain
  13895. // JS object. If the target is a DOM element, native event emiting mechanisms
  13896. // are used when possible.
  13897. // type:
  13898. // The event type name. You can emulate standard native events like "click" and
  13899. // "mouseover" or create custom events like "open" or "finish".
  13900. // event:
  13901. // An object that provides the properties for the event. See https://developer.mozilla.org/en/DOM/event.initEvent
  13902. // for some of the properties. These properties are copied to the event object.
  13903. // Of particular importance are the cancelable and bubbles properties. The
  13904. // cancelable property indicates whether or not the event has a default action
  13905. // that can be cancelled. The event is cancelled by calling preventDefault() on
  13906. // the event object. The bubbles property indicates whether or not the
  13907. // event will bubble up the DOM tree. If bubbles is true, the event will be called
  13908. // on the target and then each parent successively until the top of the tree
  13909. // is reached or stopPropagation() is called. Both bubbles and cancelable
  13910. // default to false.
  13911. // returns:
  13912. // If the event is cancelable and the event is not cancelled,
  13913. // emit will return true. If the event is cancelable and the event is cancelled,
  13914. // emit will return false.
  13915. // details:
  13916. // Note that this is designed to emit events for listeners registered through
  13917. // dojo/on. It should actually work with any event listener except those
  13918. // added through IE's attachEvent (IE8 and below's non-W3C event emiting
  13919. // doesn't support custom event types). It should work with all events registered
  13920. // through dojo/on. Also note that the emit method does do any default
  13921. // action, it only returns a value to indicate if the default action should take
  13922. // place. For example, emiting a keypress event would not cause a character
  13923. // to appear in a textbox.
  13924. // example:
  13925. // To fire our own click event
  13926. // | on.emit(dojo.byId("button"), "click", {
  13927. // | cancelable: true,
  13928. // | bubbles: true,
  13929. // | screenX: 33,
  13930. // | screenY: 44
  13931. // | });
  13932. // We can also fire our own custom events:
  13933. // | on.emit(dojo.byId("slider"), "slide", {
  13934. // | cancelable: true,
  13935. // | bubbles: true,
  13936. // | direction: "left-to-right"
  13937. // | });
  13938. var args = slice.call(arguments, 2);
  13939. var method = "on" + type;
  13940. if("parentNode" in target){
  13941. // node (or node-like), create event controller methods
  13942. var newEvent = args[0] = {};
  13943. for(var i in event){
  13944. newEvent[i] = event[i];
  13945. }
  13946. newEvent.preventDefault = syntheticPreventDefault;
  13947. newEvent.stopPropagation = syntheticStopPropagation;
  13948. newEvent.target = target;
  13949. newEvent.type = type;
  13950. event = newEvent;
  13951. }
  13952. do{
  13953. // call any node which has a handler (note that ideally we would try/catch to simulate normal event propagation but that causes too much pain for debugging)
  13954. target[method] && target[method].apply(target, args);
  13955. // and then continue up the parent node chain if it is still bubbling (if started as bubbles and stopPropagation hasn't been called)
  13956. }while(event && event.bubbles && (target = target.parentNode));
  13957. return event && event.cancelable && event; // if it is still true (was cancelable and was cancelled), return the event to indicate default action should happen
  13958. };
  13959. var captures = {};
  13960. if(!has("event-stopimmediatepropagation")){
  13961. var stopImmediatePropagation =function(){
  13962. this.immediatelyStopped = true;
  13963. this.modified = true; // mark it as modified so the event will be cached in IE
  13964. };
  13965. var addStopImmediate = function(listener){
  13966. return function(event){
  13967. if(!event.immediatelyStopped){// check to make sure it hasn't been stopped immediately
  13968. event.stopImmediatePropagation = stopImmediatePropagation;
  13969. return listener.apply(this, arguments);
  13970. }
  13971. };
  13972. }
  13973. }
  13974. if(has("dom-addeventlistener")){
  13975. // normalize focusin and focusout
  13976. captures = {
  13977. focusin: "focus",
  13978. focusout: "blur"
  13979. };
  13980. if(has("opera")){
  13981. captures.keydown = "keypress"; // this one needs to be transformed because Opera doesn't support repeating keys on keydown (and keypress works because it incorrectly fires on all keydown events)
  13982. }
  13983. // emiter that works with native event handling
  13984. on.emit = function(target, type, event){
  13985. if(target.dispatchEvent && document.createEvent){
  13986. // use the native event emiting mechanism if it is available on the target object
  13987. // create a generic event
  13988. // we could create branch into the different types of event constructors, but
  13989. // that would be a lot of extra code, with little benefit that I can see, seems
  13990. // best to use the generic constructor and copy properties over, making it
  13991. // easy to have events look like the ones created with specific initializers
  13992. var nativeEvent = target.ownerDocument.createEvent("HTMLEvents");
  13993. nativeEvent.initEvent(type, !!event.bubbles, !!event.cancelable);
  13994. // and copy all our properties over
  13995. for(var i in event){
  13996. var value = event[i];
  13997. if(!(i in nativeEvent)){
  13998. nativeEvent[i] = event[i];
  13999. }
  14000. }
  14001. return target.dispatchEvent(nativeEvent) && nativeEvent;
  14002. }
  14003. return syntheticDispatch.apply(on, arguments); // emit for a non-node
  14004. };
  14005. }else{
  14006. // no addEventListener, basically old IE event normalization
  14007. on._fixEvent = function(evt, sender){
  14008. // summary:
  14009. // normalizes properties on the event object including event
  14010. // bubbling methods, keystroke normalization, and x/y positions
  14011. // evt:
  14012. // native event object
  14013. // sender:
  14014. // node to treat as "currentTarget"
  14015. if(!evt){
  14016. var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
  14017. evt = w.event;
  14018. }
  14019. if(!evt){return evt;}
  14020. if(lastEvent && evt.type == lastEvent.type){
  14021. // should be same event, reuse event object (so it can be augmented)
  14022. evt = lastEvent;
  14023. }
  14024. if(!evt.target){ // check to see if it has been fixed yet
  14025. evt.target = evt.srcElement;
  14026. evt.currentTarget = (sender || evt.srcElement);
  14027. if(evt.type == "mouseover"){
  14028. evt.relatedTarget = evt.fromElement;
  14029. }
  14030. if(evt.type == "mouseout"){
  14031. evt.relatedTarget = evt.toElement;
  14032. }
  14033. if(!evt.stopPropagation){
  14034. evt.stopPropagation = stopPropagation;
  14035. evt.preventDefault = preventDefault;
  14036. }
  14037. switch(evt.type){
  14038. case "keypress":
  14039. var c = ("charCode" in evt ? evt.charCode : evt.keyCode);
  14040. if (c==10){
  14041. // CTRL-ENTER is CTRL-ASCII(10) on IE, but CTRL-ENTER on Mozilla
  14042. c=0;
  14043. evt.keyCode = 13;
  14044. }else if(c==13||c==27){
  14045. c=0; // Mozilla considers ENTER and ESC non-printable
  14046. }else if(c==3){
  14047. c=99; // Mozilla maps CTRL-BREAK to CTRL-c
  14048. }
  14049. // Mozilla sets keyCode to 0 when there is a charCode
  14050. // but that stops the event on IE.
  14051. evt.charCode = c;
  14052. _setKeyChar(evt);
  14053. break;
  14054. }
  14055. }
  14056. return evt;
  14057. };
  14058. var lastEvent, IESignal = function(handle){
  14059. this.handle = handle;
  14060. };
  14061. IESignal.prototype.remove = function(){
  14062. delete _dojoIEListeners_[this.handle];
  14063. };
  14064. var fixListener = function(listener){
  14065. // this is a minimal function for closing on the previous listener with as few as variables as possible
  14066. return function(evt){
  14067. evt = on._fixEvent(evt, this);
  14068. var result = listener.call(this, evt);
  14069. if(evt.modified){
  14070. // cache the last event and reuse it if we can
  14071. if(!lastEvent){
  14072. setTimeout(function(){
  14073. lastEvent = null;
  14074. });
  14075. }
  14076. lastEvent = evt;
  14077. }
  14078. return result;
  14079. };
  14080. };
  14081. var fixAttach = function(target, type, listener){
  14082. listener = fixListener(listener);
  14083. if(((target.ownerDocument ? target.ownerDocument.parentWindow : target.parentWindow || target.window || window) != top ||
  14084. has("jscript") < 5.8) &&
  14085. !has("config-_allow_leaks")){
  14086. // IE will leak memory on certain handlers in frames (IE8 and earlier) and in unattached DOM nodes for JScript 5.7 and below.
  14087. // Here we use global redirection to solve the memory leaks
  14088. if(typeof _dojoIEListeners_ == "undefined"){
  14089. _dojoIEListeners_ = [];
  14090. }
  14091. var emiter = target[type];
  14092. if(!emiter || !emiter.listeners){
  14093. var oldListener = emiter;
  14094. emiter = Function('event', 'var callee = arguments.callee; for(var i = 0; i<callee.listeners.length; i++){var listener = _dojoIEListeners_[callee.listeners[i]]; if(listener){listener.call(this,event);}}');
  14095. emiter.listeners = [];
  14096. target[type] = emiter;
  14097. emiter.global = this;
  14098. if(oldListener){
  14099. emiter.listeners.push(_dojoIEListeners_.push(oldListener) - 1);
  14100. }
  14101. }
  14102. var handle;
  14103. emiter.listeners.push(handle = (emiter.global._dojoIEListeners_.push(listener) - 1));
  14104. return new IESignal(handle);
  14105. }
  14106. return aspect.after(target, type, listener, true);
  14107. };
  14108. var _setKeyChar = function(evt){
  14109. evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
  14110. evt.charOrCode = evt.keyChar || evt.keyCode;
  14111. };
  14112. // Called in Event scope
  14113. var stopPropagation = function(){
  14114. this.cancelBubble = true;
  14115. };
  14116. var preventDefault = on._preventDefault = function(){
  14117. // Setting keyCode to 0 is the only way to prevent certain keypresses (namely
  14118. // ctrl-combinations that correspond to menu accelerator keys).
  14119. // Otoh, it prevents upstream listeners from getting this information
  14120. // Try to split the difference here by clobbering keyCode only for ctrl
  14121. // combinations. If you still need to access the key upstream, bubbledKeyCode is
  14122. // provided as a workaround.
  14123. this.bubbledKeyCode = this.keyCode;
  14124. if(this.ctrlKey){
  14125. try{
  14126. // squelch errors when keyCode is read-only
  14127. // (e.g. if keyCode is ctrl or shift)
  14128. this.keyCode = 0;
  14129. }catch(e){
  14130. }
  14131. }
  14132. this.defaultPrevented = true;
  14133. this.returnValue = false;
  14134. };
  14135. }
  14136. if(has("touch")){
  14137. var Event = function(){};
  14138. var windowOrientation = window.orientation;
  14139. var fixTouchListener = function(listener){
  14140. return function(originalEvent){
  14141. //Event normalization(for ontouchxxx and resize):
  14142. //1.incorrect e.pageX|pageY in iOS
  14143. //2.there are no "e.rotation", "e.scale" and "onorientationchange" in Andriod
  14144. //3.More TBD e.g. force | screenX | screenX | clientX | clientY | radiusX | radiusY
  14145. // see if it has already been corrected
  14146. var event = originalEvent.corrected;
  14147. if(!event){
  14148. var type = originalEvent.type;
  14149. try{
  14150. delete originalEvent.type; // on some JS engines (android), deleting properties make them mutable
  14151. }catch(e){}
  14152. if(originalEvent.type){
  14153. // deleting properties doesn't work (older iOS), have to use delegation
  14154. Event.prototype = originalEvent;
  14155. var event = new Event;
  14156. // have to delegate methods to make them work
  14157. event.preventDefault = function(){
  14158. originalEvent.preventDefault();
  14159. };
  14160. event.stopPropagation = function(){
  14161. originalEvent.stopPropagation();
  14162. };
  14163. }else{
  14164. // deletion worked, use property as is
  14165. event = originalEvent;
  14166. event.type = type;
  14167. }
  14168. originalEvent.corrected = event;
  14169. if(type == 'resize'){
  14170. if(windowOrientation == window.orientation){
  14171. return null;//double tap causes an unexpected 'resize' in Andriod
  14172. }
  14173. windowOrientation = window.orientation;
  14174. event.type = "orientationchange";
  14175. return listener.call(this, event);
  14176. }
  14177. // We use the original event and augment, rather than doing an expensive mixin operation
  14178. if(!("rotation" in event)){ // test to see if it has rotation
  14179. event.rotation = 0;
  14180. event.scale = 1;
  14181. }
  14182. //use event.changedTouches[0].pageX|pageY|screenX|screenY|clientX|clientY|target
  14183. var firstChangeTouch = event.changedTouches[0];
  14184. for(var i in firstChangeTouch){ // use for-in, we don't need to have dependency on dojo/_base/lang here
  14185. delete event[i]; // delete it first to make it mutable
  14186. event[i] = firstChangeTouch[i];
  14187. }
  14188. }
  14189. return listener.call(this, event);
  14190. };
  14191. };
  14192. }
  14193. return on;
  14194. });
  14195. },
  14196. 'dojo/_base/sniff':function(){
  14197. define(["./kernel", "./lang", "../sniff"], function(dojo, lang, has){
  14198. // module:
  14199. // dojo/_base/sniff
  14200. /*=====
  14201. return {
  14202. // summary:
  14203. // Deprecated. New code should use dojo/sniff.
  14204. // This module populates the dojo browser version sniffing properties like dojo.isIE.
  14205. };
  14206. =====*/
  14207. if(! 1 ){
  14208. return has;
  14209. }
  14210. // no idea what this is for, or if it's used
  14211. dojo._name = "browser";
  14212. lang.mixin(dojo, {
  14213. // isBrowser: Boolean
  14214. // True if the client is a web-browser
  14215. isBrowser: true,
  14216. // isFF: Number|undefined
  14217. // Version as a Number if client is FireFox. undefined otherwise. Corresponds to
  14218. // major detected FireFox version (1.5, 2, 3, etc.)
  14219. isFF: has("ff"),
  14220. // isIE: Number|undefined
  14221. // Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to
  14222. // major detected IE version (6, 7, 8, etc.)
  14223. isIE: has("ie"),
  14224. // isKhtml: Number|undefined
  14225. // Version as a Number if client is a KHTML browser. undefined otherwise. Corresponds to major
  14226. // detected version.
  14227. isKhtml: has("khtml"),
  14228. // isWebKit: Number|undefined
  14229. // Version as a Number if client is a WebKit-derived browser (Konqueror,
  14230. // Safari, Chrome, etc.). undefined otherwise.
  14231. isWebKit: has("webkit"),
  14232. // isMozilla: Number|undefined
  14233. // Version as a Number if client is a Mozilla-based browser (Firefox,
  14234. // SeaMonkey). undefined otherwise. Corresponds to major detected version.
  14235. isMozilla: has("mozilla"),
  14236. // isMoz: Number|undefined
  14237. // Version as a Number if client is a Mozilla-based browser (Firefox,
  14238. // SeaMonkey). undefined otherwise. Corresponds to major detected version.
  14239. isMoz: has("mozilla"),
  14240. // isOpera: Number|undefined
  14241. // Version as a Number if client is Opera. undefined otherwise. Corresponds to
  14242. // major detected version.
  14243. isOpera: has("opera"),
  14244. // isSafari: Number|undefined
  14245. // Version as a Number if client is Safari or iPhone. undefined otherwise.
  14246. isSafari: has("safari"),
  14247. // isChrome: Number|undefined
  14248. // Version as a Number if client is Chrome browser. undefined otherwise.
  14249. isChrome: has("chrome"),
  14250. // isMac: Boolean
  14251. // True if the client runs on Mac
  14252. isMac: has("mac"),
  14253. // isIos: Boolean
  14254. // True if client is iPhone, iPod, or iPad
  14255. isIos: has("ios"),
  14256. // isAndroid: Number|undefined
  14257. // Version as a Number if client is android browser. undefined otherwise.
  14258. isAndroid: has("android"),
  14259. // isWii: Boolean
  14260. // True if client is Wii
  14261. isWii: has("wii"),
  14262. // isQuirks: Boolean
  14263. // Page is in quirks mode.
  14264. isQuirks: has("quirks"),
  14265. // isAir: Boolean
  14266. // True if client is Adobe Air
  14267. isAir: has("air")
  14268. });
  14269. dojo.locale = dojo.locale || (has("ie") ? navigator.userLanguage : navigator.language).toLowerCase();
  14270. return has;
  14271. });
  14272. },
  14273. 'dojo/errors/create':function(){
  14274. define(["../_base/lang"], function(lang){
  14275. return function(name, ctor, base, props){
  14276. base = base || Error;
  14277. var ErrorCtor = function(message){
  14278. if(base === Error){
  14279. if(Error.captureStackTrace){
  14280. Error.captureStackTrace(this, ErrorCtor);
  14281. }
  14282. // Error.call() operates on the returned error
  14283. // object rather than operating on |this|
  14284. var err = Error.call(this, message),
  14285. prop;
  14286. // Copy own properties from err to |this|
  14287. for(prop in err){
  14288. if(err.hasOwnProperty(prop)){
  14289. this[prop] = err[prop];
  14290. }
  14291. }
  14292. // messsage is non-enumerable in ES5
  14293. this.message = message;
  14294. // stack is non-enumerable in at least Firefox
  14295. this.stack = err.stack;
  14296. }else{
  14297. base.apply(this, arguments);
  14298. }
  14299. if(ctor){
  14300. ctor.apply(this, arguments);
  14301. }
  14302. };
  14303. ErrorCtor.prototype = lang.delegate(base.prototype, props);
  14304. ErrorCtor.prototype.name = name;
  14305. ErrorCtor.prototype.constructor = ErrorCtor;
  14306. return ErrorCtor;
  14307. };
  14308. });
  14309. },
  14310. 'dojo/_base/array':function(){
  14311. define(["./kernel", "../has", "./lang"], function(dojo, has, lang){
  14312. // module:
  14313. // dojo/_base/array
  14314. // our old simple function builder stuff
  14315. var cache = {}, u;
  14316. function buildFn(fn){
  14317. return cache[fn] = new Function("item", "index", "array", fn); // Function
  14318. }
  14319. // magic snippet: if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  14320. // every & some
  14321. function everyOrSome(some){
  14322. var every = !some;
  14323. return function(a, fn, o){
  14324. var i = 0, l = a && a.length || 0, result;
  14325. if(l && typeof a == "string") a = a.split("");
  14326. if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  14327. if(o){
  14328. for(; i < l; ++i){
  14329. result = !fn.call(o, a[i], i, a);
  14330. if(some ^ result){
  14331. return !result;
  14332. }
  14333. }
  14334. }else{
  14335. for(; i < l; ++i){
  14336. result = !fn(a[i], i, a);
  14337. if(some ^ result){
  14338. return !result;
  14339. }
  14340. }
  14341. }
  14342. return every; // Boolean
  14343. };
  14344. }
  14345. // indexOf, lastIndexOf
  14346. function index(up){
  14347. var delta = 1, lOver = 0, uOver = 0;
  14348. if(!up){
  14349. delta = lOver = uOver = -1;
  14350. }
  14351. return function(a, x, from, last){
  14352. if(last && delta > 0){
  14353. // TODO: why do we use a non-standard signature? why do we need "last"?
  14354. return array.lastIndexOf(a, x, from);
  14355. }
  14356. var l = a && a.length || 0, end = up ? l + uOver : lOver, i;
  14357. if(from === u){
  14358. i = up ? lOver : l + uOver;
  14359. }else{
  14360. if(from < 0){
  14361. i = l + from;
  14362. if(i < 0){
  14363. i = lOver;
  14364. }
  14365. }else{
  14366. i = from >= l ? l + uOver : from;
  14367. }
  14368. }
  14369. if(l && typeof a == "string") a = a.split("");
  14370. for(; i != end; i += delta){
  14371. if(a[i] == x){
  14372. return i; // Number
  14373. }
  14374. }
  14375. return -1; // Number
  14376. };
  14377. }
  14378. var array = {
  14379. // summary:
  14380. // The Javascript v1.6 array extensions.
  14381. every: everyOrSome(false),
  14382. /*=====
  14383. every: function(arr, callback, thisObject){
  14384. // summary:
  14385. // Determines whether or not every item in arr satisfies the
  14386. // condition implemented by callback.
  14387. // arr: Array|String
  14388. // the array to iterate on. If a string, operates on individual characters.
  14389. // callback: Function|String
  14390. // a function is invoked with three arguments: item, index,
  14391. // and array and returns true if the condition is met.
  14392. // thisObject: Object?
  14393. // may be used to scope the call to callback
  14394. // returns: Boolean
  14395. // description:
  14396. // This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
  14397. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  14398. // the callback function with a value of undefined. JavaScript 1.6's every skips the holes in the sparse array.
  14399. // For more details, see:
  14400. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/every
  14401. // example:
  14402. // | // returns false
  14403. // | array.every([1, 2, 3, 4], function(item){ return item>1; });
  14404. // example:
  14405. // | // returns true
  14406. // | array.every([1, 2, 3, 4], function(item){ return item>0; });
  14407. },
  14408. =====*/
  14409. some: everyOrSome(true),
  14410. /*=====
  14411. some: function(arr, callback, thisObject){
  14412. // summary:
  14413. // Determines whether or not any item in arr satisfies the
  14414. // condition implemented by callback.
  14415. // arr: Array|String
  14416. // the array to iterate over. If a string, operates on individual characters.
  14417. // callback: Function|String
  14418. // a function is invoked with three arguments: item, index,
  14419. // and array and returns true if the condition is met.
  14420. // thisObject: Object?
  14421. // may be used to scope the call to callback
  14422. // returns: Boolean
  14423. // description:
  14424. // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
  14425. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  14426. // the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
  14427. // For more details, see:
  14428. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/some
  14429. // example:
  14430. // | // is true
  14431. // | array.some([1, 2, 3, 4], function(item){ return item>1; });
  14432. // example:
  14433. // | // is false
  14434. // | array.some([1, 2, 3, 4], function(item){ return item<1; });
  14435. },
  14436. =====*/
  14437. indexOf: index(true),
  14438. /*=====
  14439. indexOf: function(arr, value, fromIndex, findLast){
  14440. // summary:
  14441. // locates the first index of the provided value in the
  14442. // passed array. If the value is not found, -1 is returned.
  14443. // description:
  14444. // This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
  14445. // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
  14446. // 1.6's indexOf skips the holes in the sparse array.
  14447. // For details on this method, see:
  14448. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
  14449. // arr: Array
  14450. // value: Object
  14451. // fromIndex: Integer?
  14452. // findLast: Boolean?
  14453. // returns: Number
  14454. },
  14455. =====*/
  14456. lastIndexOf: index(false),
  14457. /*=====
  14458. lastIndexOf: function(arr, value, fromIndex){
  14459. // summary:
  14460. // locates the last index of the provided value in the passed
  14461. // array. If the value is not found, -1 is returned.
  14462. // description:
  14463. // This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
  14464. // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
  14465. // 1.6's lastIndexOf skips the holes in the sparse array.
  14466. // For details on this method, see:
  14467. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
  14468. // arr: Array,
  14469. // value: Object,
  14470. // fromIndex: Integer?
  14471. // returns: Number
  14472. },
  14473. =====*/
  14474. forEach: function(arr, callback, thisObject){
  14475. // summary:
  14476. // for every item in arr, callback is invoked. Return values are ignored.
  14477. // If you want to break out of the loop, consider using array.every() or array.some().
  14478. // forEach does not allow breaking out of the loop over the items in arr.
  14479. // arr:
  14480. // the array to iterate over. If a string, operates on individual characters.
  14481. // callback:
  14482. // a function is invoked with three arguments: item, index, and array
  14483. // thisObject:
  14484. // may be used to scope the call to callback
  14485. // description:
  14486. // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
  14487. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  14488. // the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
  14489. // For more details, see:
  14490. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach
  14491. // example:
  14492. // | // log out all members of the array:
  14493. // | array.forEach(
  14494. // | [ "thinger", "blah", "howdy", 10 ],
  14495. // | function(item){
  14496. // | console.log(item);
  14497. // | }
  14498. // | );
  14499. // example:
  14500. // | // log out the members and their indexes
  14501. // | array.forEach(
  14502. // | [ "thinger", "blah", "howdy", 10 ],
  14503. // | function(item, idx, arr){
  14504. // | console.log(item, "at index:", idx);
  14505. // | }
  14506. // | );
  14507. // example:
  14508. // | // use a scoped object member as the callback
  14509. // |
  14510. // | var obj = {
  14511. // | prefix: "logged via obj.callback:",
  14512. // | callback: function(item){
  14513. // | console.log(this.prefix, item);
  14514. // | }
  14515. // | };
  14516. // |
  14517. // | // specifying the scope function executes the callback in that scope
  14518. // | array.forEach(
  14519. // | [ "thinger", "blah", "howdy", 10 ],
  14520. // | obj.callback,
  14521. // | obj
  14522. // | );
  14523. // |
  14524. // | // alternately, we can accomplish the same thing with lang.hitch()
  14525. // | array.forEach(
  14526. // | [ "thinger", "blah", "howdy", 10 ],
  14527. // | lang.hitch(obj, "callback")
  14528. // | );
  14529. // arr: Array|String
  14530. // callback: Function|String
  14531. // thisObject: Object?
  14532. var i = 0, l = arr && arr.length || 0;
  14533. if(l && typeof arr == "string") arr = arr.split("");
  14534. if(typeof callback == "string") callback = cache[callback] || buildFn(callback);
  14535. if(thisObject){
  14536. for(; i < l; ++i){
  14537. callback.call(thisObject, arr[i], i, arr);
  14538. }
  14539. }else{
  14540. for(; i < l; ++i){
  14541. callback(arr[i], i, arr);
  14542. }
  14543. }
  14544. },
  14545. map: function(arr, callback, thisObject, Ctr){
  14546. // summary:
  14547. // applies callback to each element of arr and returns
  14548. // an Array with the results
  14549. // arr: Array|String
  14550. // the array to iterate on. If a string, operates on
  14551. // individual characters.
  14552. // callback: Function|String
  14553. // a function is invoked with three arguments, (item, index,
  14554. // array), and returns a value
  14555. // thisObject: Object?
  14556. // may be used to scope the call to callback
  14557. // returns: Array
  14558. // description:
  14559. // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
  14560. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  14561. // the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
  14562. // For more details, see:
  14563. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
  14564. // example:
  14565. // | // returns [2, 3, 4, 5]
  14566. // | array.map([1, 2, 3, 4], function(item){ return item+1 });
  14567. // TODO: why do we have a non-standard signature here? do we need "Ctr"?
  14568. var i = 0, l = arr && arr.length || 0, out = new (Ctr || Array)(l);
  14569. if(l && typeof arr == "string") arr = arr.split("");
  14570. if(typeof callback == "string") callback = cache[callback] || buildFn(callback);
  14571. if(thisObject){
  14572. for(; i < l; ++i){
  14573. out[i] = callback.call(thisObject, arr[i], i, arr);
  14574. }
  14575. }else{
  14576. for(; i < l; ++i){
  14577. out[i] = callback(arr[i], i, arr);
  14578. }
  14579. }
  14580. return out; // Array
  14581. },
  14582. filter: function(arr, callback, thisObject){
  14583. // summary:
  14584. // Returns a new Array with those items from arr that match the
  14585. // condition implemented by callback.
  14586. // arr: Array
  14587. // the array to iterate over.
  14588. // callback: Function|String
  14589. // a function that is invoked with three arguments (item,
  14590. // index, array). The return of this function is expected to
  14591. // be a boolean which determines whether the passed-in item
  14592. // will be included in the returned array.
  14593. // thisObject: Object?
  14594. // may be used to scope the call to callback
  14595. // returns: Array
  14596. // description:
  14597. // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
  14598. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  14599. // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
  14600. // For more details, see:
  14601. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
  14602. // example:
  14603. // | // returns [2, 3, 4]
  14604. // | array.filter([1, 2, 3, 4], function(item){ return item>1; });
  14605. // TODO: do we need "Ctr" here like in map()?
  14606. var i = 0, l = arr && arr.length || 0, out = [], value;
  14607. if(l && typeof arr == "string") arr = arr.split("");
  14608. if(typeof callback == "string") callback = cache[callback] || buildFn(callback);
  14609. if(thisObject){
  14610. for(; i < l; ++i){
  14611. value = arr[i];
  14612. if(callback.call(thisObject, value, i, arr)){
  14613. out.push(value);
  14614. }
  14615. }
  14616. }else{
  14617. for(; i < l; ++i){
  14618. value = arr[i];
  14619. if(callback(value, i, arr)){
  14620. out.push(value);
  14621. }
  14622. }
  14623. }
  14624. return out; // Array
  14625. },
  14626. clearCache: function(){
  14627. cache = {};
  14628. }
  14629. };
  14630. 1 && lang.mixin(dojo, array);
  14631. return array;
  14632. });
  14633. },
  14634. 'dojo/_base/json':function(){
  14635. define(["./kernel", "../json"], function(dojo, json){
  14636. // module:
  14637. // dojo/_base/json
  14638. /*=====
  14639. return {
  14640. // summary:
  14641. // This module defines the dojo JSON API.
  14642. };
  14643. =====*/
  14644. dojo.fromJson = function(/*String*/ js){
  14645. // summary:
  14646. // Parses a JavaScript expression and returns a JavaScript value.
  14647. // description:
  14648. // Throws for invalid JavaScript expressions. It does not use a strict JSON parser. It
  14649. // always delegates to eval(). The content passed to this method must therefore come
  14650. // from a trusted source.
  14651. // It is recommend that you use dojo/json's parse function for an
  14652. // implementation uses the (faster) native JSON parse when available.
  14653. // js:
  14654. // a string literal of a JavaScript expression, for instance:
  14655. // `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
  14656. return eval("(" + js + ")"); // Object
  14657. };
  14658. /*=====
  14659. dojo._escapeString = function(){
  14660. // summary:
  14661. // Adds escape sequences for non-visual characters, double quote and
  14662. // backslash and surrounds with double quotes to form a valid string
  14663. // literal.
  14664. };
  14665. =====*/
  14666. dojo._escapeString = json.stringify; // just delegate to json.stringify
  14667. dojo.toJsonIndentStr = "\t";
  14668. dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint){
  14669. // summary:
  14670. // Returns a [JSON](http://json.org) serialization of an object.
  14671. // description:
  14672. // Returns a [JSON](http://json.org) serialization of an object.
  14673. // Note that this doesn't check for infinite recursion, so don't do that!
  14674. // It is recommend that you use dojo/json's stringify function for an lighter
  14675. // and faster implementation that matches the native JSON API and uses the
  14676. // native JSON serializer when available.
  14677. // it:
  14678. // an object to be serialized. Objects may define their own
  14679. // serialization via a special "__json__" or "json" function
  14680. // property. If a specialized serializer has been defined, it will
  14681. // be used as a fallback.
  14682. // Note that in 1.6, toJson would serialize undefined, but this no longer supported
  14683. // since it is not supported by native JSON serializer.
  14684. // prettyPrint:
  14685. // if true, we indent objects and arrays to make the output prettier.
  14686. // The variable `dojo.toJsonIndentStr` is used as the indent string --
  14687. // to use something other than the default (tab), change that variable
  14688. // before calling dojo.toJson().
  14689. // Note that if native JSON support is available, it will be used for serialization,
  14690. // and native implementations vary on the exact spacing used in pretty printing.
  14691. // returns:
  14692. // A JSON string serialization of the passed-in object.
  14693. // example:
  14694. // simple serialization of a trivial object
  14695. // | var jsonStr = dojo.toJson({ howdy: "stranger!", isStrange: true });
  14696. // | doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
  14697. // example:
  14698. // a custom serializer for an objects of a particular class:
  14699. // | dojo.declare("Furby", null, {
  14700. // | furbies: "are strange",
  14701. // | furbyCount: 10,
  14702. // | __json__: function(){
  14703. // | },
  14704. // | });
  14705. // use dojo/json
  14706. return json.stringify(it, function(key, value){
  14707. if(value){
  14708. var tf = value.__json__||value.json;
  14709. if(typeof tf == "function"){
  14710. return tf.call(value);
  14711. }
  14712. }
  14713. return value;
  14714. }, prettyPrint && dojo.toJsonIndentStr); // String
  14715. };
  14716. return dojo;
  14717. });
  14718. },
  14719. 'dojo/_base/window':function(){
  14720. define("dojo/_base/window", ["./kernel", "./lang", "../sniff"], function(dojo, lang, has){
  14721. // module:
  14722. // dojo/_base/window
  14723. var ret = {
  14724. // summary:
  14725. // API to save/set/restore the global/document scope.
  14726. global: dojo.global,
  14727. /*=====
  14728. global: {
  14729. // summary:
  14730. // Alias for the current window. 'global' can be modified
  14731. // for temporary context shifting. See also withGlobal().
  14732. // description:
  14733. // Use this rather than referring to 'window' to ensure your code runs
  14734. // correctly in managed contexts.
  14735. },
  14736. =====*/
  14737. doc: this["document"] || null,
  14738. /*=====
  14739. doc: {
  14740. // summary:
  14741. // Alias for the current document. 'doc' can be modified
  14742. // for temporary context shifting. See also withDoc().
  14743. // description:
  14744. // Use this rather than referring to 'window.document' to ensure your code runs
  14745. // correctly in managed contexts.
  14746. // example:
  14747. // | n.appendChild(dojo.doc.createElement('div'));
  14748. },
  14749. =====*/
  14750. body: function(/*Document?*/ doc){
  14751. // summary:
  14752. // Return the body element of the specified document or of dojo/_base/window::doc.
  14753. // example:
  14754. // | win.body().appendChild(dojo.doc.createElement('div'));
  14755. // Note: document.body is not defined for a strict xhtml document
  14756. // Would like to memoize this, but dojo.doc can change vi dojo.withDoc().
  14757. doc = doc || dojo.doc;
  14758. return doc.body || doc.getElementsByTagName("body")[0]; // Node
  14759. },
  14760. setContext: function(/*Object*/ globalObject, /*DocumentElement*/ globalDocument){
  14761. // summary:
  14762. // changes the behavior of many core Dojo functions that deal with
  14763. // namespace and DOM lookup, changing them to work in a new global
  14764. // context (e.g., an iframe). The varibles dojo.global and dojo.doc
  14765. // are modified as a result of calling this function and the result of
  14766. // `dojo.body()` likewise differs.
  14767. dojo.global = ret.global = globalObject;
  14768. dojo.doc = ret.doc = globalDocument;
  14769. },
  14770. withGlobal: function( /*Object*/ globalObject,
  14771. /*Function*/ callback,
  14772. /*Object?*/ thisObject,
  14773. /*Array?*/ cbArguments){
  14774. // summary:
  14775. // Invoke callback with globalObject as dojo.global and
  14776. // globalObject.document as dojo.doc.
  14777. // description:
  14778. // Invoke callback with globalObject as dojo.global and
  14779. // globalObject.document as dojo.doc. If provided, globalObject
  14780. // will be executed in the context of object thisObject
  14781. // When callback() returns or throws an error, the dojo.global
  14782. // and dojo.doc will be restored to its previous state.
  14783. var oldGlob = dojo.global;
  14784. try{
  14785. dojo.global = ret.global = globalObject;
  14786. return ret.withDoc.call(null, globalObject.document, callback, thisObject, cbArguments);
  14787. }finally{
  14788. dojo.global = ret.global = oldGlob;
  14789. }
  14790. },
  14791. withDoc: function( /*DocumentElement*/ documentObject,
  14792. /*Function*/ callback,
  14793. /*Object?*/ thisObject,
  14794. /*Array?*/ cbArguments){
  14795. // summary:
  14796. // Invoke callback with documentObject as dojo/_base/window::doc.
  14797. // description:
  14798. // Invoke callback with documentObject as dojo/_base/window::doc. If provided,
  14799. // callback will be executed in the context of object thisObject
  14800. // When callback() returns or throws an error, the dojo/_base/window::doc will
  14801. // be restored to its previous state.
  14802. var oldDoc = ret.doc,
  14803. oldQ = has("quirks"),
  14804. oldIE = has("ie"), isIE, mode, pwin;
  14805. try{
  14806. dojo.doc = ret.doc = documentObject;
  14807. // update dojo.isQuirks and the value of the has feature "quirks".
  14808. // remove setting dojo.isQuirks and dojo.isIE for 2.0
  14809. dojo.isQuirks = has.add("quirks", dojo.doc.compatMode == "BackCompat", true, true); // no need to check for QuirksMode which was Opera 7 only
  14810. if(has("ie")){
  14811. if((pwin = documentObject.parentWindow) && pwin.navigator){
  14812. // re-run IE detection logic and update dojo.isIE / has("ie")
  14813. // (the only time parentWindow/navigator wouldn't exist is if we were not
  14814. // passed an actual legitimate document object)
  14815. isIE = parseFloat(pwin.navigator.appVersion.split("MSIE ")[1]) || undefined;
  14816. mode = documentObject.documentMode;
  14817. if(mode && mode != 5 && Math.floor(isIE) != mode){
  14818. isIE = mode;
  14819. }
  14820. dojo.isIE = has.add("ie", isIE, true, true);
  14821. }
  14822. }
  14823. if(thisObject && typeof callback == "string"){
  14824. callback = thisObject[callback];
  14825. }
  14826. return callback.apply(thisObject, cbArguments || []);
  14827. }finally{
  14828. dojo.doc = ret.doc = oldDoc;
  14829. dojo.isQuirks = has.add("quirks", oldQ, true, true);
  14830. dojo.isIE = has.add("ie", oldIE, true, true);
  14831. }
  14832. }
  14833. };
  14834. 1 && lang.mixin(dojo, ret);
  14835. return ret;
  14836. });
  14837. },
  14838. 'dojo/dom-class':function(){
  14839. define(["./_base/lang", "./_base/array", "./dom"], function(lang, array, dom){
  14840. // module:
  14841. // dojo/dom-class
  14842. var className = "className";
  14843. /* Part I of classList-based implementation is preserved here for posterity
  14844. var classList = "classList";
  14845. has.add("dom-classList", function(){
  14846. return classList in document.createElement("p");
  14847. });
  14848. */
  14849. // =============================
  14850. // (CSS) Class Functions
  14851. // =============================
  14852. var cls, // exports object
  14853. spaces = /\s+/, a1 = [""];
  14854. function str2array(s){
  14855. if(typeof s == "string" || s instanceof String){
  14856. if(s && !spaces.test(s)){
  14857. a1[0] = s;
  14858. return a1;
  14859. }
  14860. var a = s.split(spaces);
  14861. if(a.length && !a[0]){
  14862. a.shift();
  14863. }
  14864. if(a.length && !a[a.length - 1]){
  14865. a.pop();
  14866. }
  14867. return a;
  14868. }
  14869. // assumed to be an array
  14870. if(!s){
  14871. return [];
  14872. }
  14873. return array.filter(s, function(x){ return x; });
  14874. }
  14875. /* Part II of classList-based implementation is preserved here for posterity
  14876. if(has("dom-classList")){
  14877. // new classList version
  14878. cls = {
  14879. contains: function containsClass(node, classStr){
  14880. var clslst = classStr && dom.byId(node)[classList];
  14881. return clslst && clslst.contains(classStr); // Boolean
  14882. },
  14883. add: function addClass(node, classStr){
  14884. node = dom.byId(node);
  14885. classStr = str2array(classStr);
  14886. for(var i = 0, len = classStr.length; i < len; ++i){
  14887. node[classList].add(classStr[i]);
  14888. }
  14889. },
  14890. remove: function removeClass(node, classStr){
  14891. node = dom.byId(node);
  14892. if(classStr === undefined){
  14893. node[className] = "";
  14894. }else{
  14895. classStr = str2array(classStr);
  14896. for(var i = 0, len = classStr.length; i < len; ++i){
  14897. node[classList].remove(classStr[i]);
  14898. }
  14899. }
  14900. },
  14901. replace: function replaceClass(node, addClassStr, removeClassStr){
  14902. node = dom.byId(node);
  14903. if(removeClassStr === undefined){
  14904. node[className] = "";
  14905. }else{
  14906. removeClassStr = str2array(removeClassStr);
  14907. for(var i = 0, len = removeClassStr.length; i < len; ++i){
  14908. node[classList].remove(removeClassStr[i]);
  14909. }
  14910. }
  14911. addClassStr = str2array(addClassStr);
  14912. for(i = 0, len = addClassStr.length; i < len; ++i){
  14913. node[classList].add(addClassStr[i]);
  14914. }
  14915. },
  14916. toggle: function toggleClass(node, classStr, condition){
  14917. node = dom.byId(node);
  14918. if(condition === undefined){
  14919. classStr = str2array(classStr);
  14920. for(var i = 0, len = classStr.length; i < len; ++i){
  14921. node[classList].toggle(classStr[i]);
  14922. }
  14923. }else{
  14924. cls[condition ? "add" : "remove"](node, classStr);
  14925. }
  14926. return condition; // Boolean
  14927. }
  14928. }
  14929. }
  14930. */
  14931. // regular DOM version
  14932. var fakeNode = {}; // for effective replacement
  14933. cls = {
  14934. // summary:
  14935. // This module defines the core dojo DOM class API.
  14936. contains: function containsClass(/*DomNode|String*/ node, /*String*/ classStr){
  14937. // summary:
  14938. // Returns whether or not the specified classes are a portion of the
  14939. // class list currently applied to the node.
  14940. // node: String|DOMNode
  14941. // String ID or DomNode reference to check the class for.
  14942. // classStr: String
  14943. // A string class name to look for.
  14944. // example:
  14945. // Do something if a node with id="someNode" has class="aSillyClassName" present
  14946. // | if(dojo.hasClass("someNode","aSillyClassName")){ ... }
  14947. return ((" " + dom.byId(node)[className] + " ").indexOf(" " + classStr + " ") >= 0); // Boolean
  14948. },
  14949. add: function addClass(/*DomNode|String*/ node, /*String|Array*/ classStr){
  14950. // summary:
  14951. // Adds the specified classes to the end of the class list on the
  14952. // passed node. Will not re-apply duplicate classes.
  14953. //
  14954. // node: String|DOMNode
  14955. // String ID or DomNode reference to add a class string too
  14956. //
  14957. // classStr: String|Array
  14958. // A String class name to add, or several space-separated class names,
  14959. // or an array of class names.
  14960. //
  14961. // example:
  14962. // Add a class to some node:
  14963. // | require(["dojo/dom-class"], function(domClass){
  14964. // | domClass.add("someNode", "anewClass");
  14965. // | });
  14966. //
  14967. // example:
  14968. // Add two classes at once:
  14969. // | require(["dojo/dom-class"], function(domClass){
  14970. // | domClass.add("someNode", "firstClass secondClass");
  14971. // | });
  14972. //
  14973. // example:
  14974. // Add two classes at once (using array):
  14975. // | require(["dojo/dom-class"], function(domClass){
  14976. // | domClass.add("someNode", ["firstClass", "secondClass"]);
  14977. // | });
  14978. //
  14979. // example:
  14980. // Available in `dojo/NodeList` for multiple additions
  14981. // | require(["dojo/query"], function(query){
  14982. // | query("ul > li").addClass("firstLevel");
  14983. // | });
  14984. node = dom.byId(node);
  14985. classStr = str2array(classStr);
  14986. var cls = node[className], oldLen;
  14987. cls = cls ? " " + cls + " " : " ";
  14988. oldLen = cls.length;
  14989. for(var i = 0, len = classStr.length, c; i < len; ++i){
  14990. c = classStr[i];
  14991. if(c && cls.indexOf(" " + c + " ") < 0){
  14992. cls += c + " ";
  14993. }
  14994. }
  14995. if(oldLen < cls.length){
  14996. node[className] = cls.substr(1, cls.length - 2);
  14997. }
  14998. },
  14999. remove: function removeClass(/*DomNode|String*/ node, /*String|Array?*/ classStr){
  15000. // summary:
  15001. // Removes the specified classes from node. No `contains()`
  15002. // check is required.
  15003. //
  15004. // node: String|DOMNode
  15005. // String ID or DomNode reference to remove the class from.
  15006. //
  15007. // classStr: String|Array
  15008. // An optional String class name to remove, or several space-separated
  15009. // class names, or an array of class names. If omitted, all class names
  15010. // will be deleted.
  15011. //
  15012. // example:
  15013. // Remove a class from some node:
  15014. // | require(["dojo/dom-class"], function(domClass){
  15015. // | domClass.remove("someNode", "firstClass");
  15016. // | });
  15017. //
  15018. // example:
  15019. // Remove two classes from some node:
  15020. // | require(["dojo/dom-class"], function(domClass){
  15021. // | domClass.remove("someNode", "firstClass secondClass");
  15022. // | });
  15023. //
  15024. // example:
  15025. // Remove two classes from some node (using array):
  15026. // | require(["dojo/dom-class"], function(domClass){
  15027. // | domClass.remove("someNode", ["firstClass", "secondClass"]);
  15028. // | });
  15029. //
  15030. // example:
  15031. // Remove all classes from some node:
  15032. // | require(["dojo/dom-class"], function(domClass){
  15033. // | domClass.remove("someNode");
  15034. // | });
  15035. //
  15036. // example:
  15037. // Available in `dojo/NodeList` for multiple removal
  15038. // | require(["dojo/query"], function(query){
  15039. // | query("ul > li").removeClass("foo");
  15040. // | });
  15041. node = dom.byId(node);
  15042. var cls;
  15043. if(classStr !== undefined){
  15044. classStr = str2array(classStr);
  15045. cls = " " + node[className] + " ";
  15046. for(var i = 0, len = classStr.length; i < len; ++i){
  15047. cls = cls.replace(" " + classStr[i] + " ", " ");
  15048. }
  15049. cls = lang.trim(cls);
  15050. }else{
  15051. cls = "";
  15052. }
  15053. if(node[className] != cls){ node[className] = cls; }
  15054. },
  15055. replace: function replaceClass(/*DomNode|String*/ node, /*String|Array*/ addClassStr, /*String|Array?*/ removeClassStr){
  15056. // summary:
  15057. // Replaces one or more classes on a node if not present.
  15058. // Operates more quickly than calling dojo.removeClass and dojo.addClass
  15059. //
  15060. // node: String|DOMNode
  15061. // String ID or DomNode reference to remove the class from.
  15062. //
  15063. // addClassStr: String|Array
  15064. // A String class name to add, or several space-separated class names,
  15065. // or an array of class names.
  15066. //
  15067. // removeClassStr: String|Array?
  15068. // A String class name to remove, or several space-separated class names,
  15069. // or an array of class names.
  15070. //
  15071. // example:
  15072. // | require(["dojo/dom-class"], function(domClass){
  15073. // | domClass.replace("someNode", "add1 add2", "remove1 remove2");
  15074. // | });
  15075. //
  15076. // example:
  15077. // Replace all classes with addMe
  15078. // | require(["dojo/dom-class"], function(domClass){
  15079. // | domClass.replace("someNode", "addMe");
  15080. // | });
  15081. //
  15082. // example:
  15083. // Available in `dojo/NodeList` for multiple toggles
  15084. // | require(["dojo/query"], function(query){
  15085. // | query(".findMe").replaceClass("addMe", "removeMe");
  15086. // | });
  15087. node = dom.byId(node);
  15088. fakeNode[className] = node[className];
  15089. cls.remove(fakeNode, removeClassStr);
  15090. cls.add(fakeNode, addClassStr);
  15091. if(node[className] !== fakeNode[className]){
  15092. node[className] = fakeNode[className];
  15093. }
  15094. },
  15095. toggle: function toggleClass(/*DomNode|String*/ node, /*String|Array*/ classStr, /*Boolean?*/ condition){
  15096. // summary:
  15097. // Adds a class to node if not present, or removes if present.
  15098. // Pass a boolean condition if you want to explicitly add or remove.
  15099. // Returns the condition that was specified directly or indirectly.
  15100. //
  15101. // node: String|DOMNode
  15102. // String ID or DomNode reference to toggle a class string
  15103. //
  15104. // classStr: String|Array
  15105. // A String class name to toggle, or several space-separated class names,
  15106. // or an array of class names.
  15107. //
  15108. // condition:
  15109. // If passed, true means to add the class, false means to remove.
  15110. // Otherwise dojo.hasClass(node, classStr) is used to detect the class presence.
  15111. //
  15112. // example:
  15113. // | require(["dojo/dom-class"], function(domClass){
  15114. // | domClass.toggle("someNode", "hovered");
  15115. // | });
  15116. //
  15117. // example:
  15118. // Forcefully add a class
  15119. // | require(["dojo/dom-class"], function(domClass){
  15120. // | domClass.toggle("someNode", "hovered", true);
  15121. // | });
  15122. //
  15123. // example:
  15124. // Available in `dojo/NodeList` for multiple toggles
  15125. // | require(["dojo/query"], function(query){
  15126. // | query(".toggleMe").toggleClass("toggleMe");
  15127. // | });
  15128. node = dom.byId(node);
  15129. if(condition === undefined){
  15130. classStr = str2array(classStr);
  15131. for(var i = 0, len = classStr.length, c; i < len; ++i){
  15132. c = classStr[i];
  15133. cls[cls.contains(node, c) ? "remove" : "add"](node, c);
  15134. }
  15135. }else{
  15136. cls[condition ? "add" : "remove"](node, classStr);
  15137. }
  15138. return condition; // Boolean
  15139. }
  15140. };
  15141. return cls;
  15142. });
  15143. },
  15144. 'dojo/_base/config':function(){
  15145. define(["../has", "require"], function(has, require){
  15146. // module:
  15147. // dojo/_base/config
  15148. /*=====
  15149. return {
  15150. // summary:
  15151. // This module defines the user configuration during bootstrap.
  15152. // description:
  15153. // By defining user configuration as a module value, an entire configuration can be specified in a build,
  15154. // thereby eliminating the need for sniffing and or explicitly setting in the global variable dojoConfig.
  15155. // Also, when multiple instances of dojo exist in a single application, each will necessarily be located
  15156. // at an unique absolute module identifier as given by the package configuration. Implementing configuration
  15157. // as a module allows for specifying unique, per-instance configurations.
  15158. // example:
  15159. // Create a second instance of dojo with a different, instance-unique configuration (assume the loader and
  15160. // dojo.js are already loaded).
  15161. // | // specify a configuration that creates a new instance of dojo at the absolute module identifier "myDojo"
  15162. // | require({
  15163. // | packages:[{
  15164. // | name:"myDojo",
  15165. // | location:".", //assume baseUrl points to dojo.js
  15166. // | }]
  15167. // | });
  15168. // |
  15169. // | // specify a configuration for the myDojo instance
  15170. // | define("myDojo/config", {
  15171. // | // normal configuration variables go here, e.g.,
  15172. // | locale:"fr-ca"
  15173. // | });
  15174. // |
  15175. // | // load and use the new instance of dojo
  15176. // | require(["myDojo"], function(dojo){
  15177. // | // dojo is the new instance of dojo
  15178. // | // use as required
  15179. // | });
  15180. // isDebug: Boolean
  15181. // Defaults to `false`. If set to `true`, ensures that Dojo provides
  15182. // extended debugging feedback via Firebug. If Firebug is not available
  15183. // on your platform, setting `isDebug` to `true` will force Dojo to
  15184. // pull in (and display) the version of Firebug Lite which is
  15185. // integrated into the Dojo distribution, thereby always providing a
  15186. // debugging/logging console when `isDebug` is enabled. Note that
  15187. // Firebug's `console.*` methods are ALWAYS defined by Dojo. If
  15188. // `isDebug` is false and you are on a platform without Firebug, these
  15189. // methods will be defined as no-ops.
  15190. isDebug: false,
  15191. // locale: String
  15192. // The locale to assume for loading localized resources in this page,
  15193. // specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
  15194. // Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
  15195. // See the documentation for `dojo.i18n` and `dojo.requireLocalization`
  15196. // for details on loading localized resources. If no locale is specified,
  15197. // Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
  15198. // or `navigator.language` properties.
  15199. locale: undefined,
  15200. // extraLocale: Array
  15201. // No default value. Specifies additional locales whose
  15202. // resources should also be loaded alongside the default locale when
  15203. // calls to `dojo.requireLocalization()` are processed.
  15204. extraLocale: undefined,
  15205. // baseUrl: String
  15206. // The directory in which `dojo.js` is located. Under normal
  15207. // conditions, Dojo auto-detects the correct location from which it
  15208. // was loaded. You may need to manually configure `baseUrl` in cases
  15209. // where you have renamed `dojo.js` or in which `<base>` tags confuse
  15210. // some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
  15211. // either the value of `djConfig.baseUrl` if one is provided or the
  15212. // auto-detected root if not. Other modules are located relative to
  15213. // this path. The path should end in a slash.
  15214. baseUrl: undefined,
  15215. // modulePaths: [deprecated] Object
  15216. // A map of module names to paths relative to `dojo.baseUrl`. The
  15217. // key/value pairs correspond directly to the arguments which
  15218. // `dojo.registerModulePath` accepts. Specifying
  15219. // `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
  15220. // of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
  15221. // modules may be configured via `djConfig.modulePaths`.
  15222. modulePaths: {},
  15223. // addOnLoad: Function|Array
  15224. // Adds a callback via dojo/ready. Useful when Dojo is added after
  15225. // the page loads and djConfig.afterOnLoad is true. Supports the same
  15226. // arguments as dojo/ready. When using a function reference, use
  15227. // `djConfig.addOnLoad = function(){};`. For object with function name use
  15228. // `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
  15229. // function reference use
  15230. // `djConfig.addOnLoad = [myObject, function(){}];`
  15231. addOnLoad: null,
  15232. // parseOnLoad: Boolean
  15233. // Run the parser after the page is loaded
  15234. parseOnLoad: false,
  15235. // require: String[]
  15236. // An array of module names to be loaded immediately after dojo.js has been included
  15237. // in a page.
  15238. require: [],
  15239. // defaultDuration: Number
  15240. // Default duration, in milliseconds, for wipe and fade animations within dijits.
  15241. // Assigned to dijit.defaultDuration.
  15242. defaultDuration: 200,
  15243. // dojoBlankHtmlUrl: String
  15244. // Used by some modules to configure an empty iframe. Used by dojo/io/iframe and
  15245. // dojo/back, and dijit/popup support in IE where an iframe is needed to make sure native
  15246. // controls do not bleed through the popups. Normally this configuration variable
  15247. // does not need to be set, except when using cross-domain/CDN Dojo builds.
  15248. // Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
  15249. // to the path on your domain your copy of blank.html.
  15250. dojoBlankHtmlUrl: undefined,
  15251. // ioPublish: Boolean?
  15252. // Set this to true to enable publishing of topics for the different phases of
  15253. // IO operations. Publishing is done via dojo/topic.publish(). See dojo/main.__IoPublish for a list
  15254. // of topics that are published.
  15255. ioPublish: false,
  15256. // useCustomLogger: Anything?
  15257. // If set to a value that evaluates to true such as a string or array and
  15258. // isDebug is true and Firebug is not available or running, then it bypasses
  15259. // the creation of Firebug Lite allowing you to define your own console object.
  15260. useCustomLogger: undefined,
  15261. // transparentColor: Array
  15262. // Array containing the r, g, b components used as transparent color in dojo.Color;
  15263. // if undefined, [255,255,255] (white) will be used.
  15264. transparentColor: undefined,
  15265. // deps: Function|Array
  15266. // Defines dependencies to be used before the loader has been loaded.
  15267. // When provided, they cause the loader to execute require(deps, callback)
  15268. // once it has finished loading. Should be used with callback.
  15269. deps: undefined,
  15270. // callback: Function|Array
  15271. // Defines a callback to be used when dependencies are defined before
  15272. // the loader has been loaded. When provided, they cause the loader to
  15273. // execute require(deps, callback) once it has finished loading.
  15274. // Should be used with deps.
  15275. callback: undefined,
  15276. // deferredInstrumentation: Boolean
  15277. // Whether deferred instrumentation should be loaded or included
  15278. // in builds.
  15279. deferredInstrumentation: true,
  15280. // useDeferredInstrumentation: Boolean|String
  15281. // Whether the deferred instrumentation should be used.
  15282. //
  15283. // * `"report-rejections"`: report each rejection as it occurs.
  15284. // * `true` or `1` or `"report-unhandled-rejections"`: wait 1 second
  15285. // in an attempt to detect unhandled rejections.
  15286. useDeferredInstrumentation: "report-unhandled-rejections"
  15287. };
  15288. =====*/
  15289. var result = {};
  15290. if( 1 ){
  15291. // must be the dojo loader; take a shallow copy of require.rawConfig
  15292. var src = require.rawConfig, p;
  15293. for(p in src){
  15294. result[p] = src[p];
  15295. }
  15296. }else{
  15297. var adviseHas = function(featureSet, prefix, booting){
  15298. for(p in featureSet){
  15299. p!="has" && has.add(prefix + p, featureSet[p], 0, booting);
  15300. }
  15301. };
  15302. result = 1 ?
  15303. // must be a built version of the dojo loader; all config stuffed in require.rawConfig
  15304. require.rawConfig :
  15305. // a foreign loader
  15306. this.dojoConfig || this.djConfig || {};
  15307. adviseHas(result, "config", 1);
  15308. adviseHas(result.has, "", 1);
  15309. }
  15310. return result;
  15311. });
  15312. },
  15313. 'dojo/main':function(){
  15314. define([
  15315. "./_base/kernel", // kernel.isAsync
  15316. "./has",
  15317. "require",
  15318. "./sniff",
  15319. "./_base/lang",
  15320. "./_base/array",
  15321. "./_base/config",
  15322. "./ready",
  15323. "./_base/declare",
  15324. "./_base/connect",
  15325. "./_base/Deferred",
  15326. "./_base/json",
  15327. "./_base/Color",
  15328. "./has!dojo-firebug?./_firebug/firebug",
  15329. "./_base/browser",
  15330. "./_base/loader"
  15331. ], function(kernel, has, require, sniff, lang, array, config, ready){
  15332. // module:
  15333. // dojo/main
  15334. // summary:
  15335. // This is the package main module for the dojo package; it loads dojo base appropriate for the execution environment.
  15336. // the preferred way to load the dojo firebug console is by setting has("dojo-firebug") true in dojoConfig
  15337. // the isDebug config switch is for backcompat and will work fine in sync loading mode; it works in
  15338. // async mode too, but there's no guarantee when the module is loaded; therefore, if you need a firebug
  15339. // console guaranteed at a particular spot in an app, either set config.has["dojo-firebug"] true before
  15340. // loading dojo.js or explicitly include dojo/_firebug/firebug in a dependency list.
  15341. if(config.isDebug){
  15342. require(["./_firebug/firebug"]);
  15343. }
  15344. // dojoConfig.require is deprecated; use the loader configuration property deps
  15345. 1 || has.add("dojo-config-require", 1);
  15346. if( 1 ){
  15347. var deps= config.require;
  15348. if(deps){
  15349. // config.require may be dot notation
  15350. deps= array.map(lang.isArray(deps) ? deps : [deps], function(item){ return item.replace(/\./g, "/"); });
  15351. if(kernel.isAsync){
  15352. require(deps);
  15353. }else{
  15354. // this is a bit janky; in 1.6- dojo is defined before these requires are applied; but in 1.7+
  15355. // dojo isn't defined until returning from this module; this is only a problem in sync mode
  15356. // since we're in sync mode, we know we've got our loader with its priority ready queue
  15357. ready(1, function(){require(deps);});
  15358. }
  15359. }
  15360. }
  15361. return kernel;
  15362. });
  15363. },
  15364. 'dojo/_base/event':function(){
  15365. define("dojo/_base/event", ["./kernel", "../on", "../has", "../dom-geometry"], function(dojo, on, has, dom){
  15366. // module:
  15367. // dojo/_base/event
  15368. if(on._fixEvent){
  15369. var fixEvent = on._fixEvent;
  15370. on._fixEvent = function(evt, se){
  15371. // add some additional normalization for back-compat, this isn't in on.js because it is somewhat more expensive
  15372. evt = fixEvent(evt, se);
  15373. if(evt){
  15374. dom.normalizeEvent(evt);
  15375. }
  15376. return evt;
  15377. };
  15378. }
  15379. var ret = {
  15380. // summary:
  15381. // This module defines dojo DOM event API. Usually you should use dojo/on, and evt.stopPropagation() +
  15382. // evt.preventDefault(), rather than this module.
  15383. fix: function(/*Event*/ evt, /*DOMNode*/ sender){
  15384. // summary:
  15385. // normalizes properties on the event object including event
  15386. // bubbling methods, keystroke normalization, and x/y positions
  15387. // evt: Event
  15388. // native event object
  15389. // sender: DOMNode
  15390. // node to treat as "currentTarget"
  15391. if(on._fixEvent){
  15392. return on._fixEvent(evt, sender);
  15393. }
  15394. return evt; // Event
  15395. },
  15396. stop: function(/*Event*/ evt){
  15397. // summary:
  15398. // prevents propagation and clobbers the default action of the
  15399. // passed event
  15400. // evt: Event
  15401. // The event object. If omitted, window.event is used on IE.
  15402. if(has("dom-addeventlistener") || (evt && evt.preventDefault)){
  15403. evt.preventDefault();
  15404. evt.stopPropagation();
  15405. }else{
  15406. evt = evt || window.event;
  15407. evt.cancelBubble = true;
  15408. on._preventDefault.call(evt);
  15409. }
  15410. }
  15411. };
  15412. if( 1 ){
  15413. dojo.fixEvent = ret.fix;
  15414. dojo.stopEvent = ret.stop;
  15415. }
  15416. return ret;
  15417. });
  15418. },
  15419. 'dojo/sniff':function(){
  15420. define(["./has"], function(has){
  15421. // module:
  15422. // dojo/sniff
  15423. /*=====
  15424. return function(){
  15425. // summary:
  15426. // This module sets has() flags based on the current browser.
  15427. // It returns the has() function.
  15428. };
  15429. =====*/
  15430. if( 1 ){
  15431. var n = navigator,
  15432. dua = n.userAgent,
  15433. dav = n.appVersion,
  15434. tv = parseFloat(dav);
  15435. has.add("air", dua.indexOf("AdobeAIR") >= 0),
  15436. has.add("khtml", dav.indexOf("Konqueror") >= 0 ? tv : undefined);
  15437. has.add("webkit", parseFloat(dua.split("WebKit/")[1]) || undefined);
  15438. has.add("chrome", parseFloat(dua.split("Chrome/")[1]) || undefined);
  15439. has.add("safari", dav.indexOf("Safari")>=0 && !has("chrome") ? parseFloat(dav.split("Version/")[1]) : undefined);
  15440. has.add("mac", dav.indexOf("Macintosh") >= 0);
  15441. has.add("quirks", document.compatMode == "BackCompat");
  15442. has.add("ios", /iPhone|iPod|iPad/.test(dua));
  15443. has.add("android", parseFloat(dua.split("Android ")[1]) || undefined);
  15444. if(!has("webkit")){
  15445. // Opera
  15446. if(dua.indexOf("Opera") >= 0){
  15447. // see http://dev.opera.com/articles/view/opera-ua-string-changes and http://www.useragentstring.com/pages/Opera/
  15448. // 9.8 has both styles; <9.8, 9.9 only old style
  15449. has.add("opera", tv >= 9.8 ? parseFloat(dua.split("Version/")[1]) || tv : tv);
  15450. }
  15451. // Mozilla and firefox
  15452. if(dua.indexOf("Gecko") >= 0 && !has("khtml") && !has("webkit")){
  15453. has.add("mozilla", tv);
  15454. }
  15455. if(has("mozilla")){
  15456. //We really need to get away from this. Consider a sane isGecko approach for the future.
  15457. has.add("ff", parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined);
  15458. }
  15459. // IE
  15460. if(document.all && !has("opera")){
  15461. var isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
  15462. //In cases where the page has an HTTP header or META tag with
  15463. //X-UA-Compatible, then it is in emulation mode.
  15464. //Make sure isIE reflects the desired version.
  15465. //document.documentMode of 5 means quirks mode.
  15466. //Only switch the value if documentMode's major version
  15467. //is different from isIE's major version.
  15468. var mode = document.documentMode;
  15469. if(mode && mode != 5 && Math.floor(isIE) != mode){
  15470. isIE = mode;
  15471. }
  15472. has.add("ie", isIE);
  15473. }
  15474. // Wii
  15475. has.add("wii", typeof opera != "undefined" && opera.wiiremote);
  15476. }
  15477. }
  15478. return has;
  15479. });
  15480. },
  15481. 'dojo/request/handlers':function(){
  15482. define([
  15483. '../json',
  15484. '../_base/kernel',
  15485. '../_base/array',
  15486. '../has'
  15487. ], function(JSON, kernel, array, has){
  15488. has.add('activex', typeof ActiveXObject !== 'undefined');
  15489. var handleXML;
  15490. if(has('activex')){
  15491. // GUIDs obtained from http://msdn.microsoft.com/en-us/library/ms757837(VS.85).aspx
  15492. var dp = [
  15493. 'Msxml2.DOMDocument.6.0',
  15494. 'Msxml2.DOMDocument.4.0',
  15495. 'MSXML2.DOMDocument.3.0',
  15496. 'MSXML.DOMDocument' // 2.0
  15497. ];
  15498. handleXML = function(response){
  15499. var result = response.data;
  15500. if(!result || !result.documentElement){
  15501. var text = response.text;
  15502. array.some(dp, function(p){
  15503. try{
  15504. var dom = new ActiveXObject(p);
  15505. dom.async = false;
  15506. dom.loadXML(text);
  15507. result = dom;
  15508. }catch(e){ return false; }
  15509. return true;
  15510. });
  15511. }
  15512. return result;
  15513. };
  15514. }
  15515. var handlers = {
  15516. 'javascript': function(response){
  15517. return kernel.eval(response.text || '');
  15518. },
  15519. 'json': function(response){
  15520. return JSON.parse(response.text || null);
  15521. },
  15522. 'xml': handleXML
  15523. };
  15524. function handle(response){
  15525. var handler = handlers[response.options.handleAs];
  15526. response.data = handler ? handler(response) : (response.data || response.text);
  15527. return response;
  15528. }
  15529. handle.register = function(name, handler){
  15530. handlers[name] = handler;
  15531. };
  15532. return handle;
  15533. });
  15534. },
  15535. 'dojo/aspect':function(){
  15536. define("dojo/aspect", [], function(){
  15537. // module:
  15538. // dojo/aspect
  15539. "use strict";
  15540. var undefined, nextId = 0;
  15541. function advise(dispatcher, type, advice, receiveArguments){
  15542. var previous = dispatcher[type];
  15543. var around = type == "around";
  15544. var signal;
  15545. if(around){
  15546. var advised = advice(function(){
  15547. return previous.advice(this, arguments);
  15548. });
  15549. signal = {
  15550. remove: function(){
  15551. signal.cancelled = true;
  15552. },
  15553. advice: function(target, args){
  15554. return signal.cancelled ?
  15555. previous.advice(target, args) : // cancelled, skip to next one
  15556. advised.apply(target, args); // called the advised function
  15557. }
  15558. };
  15559. }else{
  15560. // create the remove handler
  15561. signal = {
  15562. remove: function(){
  15563. var previous = signal.previous;
  15564. var next = signal.next;
  15565. if(!next && !previous){
  15566. delete dispatcher[type];
  15567. }else{
  15568. if(previous){
  15569. previous.next = next;
  15570. }else{
  15571. dispatcher[type] = next;
  15572. }
  15573. if(next){
  15574. next.previous = previous;
  15575. }
  15576. }
  15577. },
  15578. id: nextId++,
  15579. advice: advice,
  15580. receiveArguments: receiveArguments
  15581. };
  15582. }
  15583. if(previous && !around){
  15584. if(type == "after"){
  15585. // add the listener to the end of the list
  15586. var next = previous;
  15587. while(next){
  15588. previous = next;
  15589. next = next.next;
  15590. }
  15591. previous.next = signal;
  15592. signal.previous = previous;
  15593. }else if(type == "before"){
  15594. // add to beginning
  15595. dispatcher[type] = signal;
  15596. signal.next = previous;
  15597. previous.previous = signal;
  15598. }
  15599. }else{
  15600. // around or first one just replaces
  15601. dispatcher[type] = signal;
  15602. }
  15603. return signal;
  15604. }
  15605. function aspect(type){
  15606. return function(target, methodName, advice, receiveArguments){
  15607. var existing = target[methodName], dispatcher;
  15608. if(!existing || existing.target != target){
  15609. // no dispatcher in place
  15610. target[methodName] = dispatcher = function(){
  15611. var executionId = nextId;
  15612. // before advice
  15613. var args = arguments;
  15614. var before = dispatcher.before;
  15615. while(before){
  15616. args = before.advice.apply(this, args) || args;
  15617. before = before.next;
  15618. }
  15619. // around advice
  15620. if(dispatcher.around){
  15621. var results = dispatcher.around.advice(this, args);
  15622. }
  15623. // after advice
  15624. var after = dispatcher.after;
  15625. while(after && after.id < executionId){
  15626. if(after.receiveArguments){
  15627. var newResults = after.advice.apply(this, args);
  15628. // change the return value only if a new value was returned
  15629. results = newResults === undefined ? results : newResults;
  15630. }else{
  15631. results = after.advice.call(this, results, args);
  15632. }
  15633. after = after.next;
  15634. }
  15635. return results;
  15636. };
  15637. if(existing){
  15638. dispatcher.around = {advice: function(target, args){
  15639. return existing.apply(target, args);
  15640. }};
  15641. }
  15642. dispatcher.target = target;
  15643. }
  15644. var results = advise((dispatcher || existing), type, advice, receiveArguments);
  15645. advice = null;
  15646. return results;
  15647. };
  15648. }
  15649. // TODOC: after/before/around return object
  15650. var after = aspect("after");
  15651. /*=====
  15652. after = function(target, methodName, advice, receiveArguments){
  15653. // summary:
  15654. // The "after" export of the aspect module is a function that can be used to attach
  15655. // "after" advice to a method. This function will be executed after the original method
  15656. // is executed. By default the function will be called with a single argument, the return
  15657. // value of the original method, or the the return value of the last executed advice (if a previous one exists).
  15658. // The fourth (optional) argument can be set to true to so the function receives the original
  15659. // arguments (from when the original method was called) rather than the return value.
  15660. // If there are multiple "after" advisors, they are executed in the order they were registered.
  15661. // target: Object
  15662. // This is the target object
  15663. // methodName: String
  15664. // This is the name of the method to attach to.
  15665. // advice: Function
  15666. // This is function to be called after the original method
  15667. // receiveArguments: Boolean?
  15668. // If this is set to true, the advice function receives the original arguments (from when the original mehtod
  15669. // was called) rather than the return value of the original/previous method.
  15670. // returns:
  15671. // A signal object that can be used to cancel the advice. If remove() is called on this signal object, it will
  15672. // stop the advice function from being executed.
  15673. };
  15674. =====*/
  15675. var before = aspect("before");
  15676. /*=====
  15677. before = function(target, methodName, advice){
  15678. // summary:
  15679. // The "before" export of the aspect module is a function that can be used to attach
  15680. // "before" advice to a method. This function will be executed before the original method
  15681. // is executed. This function will be called with the arguments used to call the method.
  15682. // This function may optionally return an array as the new arguments to use to call
  15683. // the original method (or the previous, next-to-execute before advice, if one exists).
  15684. // If the before method doesn't return anything (returns undefined) the original arguments
  15685. // will be preserved.
  15686. // If there are multiple "before" advisors, they are executed in the reverse order they were registered.
  15687. // target: Object
  15688. // This is the target object
  15689. // methodName: String
  15690. // This is the name of the method to attach to.
  15691. // advice: Function
  15692. // This is function to be called before the original method
  15693. };
  15694. =====*/
  15695. var around = aspect("around");
  15696. /*=====
  15697. around = function(target, methodName, advice){
  15698. // summary:
  15699. // The "around" export of the aspect module is a function that can be used to attach
  15700. // "around" advice to a method. The advisor function is immediately executed when
  15701. // the around() is called, is passed a single argument that is a function that can be
  15702. // called to continue execution of the original method (or the next around advisor).
  15703. // The advisor function should return a function, and this function will be called whenever
  15704. // the method is called. It will be called with the arguments used to call the method.
  15705. // Whatever this function returns will be returned as the result of the method call (unless after advise changes it).
  15706. // example:
  15707. // If there are multiple "around" advisors, the most recent one is executed first,
  15708. // which can then delegate to the next one and so on. For example:
  15709. // | around(obj, "foo", function(originalFoo){
  15710. // | return function(){
  15711. // | var start = new Date().getTime();
  15712. // | var results = originalFoo.apply(this, arguments); // call the original
  15713. // | var end = new Date().getTime();
  15714. // | console.log("foo execution took " + (end - start) + " ms");
  15715. // | return results;
  15716. // | };
  15717. // | });
  15718. // target: Object
  15719. // This is the target object
  15720. // methodName: String
  15721. // This is the name of the method to attach to.
  15722. // advice: Function
  15723. // This is function to be called around the original method
  15724. };
  15725. =====*/
  15726. return {
  15727. // summary:
  15728. // provides aspect oriented programming functionality, allowing for
  15729. // one to add before, around, or after advice on existing methods.
  15730. // example:
  15731. // | define(["dojo/aspect"], function(aspect){
  15732. // | var signal = aspect.after(targetObject, "methodName", function(someArgument){
  15733. // | this will be called when targetObject.methodName() is called, after the original function is called
  15734. // | });
  15735. //
  15736. // example:
  15737. // The returned signal object can be used to cancel the advice.
  15738. // | signal.remove(); // this will stop the advice from being executed anymore
  15739. // | aspect.before(targetObject, "methodName", function(someArgument){
  15740. // | // this will be called when targetObject.methodName() is called, before the original function is called
  15741. // | });
  15742. before: before,
  15743. around: around,
  15744. after: after
  15745. };
  15746. });
  15747. },
  15748. 'dojo/ready':function(){
  15749. define("dojo/ready", ["./_base/kernel", "./has", "require", "./domReady", "./_base/lang"], function(dojo, has, require, domReady, lang){
  15750. // module:
  15751. // dojo/ready
  15752. // note:
  15753. // This module should be unnecessary in dojo 2.0
  15754. var
  15755. // truthy if DOMContentLoaded or better (e.g., window.onload fired) has been achieved
  15756. isDomReady = 0,
  15757. // a function to call to cause onLoad to be called when all requested modules have been loaded
  15758. requestCompleteSignal,
  15759. // The queue of functions waiting to execute as soon as dojo.ready conditions satisfied
  15760. loadQ = [],
  15761. // prevent recursion in onLoad
  15762. onLoadRecursiveGuard = 0,
  15763. handleDomReady = function(){
  15764. isDomReady = 1;
  15765. dojo._postLoad = dojo.config.afterOnLoad = true;
  15766. if(loadQ.length){
  15767. requestCompleteSignal(onLoad);
  15768. }
  15769. },
  15770. // run the next function queued with dojo.ready
  15771. onLoad = function(){
  15772. if(isDomReady && !onLoadRecursiveGuard && loadQ.length){
  15773. //guard against recursions into this function
  15774. onLoadRecursiveGuard = 1;
  15775. var f = loadQ.shift();
  15776. try{
  15777. f();
  15778. }
  15779. // FIXME: signal the error via require.on
  15780. finally{
  15781. onLoadRecursiveGuard = 0;
  15782. }
  15783. onLoadRecursiveGuard = 0;
  15784. if(loadQ.length){
  15785. requestCompleteSignal(onLoad);
  15786. }
  15787. }
  15788. };
  15789. require.on("idle", onLoad);
  15790. requestCompleteSignal = function(){
  15791. if(require.idle()){
  15792. onLoad();
  15793. } // else do nothing, onLoad will be called with the next idle signal
  15794. };
  15795. var ready = dojo.ready = dojo.addOnLoad = function(priority, context, callback){
  15796. // summary:
  15797. // Add a function to execute on DOM content loaded and all requested modules have arrived and been evaluated.
  15798. // In most cases, the `domReady` plug-in should suffice and this method should not be needed.
  15799. // priority: Integer?
  15800. // The order in which to exec this callback relative to other callbacks, defaults to 1000
  15801. // context: Object?|Function
  15802. // The context in which to run execute callback, or a callback if not using context
  15803. // callback: Function?
  15804. // The function to execute.
  15805. //
  15806. // example:
  15807. // Simple DOM and Modules ready syntax
  15808. // | require(["dojo/ready"], function(ready){
  15809. // | ready(function(){ alert("Dom ready!"); });
  15810. // | });
  15811. //
  15812. // example:
  15813. // Using a priority
  15814. // | require(["dojo/ready"], function(ready){
  15815. // | ready(2, function(){ alert("low priority ready!"); })
  15816. // | });
  15817. //
  15818. // example:
  15819. // Using context
  15820. // | require(["dojo/ready"], function(ready){
  15821. // | ready(foo, function(){
  15822. // | // in here, this == foo
  15823. // | });
  15824. // | });
  15825. //
  15826. // example:
  15827. // Using dojo/hitch style args:
  15828. // | require(["dojo/ready"], function(ready){
  15829. // | var foo = { dojoReady: function(){ console.warn(this, "dojo dom and modules ready."); } };
  15830. // | ready(foo, "dojoReady");
  15831. // | });
  15832. var hitchArgs = lang._toArray(arguments);
  15833. if(typeof priority != "number"){
  15834. callback = context;
  15835. context = priority;
  15836. priority = 1000;
  15837. }else{
  15838. hitchArgs.shift();
  15839. }
  15840. callback = callback ?
  15841. lang.hitch.apply(dojo, hitchArgs) :
  15842. function(){
  15843. context();
  15844. };
  15845. callback.priority = priority;
  15846. for(var i = 0; i < loadQ.length && priority >= loadQ[i].priority; i++){}
  15847. loadQ.splice(i, 0, callback);
  15848. requestCompleteSignal();
  15849. };
  15850. 1 || has.add("dojo-config-addOnLoad", 1);
  15851. if( 1 ){
  15852. var dca = dojo.config.addOnLoad;
  15853. if(dca){
  15854. ready[(lang.isArray(dca) ? "apply" : "call")](dojo, dca);
  15855. }
  15856. }
  15857. if( 1 && dojo.config.parseOnLoad && !dojo.isAsync){
  15858. ready(99, function(){
  15859. if(!dojo.parser){
  15860. dojo.deprecated("Add explicit require(['dojo/parser']);", "", "2.0");
  15861. require(["dojo/parser"]);
  15862. }
  15863. });
  15864. }
  15865. if( 1 ){
  15866. domReady(handleDomReady);
  15867. }else{
  15868. handleDomReady();
  15869. }
  15870. return ready;
  15871. });
  15872. },
  15873. 'dojo/_base/connect':function(){
  15874. define(["./kernel", "../on", "../topic", "../aspect", "./event", "../mouse", "./sniff", "./lang", "../keys"], function(dojo, on, hub, aspect, eventModule, mouse, has, lang){
  15875. // module:
  15876. // dojo/_base/connect
  15877. has.add("events-keypress-typed", function(){ // keypresses should only occur a printable character is hit
  15878. var testKeyEvent = {charCode: 0};
  15879. try{
  15880. testKeyEvent = document.createEvent("KeyboardEvent");
  15881. (testKeyEvent.initKeyboardEvent || testKeyEvent.initKeyEvent).call(testKeyEvent, "keypress", true, true, null, false, false, false, false, 9, 3);
  15882. }catch(e){}
  15883. return testKeyEvent.charCode == 0 && !has("opera");
  15884. });
  15885. function connect_(obj, event, context, method, dontFix){
  15886. method = lang.hitch(context, method);
  15887. if(!obj || !(obj.addEventListener || obj.attachEvent)){
  15888. // it is a not a DOM node and we are using the dojo.connect style of treating a
  15889. // method like an event, must go right to aspect
  15890. return aspect.after(obj || dojo.global, event, method, true);
  15891. }
  15892. if(typeof event == "string" && event.substring(0, 2) == "on"){
  15893. event = event.substring(2);
  15894. }
  15895. if(!obj){
  15896. obj = dojo.global;
  15897. }
  15898. if(!dontFix){
  15899. switch(event){
  15900. // dojo.connect has special handling for these event types
  15901. case "keypress":
  15902. event = keypress;
  15903. break;
  15904. case "mouseenter":
  15905. event = mouse.enter;
  15906. break;
  15907. case "mouseleave":
  15908. event = mouse.leave;
  15909. break;
  15910. }
  15911. }
  15912. return on(obj, event, method, dontFix);
  15913. }
  15914. var _punctMap = {
  15915. 106:42,
  15916. 111:47,
  15917. 186:59,
  15918. 187:43,
  15919. 188:44,
  15920. 189:45,
  15921. 190:46,
  15922. 191:47,
  15923. 192:96,
  15924. 219:91,
  15925. 220:92,
  15926. 221:93,
  15927. 222:39,
  15928. 229:113
  15929. };
  15930. var evtCopyKey = has("mac") ? "metaKey" : "ctrlKey";
  15931. var _synthesizeEvent = function(evt, props){
  15932. var faux = lang.mixin({}, evt, props);
  15933. setKeyChar(faux);
  15934. // FIXME: would prefer to use lang.hitch: lang.hitch(evt, evt.preventDefault);
  15935. // but it throws an error when preventDefault is invoked on Safari
  15936. // does Event.preventDefault not support "apply" on Safari?
  15937. faux.preventDefault = function(){ evt.preventDefault(); };
  15938. faux.stopPropagation = function(){ evt.stopPropagation(); };
  15939. return faux;
  15940. };
  15941. function setKeyChar(evt){
  15942. evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
  15943. evt.charOrCode = evt.keyChar || evt.keyCode;
  15944. }
  15945. var keypress;
  15946. if(has("events-keypress-typed")){
  15947. // this emulates Firefox's keypress behavior where every keydown can correspond to a keypress
  15948. var _trySetKeyCode = function(e, code){
  15949. try{
  15950. // squelch errors when keyCode is read-only
  15951. // (e.g. if keyCode is ctrl or shift)
  15952. return (e.keyCode = code);
  15953. }catch(e){
  15954. return 0;
  15955. }
  15956. };
  15957. keypress = function(object, listener){
  15958. var keydownSignal = on(object, "keydown", function(evt){
  15959. // munge key/charCode
  15960. var k=evt.keyCode;
  15961. // These are Windows Virtual Key Codes
  15962. // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
  15963. var unprintable = (k!=13) && k!=32 && (k!=27||!has("ie")) && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222) && k!=229;
  15964. // synthesize keypress for most unprintables and CTRL-keys
  15965. if(unprintable||evt.ctrlKey){
  15966. var c = unprintable ? 0 : k;
  15967. if(evt.ctrlKey){
  15968. if(k==3 || k==13){
  15969. return listener.call(evt.currentTarget, evt); // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
  15970. }else if(c>95 && c<106){
  15971. c -= 48; // map CTRL-[numpad 0-9] to ASCII
  15972. }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
  15973. c += 32; // map CTRL-[A-Z] to lowercase
  15974. }else{
  15975. c = _punctMap[c] || c; // map other problematic CTRL combinations to ASCII
  15976. }
  15977. }
  15978. // simulate a keypress event
  15979. var faux = _synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
  15980. listener.call(evt.currentTarget, faux);
  15981. if(has("ie")){
  15982. _trySetKeyCode(evt, faux.keyCode);
  15983. }
  15984. }
  15985. });
  15986. var keypressSignal = on(object, "keypress", function(evt){
  15987. var c = evt.charCode;
  15988. c = c>=32 ? c : 0;
  15989. evt = _synthesizeEvent(evt, {charCode: c, faux: true});
  15990. return listener.call(this, evt);
  15991. });
  15992. return {
  15993. remove: function(){
  15994. keydownSignal.remove();
  15995. keypressSignal.remove();
  15996. }
  15997. };
  15998. };
  15999. }else{
  16000. if(has("opera")){
  16001. keypress = function(object, listener){
  16002. return on(object, "keypress", function(evt){
  16003. var c = evt.which;
  16004. if(c==3){
  16005. c=99; // Mozilla maps CTRL-BREAK to CTRL-c
  16006. }
  16007. // can't trap some keys at all, like INSERT and DELETE
  16008. // there is no differentiating info between DELETE and ".", or INSERT and "-"
  16009. c = c<32 && !evt.shiftKey ? 0 : c;
  16010. if(evt.ctrlKey && !evt.shiftKey && c>=65 && c<=90){
  16011. // lowercase CTRL-[A-Z] keys
  16012. c += 32;
  16013. }
  16014. return listener.call(this, _synthesizeEvent(evt, { charCode: c }));
  16015. });
  16016. };
  16017. }else{
  16018. keypress = function(object, listener){
  16019. return on(object, "keypress", function(evt){
  16020. setKeyChar(evt);
  16021. return listener.call(this, evt);
  16022. });
  16023. };
  16024. }
  16025. }
  16026. var connect = {
  16027. // summary:
  16028. // This module defines the dojo.connect API.
  16029. // This modules also provides keyboard event handling helpers.
  16030. // This module exports an extension event for emulating Firefox's keypress handling.
  16031. // However, this extension event exists primarily for backwards compatibility and
  16032. // is not recommended. WebKit and IE uses an alternate keypress handling (only
  16033. // firing for printable characters, to distinguish from keydown events), and most
  16034. // consider the WebKit/IE behavior more desirable.
  16035. _keypress:keypress,
  16036. connect:function(obj, event, context, method, dontFix){
  16037. // summary:
  16038. // `dojo.connect` is a deprecated event handling and delegation method in
  16039. // Dojo. It allows one function to "listen in" on the execution of
  16040. // any other, triggering the second whenever the first is called. Many
  16041. // listeners may be attached to a function, and source functions may
  16042. // be either regular function calls or DOM events.
  16043. //
  16044. // description:
  16045. // Connects listeners to actions, so that after event fires, a
  16046. // listener is called with the same arguments passed to the original
  16047. // function.
  16048. //
  16049. // Since `dojo.connect` allows the source of events to be either a
  16050. // "regular" JavaScript function or a DOM event, it provides a uniform
  16051. // interface for listening to all the types of events that an
  16052. // application is likely to deal with though a single, unified
  16053. // interface. DOM programmers may want to think of it as
  16054. // "addEventListener for everything and anything".
  16055. //
  16056. // When setting up a connection, the `event` parameter must be a
  16057. // string that is the name of the method/event to be listened for. If
  16058. // `obj` is null, `kernel.global` is assumed, meaning that connections
  16059. // to global methods are supported but also that you may inadvertently
  16060. // connect to a global by passing an incorrect object name or invalid
  16061. // reference.
  16062. //
  16063. // `dojo.connect` generally is forgiving. If you pass the name of a
  16064. // function or method that does not yet exist on `obj`, connect will
  16065. // not fail, but will instead set up a stub method. Similarly, null
  16066. // arguments may simply be omitted such that fewer than 4 arguments
  16067. // may be required to set up a connection See the examples for details.
  16068. //
  16069. // The return value is a handle that is needed to
  16070. // remove this connection with `dojo.disconnect`.
  16071. //
  16072. // obj: Object?
  16073. // The source object for the event function.
  16074. // Defaults to `kernel.global` if null.
  16075. // If obj is a DOM node, the connection is delegated
  16076. // to the DOM event manager (unless dontFix is true).
  16077. //
  16078. // event: String
  16079. // String name of the event function in obj.
  16080. // I.e. identifies a property `obj[event]`.
  16081. //
  16082. // context: Object|null
  16083. // The object that method will receive as "this".
  16084. //
  16085. // If context is null and method is a function, then method
  16086. // inherits the context of event.
  16087. //
  16088. // If method is a string then context must be the source
  16089. // object object for method (context[method]). If context is null,
  16090. // kernel.global is used.
  16091. //
  16092. // method: String|Function
  16093. // A function reference, or name of a function in context.
  16094. // The function identified by method fires after event does.
  16095. // method receives the same arguments as the event.
  16096. // See context argument comments for information on method's scope.
  16097. //
  16098. // dontFix: Boolean?
  16099. // If obj is a DOM node, set dontFix to true to prevent delegation
  16100. // of this connection to the DOM event manager.
  16101. //
  16102. // example:
  16103. // When obj.onchange(), do ui.update():
  16104. // | dojo.connect(obj, "onchange", ui, "update");
  16105. // | dojo.connect(obj, "onchange", ui, ui.update); // same
  16106. //
  16107. // example:
  16108. // Using return value for disconnect:
  16109. // | var link = dojo.connect(obj, "onchange", ui, "update");
  16110. // | ...
  16111. // | dojo.disconnect(link);
  16112. //
  16113. // example:
  16114. // When onglobalevent executes, watcher.handler is invoked:
  16115. // | dojo.connect(null, "onglobalevent", watcher, "handler");
  16116. //
  16117. // example:
  16118. // When ob.onCustomEvent executes, customEventHandler is invoked:
  16119. // | dojo.connect(ob, "onCustomEvent", null, "customEventHandler");
  16120. // | dojo.connect(ob, "onCustomEvent", "customEventHandler"); // same
  16121. //
  16122. // example:
  16123. // When ob.onCustomEvent executes, customEventHandler is invoked
  16124. // with the same scope (this):
  16125. // | dojo.connect(ob, "onCustomEvent", null, customEventHandler);
  16126. // | dojo.connect(ob, "onCustomEvent", customEventHandler); // same
  16127. //
  16128. // example:
  16129. // When globalEvent executes, globalHandler is invoked
  16130. // with the same scope (this):
  16131. // | dojo.connect(null, "globalEvent", null, globalHandler);
  16132. // | dojo.connect("globalEvent", globalHandler); // same
  16133. // normalize arguments
  16134. var a=arguments, args=[], i=0;
  16135. // if a[0] is a String, obj was omitted
  16136. args.push(typeof a[0] == "string" ? null : a[i++], a[i++]);
  16137. // if the arg-after-next is a String or Function, context was NOT omitted
  16138. var a1 = a[i+1];
  16139. args.push(typeof a1 == "string" || typeof a1 == "function" ? a[i++] : null, a[i++]);
  16140. // absorb any additional arguments
  16141. for(var l=a.length; i<l; i++){ args.push(a[i]); }
  16142. return connect_.apply(this, args);
  16143. },
  16144. disconnect:function(handle){
  16145. // summary:
  16146. // Remove a link created by dojo.connect.
  16147. // description:
  16148. // Removes the connection between event and the method referenced by handle.
  16149. // handle: Handle
  16150. // the return value of the dojo.connect call that created the connection.
  16151. if(handle){
  16152. handle.remove();
  16153. }
  16154. },
  16155. subscribe:function(topic, context, method){
  16156. // summary:
  16157. // Attach a listener to a named topic. The listener function is invoked whenever the
  16158. // named topic is published (see: dojo.publish).
  16159. // Returns a handle which is needed to unsubscribe this listener.
  16160. // topic: String
  16161. // The topic to which to subscribe.
  16162. // context: Object?
  16163. // Scope in which method will be invoked, or null for default scope.
  16164. // method: String|Function
  16165. // The name of a function in context, or a function reference. This is the function that
  16166. // is invoked when topic is published.
  16167. // example:
  16168. // | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); });
  16169. // | dojo.publish("alerts", [ "read this", "hello world" ]);
  16170. return hub.subscribe(topic, lang.hitch(context, method));
  16171. },
  16172. publish:function(topic, args){
  16173. // summary:
  16174. // Invoke all listener method subscribed to topic.
  16175. // topic: String
  16176. // The name of the topic to publish.
  16177. // args: Array?
  16178. // An array of arguments. The arguments will be applied
  16179. // to each topic subscriber (as first class parameters, via apply).
  16180. // example:
  16181. // | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
  16182. // | dojo.publish("alerts", [ "read this", "hello world" ]);
  16183. return hub.publish.apply(hub, [topic].concat(args));
  16184. },
  16185. connectPublisher:function(topic, obj, event){
  16186. // summary:
  16187. // Ensure that every time obj.event() is called, a message is published
  16188. // on the topic. Returns a handle which can be passed to
  16189. // dojo.disconnect() to disable subsequent automatic publication on
  16190. // the topic.
  16191. // topic: String
  16192. // The name of the topic to publish.
  16193. // obj: Object?
  16194. // The source object for the event function. Defaults to kernel.global
  16195. // if null.
  16196. // event: String
  16197. // The name of the event function in obj.
  16198. // I.e. identifies a property obj[event].
  16199. // example:
  16200. // | dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
  16201. var pf = function(){ connect.publish(topic, arguments); };
  16202. return event ? connect.connect(obj, event, pf) : connect.connect(obj, pf); //Handle
  16203. },
  16204. isCopyKey: function(e){
  16205. // summary:
  16206. // Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
  16207. // e: Event
  16208. // Event object to examine
  16209. return e[evtCopyKey]; // Boolean
  16210. }
  16211. };
  16212. connect.unsubscribe = connect.disconnect;
  16213. /*=====
  16214. connect.unsubscribe = function(handle){
  16215. // summary:
  16216. // Remove a topic listener.
  16217. // handle: Handle
  16218. // The handle returned from a call to subscribe.
  16219. // example:
  16220. // | var alerter = dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
  16221. // | ...
  16222. // | dojo.unsubscribe(alerter);
  16223. };
  16224. =====*/
  16225. 1 && lang.mixin(dojo, connect);
  16226. return connect;
  16227. });
  16228. },
  16229. 'dojo/errors/CancelError':function(){
  16230. define(["./create"], function(create){
  16231. // module:
  16232. // dojo/errors/CancelError
  16233. /*=====
  16234. return function(){
  16235. // summary:
  16236. // Default error if a promise is canceled without a reason.
  16237. };
  16238. =====*/
  16239. return create("CancelError", null, null, { dojoType: "cancel" });
  16240. });
  16241. }}});
  16242. (function(){
  16243. // must use this.require to make this work in node.js
  16244. var require = this.require;
  16245. // consume the cached dojo layer
  16246. require({cache:{}});
  16247. !require.async && require(["dojo"]);
  16248. require.boot && require.apply(null, require.boot);
  16249. })();