dojo.js.uncompressed.js 553 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595
  1. /*
  2. Copyright (c) 2004-2011, 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. false && 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. false && 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. if(!dojoRequirePlugin){
  193. dojoRequirePlugin = dojoRequirePlugin_;
  194. checkDojoRequirePlugin = checkDojoRequirePlugin_;
  195. transformToAmd = transformToAmd_;
  196. }
  197. return {
  198. sync:sync,
  199. xd:xd,
  200. arrived:arrived,
  201. nonmodule:nonmodule,
  202. executing:executing,
  203. executed:executed,
  204. syncExecStack:syncExecStack,
  205. modules:modules,
  206. execQ:execQ,
  207. getModule:getModule,
  208. injectModule:injectModule,
  209. setArrived:setArrived,
  210. signal:signal,
  211. finishExec:finishExec,
  212. execModule:execModule,
  213. dojoRequirePlugin:dojoRequirePlugin,
  214. getLegacyMode:function(){return legacyMode;},
  215. holdIdle:function(){checkCompleteGuard++;},
  216. releaseIdle:function(){checkIdle();}
  217. };
  218. };
  219. if(1){
  220. // in legacy sync mode, the loader needs a minimal XHR library to load dojo/_base/loader and dojo/_base/xhr
  221. var locationProtocol = location.protocol,
  222. locationHost = location.host,
  223. fileProtocol = !locationHost;
  224. req.isXdUrl = function(url){
  225. if(fileProtocol || /^\./.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. var match = url.match(/^([^\/\:]+\:)\/\/([^\/]+)/);
  235. return match && (match[1] != locationProtocol || match[2] != locationHost);
  236. };
  237. // note: to get the file:// protocol to work in FF, you must set security.fileuri.strict_origin_policy to false in about:config
  238. true || has.add("dojo-xhr-factory", 1);
  239. has.add("dojo-force-activex-xhr", 1 && !doc.addEventListener && window.location.protocol == "file:");
  240. has.add("native-xhr", typeof XMLHttpRequest != "undefined");
  241. if(has("native-xhr") && !has("dojo-force-activex-xhr")){
  242. getXhr = function(){
  243. return new XMLHttpRequest();
  244. };
  245. }else{
  246. // if in the browser an old IE; find an xhr
  247. for(var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], progid, i = 0; i < 3;){
  248. try{
  249. progid = XMLHTTP_PROGIDS[i++];
  250. if(new ActiveXObject(progid)){
  251. // this progid works; therefore, use it from now on
  252. break;
  253. }
  254. }catch(e){
  255. // squelch; we're just trying to find a good ActiveX progid
  256. // if they all fail, then progid ends up as the last attempt and that will signal the error
  257. // the first time the client actually tries to exec an xhr
  258. }
  259. }
  260. getXhr = function(){
  261. return new ActiveXObject(progid);
  262. };
  263. }
  264. req.getXhr = getXhr;
  265. has.add("dojo-gettext-api", 1);
  266. req.getText = function(url, async, onLoad){
  267. var xhr = getXhr();
  268. xhr.open('GET', fixupUrl(url), false);
  269. xhr.send(null);
  270. if(xhr.status == 200 || (!location.host && !xhr.status)){
  271. if(onLoad){
  272. onLoad(xhr.responseText, async);
  273. }
  274. }else{
  275. throw makeError("xhrFailed", xhr.status);
  276. }
  277. return xhr.responseText;
  278. };
  279. }
  280. }else{
  281. req.async = 1;
  282. }
  283. //
  284. // loader eval
  285. //
  286. var eval_ =
  287. // use the function constructor so our eval is scoped close to (but not in) in the global space with minimal pollution
  288. new Function('return eval(arguments[0]);');
  289. req.eval =
  290. function(text, hint){
  291. return eval_(text + "\r\n//# sourceURL=" + hint);
  292. };
  293. //
  294. // loader micro events API
  295. //
  296. var listenerQueues = {},
  297. error = "error",
  298. signal = req.signal = function(type, args){
  299. var queue = listenerQueues[type];
  300. // notice we run a copy of the queue; this allows listeners to add/remove
  301. // other listeners without affecting this particular signal
  302. forEach(queue && queue.slice(0), function(listener){
  303. listener.apply(null, isArray(args) ? args : [args]);
  304. });
  305. },
  306. on = req.on = function(type, listener){
  307. // notice a queue is not created until a client actually connects
  308. var queue = listenerQueues[type] || (listenerQueues[type] = []);
  309. queue.push(listener);
  310. return {
  311. remove:function(){
  312. for(var i = 0; i<queue.length; i++){
  313. if(queue[i]===listener){
  314. queue.splice(i, 1);
  315. return;
  316. }
  317. }
  318. }
  319. };
  320. };
  321. // configuration machinery; with an optimized/built defaultConfig, all configuration machinery can be discarded
  322. // lexical variables hold key loader data structures to help with minification; these may be completely,
  323. // one-time initialized by defaultConfig for optimized/built versions
  324. var
  325. aliases
  326. // a vector of pairs of [regexs or string, replacement] => (alias, actual)
  327. = [],
  328. paths
  329. // CommonJS paths
  330. = {},
  331. pathsMapProg
  332. // list of (from-path, to-path, regex, length) derived from paths;
  333. // a "program" to apply paths; see computeMapProg
  334. = [],
  335. packs
  336. // a map from packageId to package configuration object; see fixupPackageInfo
  337. = {},
  338. packageMap
  339. // map from package name to local-installed package name
  340. = {},
  341. packageMapProg
  342. // list of (from-package, to-package, regex, length) derived from packageMap;
  343. // a "program" to apply paths; see computeMapProg
  344. = [],
  345. modules
  346. // A hash:(mid) --> (module-object) the module namespace
  347. //
  348. // pid: the package identifier to which the module belongs (e.g., "dojo"); "" indicates the system or default package
  349. // mid: the fully-resolved (i.e., mappings have been applied) module identifier without the package identifier (e.g., "dojo/io/script")
  350. // url: the URL from which the module was retrieved
  351. // pack: the package object of the package to which the module belongs
  352. // executed: 0 => not executed; executing => in the process of tranversing deps and running factory; executed => factory has been executed
  353. // deps: the dependency vector for this module (vector of modules objects)
  354. // def: the factory for this module
  355. // result: the result of the running the factory for this module
  356. // injected: (requested | arrived | nonmodule) the status of the module; nonmodule means the resource did not call define
  357. // load: plugin load function; applicable only for plugins
  358. //
  359. // Modules go through several phases in creation:
  360. //
  361. // 1. Requested: some other module's definition or a require application contained the requested module in
  362. // its dependency vector or executing code explicitly demands a module via req.require.
  363. //
  364. // 2. Injected: a script element has been appended to the insert-point element demanding the resource implied by the URL
  365. //
  366. // 3. Loaded: the resource injected in [2] has been evalated.
  367. //
  368. // 4. Defined: the resource contained a define statement that advised the loader about the module. Notice that some
  369. // resources may just contain a bundle of code and never formally define a module via define
  370. //
  371. // 5. Evaluated: the module was defined via define and the loader has evaluated the factory and computed a result.
  372. = {},
  373. cacheBust
  374. // query string to append to module URLs to bust browser cache
  375. = "",
  376. cache
  377. // hash:(mid)-->(function)
  378. //
  379. // Gives the contents of a cached resource; function should cause the same actions as if the given mid was downloaded
  380. // and evaluated by the host environment
  381. = {},
  382. pendingCacheInsert
  383. // hash:(mid)-->(function)
  384. //
  385. // Gives a set of cache modules pending entry into cache. When cached modules are published to the loader, they are
  386. // entered into pendingCacheInsert; modules are then pressed into cache upon (1) AMD define or (2) upon receiving another
  387. // independent set of cached modules. (1) is the usual case, and this case allows normalizing mids given in the pending
  388. // cache for the local configuration, possibly relocating modules.
  389. = {},
  390. dojoSniffConfig
  391. // map of configuration variables
  392. // give the data-dojo-config as sniffed from the document (if any)
  393. = {};
  394. if(1){
  395. var consumePendingCacheInsert = function(referenceModule){
  396. var p, item, match, now;
  397. for(p in pendingCacheInsert){
  398. item = pendingCacheInsert[p];
  399. match = p.match(/^url\:(.+)/);
  400. if(match){
  401. cache[toUrl(match[1], referenceModule)] = item;
  402. }else if(p=="*now"){
  403. now = item;
  404. }else if(p!="*noref"){
  405. cache[getModuleInfo(p, referenceModule).mid] = item;
  406. }
  407. }
  408. if(now){
  409. now(createRequire(referenceModule));
  410. }
  411. pendingCacheInsert = {};
  412. },
  413. computeMapProg = function(map, dest, packName){
  414. // This routine takes a map target-prefix(string)-->replacement(string) into a vector
  415. // of quads (target-prefix, replacement, regex-for-target-prefix, length-of-target-prefix)
  416. //
  417. // The loader contains processes that map one string prefix to another. These
  418. // are encountered when applying the requirejs paths configuration and when mapping
  419. // package names. We can make the mapping and any replacement easier and faster by
  420. // replacing the map with a vector of quads and then using this structure in the simple machine runMapProg.
  421. dest.splice(0, dest.length);
  422. var p, i, item, reverseName = 0;
  423. for(p in map){
  424. dest.push([p, map[p]]);
  425. if(map[p]==packName){
  426. reverseName = p;
  427. }
  428. }
  429. dest.sort(function(lhs, rhs){
  430. return rhs[0].length - lhs[0].length;
  431. });
  432. for(i = 0; i < dest.length;){
  433. item = dest[i++];
  434. item[2] = new RegExp("^" + item[0].replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(c){ return "\\" + c; }) + "(\/|$)");
  435. item[3] = item[0].length + 1;
  436. }
  437. return reverseName;
  438. },
  439. fixupPackageInfo = function(packageInfo, baseUrl){
  440. // calculate the precise (name, baseUrl, main, mappings) for a package
  441. var name = packageInfo.name;
  442. if(!name){
  443. // packageInfo must be a string that gives the name
  444. name = packageInfo;
  445. packageInfo = {name:name};
  446. }
  447. packageInfo = mix({main:"main", mapProg:[]}, packageInfo);
  448. packageInfo.location = (baseUrl || "") + (packageInfo.location ? packageInfo.location : name);
  449. packageInfo.reverseName = computeMapProg(packageInfo.packageMap, packageInfo.mapProg, name);
  450. if(!packageInfo.main.indexOf("./")){
  451. packageInfo.main = packageInfo.main.substring(2);
  452. }
  453. // allow paths to be specified in the package info
  454. // TODO: this is not supported; remove
  455. mix(paths, packageInfo.paths);
  456. // now that we've got a fully-resolved package object, push it into the configuration
  457. packs[name] = packageInfo;
  458. packageMap[name] = name;
  459. },
  460. config = function(config, booting){
  461. for(var p in config){
  462. if(p=="waitSeconds"){
  463. req.waitms = (config[p] || 0) * 1000;
  464. }
  465. if(p=="cacheBust"){
  466. cacheBust = config[p] ? (isString(config[p]) ? config[p] : (new Date()).getTime() + "") : "";
  467. }
  468. if(p=="baseUrl" || p=="combo"){
  469. req[p] = config[p];
  470. }
  471. if(1 && p=="async"){
  472. // falsy or "sync" => legacy sync loader
  473. // "xd" => sync but loading xdomain tree and therefore loading asynchronously (not configurable, set automatically by the loader)
  474. // "legacyAsync" => permanently in "xd" by choice
  475. // "debugAtAllCosts" => trying to load everything via script injection (not implemented)
  476. // otherwise, must be truthy => AMD
  477. // legacyMode: sync | legacyAsync | xd | false
  478. var mode = config[p];
  479. req.legacyMode = legacyMode = (isString(mode) && /sync|legacyAsync/.test(mode) ? mode : (!mode ? "sync" : false));
  480. req.async = !legacyMode;
  481. }
  482. if(config[p]!==hasCache){
  483. // accumulate raw config info for client apps which can use this to pass their own config
  484. req.rawConfig[p] = config[p];
  485. p!="has" && has.add("config-"+p, config[p], 0, booting);
  486. }
  487. }
  488. // make sure baseUrl exists
  489. if(!req.baseUrl){
  490. req.baseUrl = "./";
  491. }
  492. // make sure baseUrl ends with a slash
  493. if(!/\/$/.test(req.baseUrl)){
  494. req.baseUrl += "/";
  495. }
  496. // now do the special work for has, packages, packagePaths, paths, aliases, and cache
  497. for(p in config.has){
  498. has.add(p, config.has[p], 0, booting);
  499. }
  500. // for each package found in any packages config item, augment the packs map owned by the loader
  501. forEach(config.packages, fixupPackageInfo);
  502. // for each packagePath found in any packagePaths config item, augment the packs map owned by the loader
  503. for(var baseUrl in config.packagePaths){
  504. forEach(config.packagePaths[baseUrl], function(packageInfo){
  505. fixupPackageInfo(packageInfo, baseUrl + "/");
  506. });
  507. }
  508. // push in any paths and recompute the internal pathmap
  509. // warning: this cann't be done until the package config is processed since packages may include path info
  510. computeMapProg(mix(paths, config.paths), pathsMapProg);
  511. // aliases
  512. forEach(config.aliases, function(pair){
  513. if(isString(pair[0])){
  514. pair[0] = new RegExp("^" + pair[0].replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(c){return "\\" + c;}) + "$");
  515. }
  516. aliases.push(pair);
  517. });
  518. // mix any packageMap config item and recompute the internal packageMapProg
  519. computeMapProg(mix(packageMap, config.packageMap), packageMapProg);
  520. // push in any new cache values
  521. if(config.cache){
  522. consumePendingCacheInsert();
  523. pendingCacheInsert = config.cache;
  524. if(config.cache["*noref"]){
  525. consumePendingCacheInsert();
  526. }
  527. }
  528. signal("config", [config, req.rawConfig]);
  529. };
  530. //
  531. // execute the various sniffs
  532. //
  533. if(has("dojo-cdn") || 1){
  534. for(var dojoDir, src, match, scripts = doc.getElementsByTagName("script"), i = 0; i < scripts.length && !match; i++){
  535. if((src = scripts[i].getAttribute("src")) && (match = src.match(/(.*)\/?dojo\.js(\W|$)/i))){
  536. // if baseUrl wasn't explicitly set, set it here to the dojo directory; this is the 1.6- behavior
  537. userConfig.baseUrl = dojoDir = userConfig.baseUrl || defaultConfig.baseUrl || match[1];
  538. // see if there's a dojo configuration stuffed into the node
  539. src = (scripts[i].getAttribute("data-dojo-config") || scripts[i].getAttribute("djConfig"));
  540. if(src){
  541. dojoSniffConfig = req.eval("({ " + src + " })", "data-dojo-config");
  542. }
  543. if(0){
  544. var dataMain = scripts[i].getAttribute("data-main");
  545. if(dataMain){
  546. dojoSniffConfig.deps = dojoSniffConfig.deps || [dataMain];
  547. }
  548. }
  549. }
  550. }
  551. }
  552. if(0){
  553. // pass down doh.testConfig from parent as if it were a data-dojo-config
  554. try{
  555. if(window.parent != window && window.parent.require){
  556. var doh = window.parent.require("doh");
  557. doh && mix(dojoSniffConfig, doh.testConfig);
  558. }
  559. }catch(e){}
  560. }
  561. // configure the loader; let the user override defaults
  562. req.rawConfig = {};
  563. config(defaultConfig, 1);
  564. config(userConfig, 1);
  565. config(dojoSniffConfig, 1);
  566. if(has("dojo-cdn")){
  567. packs.dojo.location = dojoDir;
  568. packs.dijit.location = dojoDir + "../dijit/";
  569. packs.dojox.location = dojoDir + "../dojox/";
  570. }
  571. }else{
  572. // no config API, assume defaultConfig has everything the loader needs...for the entire lifetime of the application
  573. paths = defaultConfig.paths;
  574. pathsMapProg = defaultConfig.pathsMapProg;
  575. packs = defaultConfig.packs;
  576. aliases = defaultConfig.aliases;
  577. packageMap = defaultConfig.packageMap;
  578. packageMapProg = defaultConfig.packageMapProg;
  579. modules = defaultConfig.modules;
  580. cache = defaultConfig.cache;
  581. cacheBust = defaultConfig.cacheBust;
  582. // remember the default config for other processes (e.g., dojo/config)
  583. req.rawConfig = defaultConfig;
  584. }
  585. if(0){
  586. req.combo = req.combo || {add:noop};
  587. var comboPending = 0,
  588. combosPending = [],
  589. comboPendingTimer = null;
  590. }
  591. // build the loader machinery iaw configuration, including has feature tests
  592. var injectDependencies = function(module){
  593. // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies
  594. checkCompleteGuard++;
  595. forEach(module.deps, injectModule);
  596. if(0 && comboPending && !comboPendingTimer){
  597. comboPendingTimer = setTimeout(function() {
  598. comboPending = 0;
  599. comboPendingTimer = null;
  600. req.combo.done(function(mids, url) {
  601. var onLoadCallback= function(){
  602. // defQ is a vector of module definitions 1-to-1, onto mids
  603. runDefQ(0, mids);
  604. checkComplete();
  605. };
  606. combosPending.push(mids);
  607. injectingModule = mids;
  608. req.injectUrl(url, onLoadCallback, mids);
  609. injectingModule = 0;
  610. }, req);
  611. }, 0);
  612. }
  613. checkIdle();
  614. },
  615. contextRequire = function(a1, a2, a3, referenceModule, contextRequire){
  616. var module, syntheticMid;
  617. if(isString(a1)){
  618. // signature is (moduleId)
  619. module = getModule(a1, referenceModule, true);
  620. if(module && module.executed){
  621. return module.result;
  622. }
  623. throw makeError("undefinedModule", a1);
  624. }
  625. if(!isArray(a1)){
  626. // a1 is a configuration
  627. config(a1);
  628. // juggle args; (a2, a3) may be (dependencies, callback)
  629. a1 = a2;
  630. a2 = a3;
  631. }
  632. if(isArray(a1)){
  633. // signature is (requestList [,callback])
  634. if(!a1.length){
  635. a2 && a2();
  636. }else{
  637. syntheticMid = "require*" + uid();
  638. // resolve the request list with respect to the reference module
  639. for(var mid, deps = [], i = 0; i < a1.length;){
  640. mid = a1[i++];
  641. if(mid in {exports:1, module:1}){
  642. throw makeError("illegalModuleId", mid);
  643. }
  644. deps.push(getModule(mid, referenceModule));
  645. }
  646. // construct a synthetic module to control execution of the requestList, and, optionally, callback
  647. module = mix(makeModuleInfo("", syntheticMid, 0, ""), {
  648. injected: arrived,
  649. deps: deps,
  650. def: a2 || noop,
  651. require: referenceModule ? referenceModule.require : req
  652. });
  653. modules[module.mid] = module;
  654. // checkComplete!=0 holds the idle signal; we're not idle if we're injecting dependencies
  655. injectDependencies(module);
  656. // try to immediately execute
  657. // if already traversing a factory tree, then strict causes circular dependency to abort the execution; maybe
  658. // it's possible to execute this require later after the current traversal completes and avoid the circular dependency.
  659. // ...but *always* insist on immediate in synch mode
  660. var strict = checkCompleteGuard && req.async;
  661. checkCompleteGuard++;
  662. execModule(module, strict);
  663. checkIdle();
  664. if(!module.executed){
  665. // some deps weren't on board or circular dependency detected and strict; therefore, push into the execQ
  666. execQ.push(module);
  667. }
  668. checkComplete();
  669. }
  670. }
  671. return contextRequire;
  672. },
  673. createRequire = function(module){
  674. if(!module){
  675. return req;
  676. }
  677. var result = module.require;
  678. if(!result){
  679. result = function(a1, a2, a3){
  680. return contextRequire(a1, a2, a3, module, result);
  681. };
  682. module.require = mix(result, req);
  683. result.module = module;
  684. result.toUrl = function(name){
  685. return toUrl(name, module);
  686. };
  687. result.toAbsMid = function(mid){
  688. return toAbsMid(mid, module);
  689. };
  690. if(0){
  691. result.undef = function(mid){
  692. req.undef(mid, module);
  693. };
  694. }
  695. if(1){
  696. result.syncLoadNls = function(mid){
  697. var nlsModuleInfo = getModuleInfo(mid, module),
  698. nlsModule = modules[nlsModuleInfo.mid];
  699. if(!nlsModule || !nlsModule.executed){
  700. cached = cache[nlsModuleInfo.mid] || cache[nlsModuleInfo.cacheId];
  701. if(cached){
  702. evalModuleText(cached);
  703. nlsModule = modules[nlsModuleInfo.mid];
  704. }
  705. }
  706. return nlsModule && nlsModule.executed && nlsModule.result;
  707. };
  708. }
  709. }
  710. return result;
  711. },
  712. execQ =
  713. // The list of modules that need to be evaluated.
  714. [],
  715. defQ =
  716. // The queue of define arguments sent to loader.
  717. [],
  718. waiting =
  719. // The set of modules upon which the loader is waiting for definition to arrive
  720. {},
  721. setRequested = function(module){
  722. module.injected = requested;
  723. waiting[module.mid] = 1;
  724. if(module.url){
  725. waiting[module.url] = module.pack || 1;
  726. }
  727. },
  728. setArrived = function(module){
  729. module.injected = arrived;
  730. delete waiting[module.mid];
  731. if(module.url){
  732. delete waiting[module.url];
  733. }
  734. if(isEmpty(waiting)){
  735. clearTimer();
  736. 1 && legacyMode==xd && (legacyMode = sync);
  737. }
  738. },
  739. execComplete = req.idle =
  740. // says the loader has completed (or not) its work
  741. function(){
  742. return !defQ.length && isEmpty(waiting) && !execQ.length && !checkCompleteGuard;
  743. },
  744. runMapProg = function(targetMid, map){
  745. // search for targetMid in map; return the map item if found; falsy otherwise
  746. for(var i = 0; i < map.length; i++){
  747. if(map[i][2].test(targetMid)){
  748. return map[i];
  749. }
  750. }
  751. return 0;
  752. },
  753. compactPath = function(path){
  754. var result = [],
  755. segment, lastSegment;
  756. path = path.replace(/\\/g, '/').split('/');
  757. while(path.length){
  758. segment = path.shift();
  759. if(segment==".." && result.length && lastSegment!=".."){
  760. result.pop();
  761. lastSegment = result[result.length - 1];
  762. }else if(segment!="."){
  763. result.push(lastSegment= segment);
  764. } // else ignore "."
  765. }
  766. return result.join("/");
  767. },
  768. makeModuleInfo = function(pid, mid, pack, url, cacheId){
  769. if(1){
  770. var xd= req.isXdUrl(url);
  771. return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0, isXd:xd, isAmd:!!(xd || (packs[pid] && packs[pid].isAmd)), cacheId:cacheId};
  772. }else{
  773. return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0, cacheId:cacheId};
  774. }
  775. },
  776. getModuleInfo_ = function(mid, referenceModule, packs, modules, baseUrl, packageMapProg, pathsMapProg, alwaysCreate){
  777. // arguments are passed instead of using lexical variables so that this function my be used independent of the loader (e.g., the builder)
  778. // alwaysCreate is useful in this case so that getModuleInfo never returns references to real modules owned by the loader
  779. var pid, pack, midInPackage, mapProg, mapItem, path, url, result, isRelative, requestedMid, cacheId=0;
  780. requestedMid = mid;
  781. isRelative = /^\./.test(mid);
  782. if(/(^\/)|(\:)|(\.js$)/.test(mid) || (isRelative && !referenceModule)){
  783. // absolute path or protocol of .js filetype, or relative path but no reference module and therefore relative to page
  784. // whatever it is, it's not a module but just a URL of some sort
  785. return makeModuleInfo(0, mid, 0, mid);
  786. }else{
  787. // relative module ids are relative to the referenceModule; get rid of any dots
  788. mid = compactPath(isRelative ? (referenceModule.mid + "/../" + mid) : mid);
  789. if(/^\./.test(mid)){
  790. throw makeError("irrationalPath", mid);
  791. }
  792. // find the package indicated by the mid, if any
  793. mapProg = referenceModule && referenceModule.pack && referenceModule.pack.mapProg;
  794. mapItem = (mapProg && runMapProg(mid, mapProg)) || runMapProg(mid, packageMapProg);
  795. if(mapItem){
  796. // mid specified a module that's a member of a package; figure out the package id and module id
  797. // notice we expect pack.main to be valid with no pre or post slash
  798. pid = mapItem[1];
  799. mid = mid.substring(mapItem[3]);
  800. pack = packs[pid];
  801. if(!mid){
  802. mid= pack.main;
  803. }
  804. midInPackage = mid;
  805. cacheId = pack.reverseName + "/" + mid;
  806. mid = pid + "/" + mid;
  807. }else{
  808. pid = "";
  809. }
  810. // search aliases
  811. var candidateLength = 0,
  812. candidate = 0;
  813. forEach(aliases, function(pair){
  814. var match = mid.match(pair[0]);
  815. if(match && match.length>candidateLength){
  816. candidate = isFunction(pair[1]) ? mid.replace(pair[0], pair[1]) : pair[1];
  817. }
  818. });
  819. if(candidate){
  820. return getModuleInfo_(candidate, 0, packs, modules, baseUrl, packageMapProg, pathsMapProg, alwaysCreate);
  821. }
  822. result = modules[mid];
  823. if(result){
  824. return alwaysCreate ? makeModuleInfo(result.pid, result.mid, result.pack, result.url, cacheId) : modules[mid];
  825. }
  826. }
  827. // get here iff the sought-after module does not yet exist; therefore, we need to compute the URL given the
  828. // fully resolved (i.e., all relative indicators and package mapping resolved) module id
  829. mapItem = runMapProg(mid, pathsMapProg);
  830. if(mapItem){
  831. url = mapItem[1] + mid.substring(mapItem[3] - 1);
  832. }else if(pid){
  833. url = pack.location + "/" + midInPackage;
  834. }else if(has("config-tlmSiblingOfDojo")){
  835. url = "../" + mid;
  836. }else{
  837. url = mid;
  838. }
  839. // if result is not absolute, add baseUrl
  840. if(!(/(^\/)|(\:)/.test(url))){
  841. url = baseUrl + url;
  842. }
  843. url += ".js";
  844. return makeModuleInfo(pid, mid, pack, compactPath(url), cacheId);
  845. },
  846. getModuleInfo = function(mid, referenceModule){
  847. return getModuleInfo_(mid, referenceModule, packs, modules, req.baseUrl, packageMapProg, pathsMapProg);
  848. },
  849. resolvePluginResourceId = function(plugin, prid, referenceModule){
  850. return plugin.normalize ? plugin.normalize(prid, function(mid){return toAbsMid(mid, referenceModule);}) : toAbsMid(prid, referenceModule);
  851. },
  852. dynamicPluginUidGenerator = 0,
  853. getModule = function(mid, referenceModule, immediate){
  854. // compute and optionally construct (if necessary) the module implied by the mid with respect to referenceModule
  855. var match, plugin, prid, result;
  856. match = mid.match(/^(.+?)\!(.*)$/);
  857. if(match){
  858. // name was <plugin-module>!<plugin-resource-id>
  859. plugin = getModule(match[1], referenceModule, immediate);
  860. if(1 && legacyMode == sync && !plugin.executed){
  861. injectModule(plugin);
  862. if(plugin.injected===arrived && !plugin.executed){
  863. checkCompleteGuard++;
  864. execModule(plugin);
  865. checkIdle();
  866. }
  867. if(plugin.executed){
  868. promoteModuleToPlugin(plugin);
  869. }else{
  870. // we are in xdomain mode for some reason
  871. execQ.unshift(plugin);
  872. }
  873. }
  874. if(plugin.executed === executed && !plugin.load){
  875. // executed the module not knowing it was a plugin
  876. promoteModuleToPlugin(plugin);
  877. }
  878. // 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
  879. if(plugin.load){
  880. prid = resolvePluginResourceId(plugin, match[2], referenceModule);
  881. mid = (plugin.mid + "!" + (plugin.dynamic ? ++dynamicPluginUidGenerator + "!" : "") + prid);
  882. }else{
  883. prid = match[2];
  884. mid = plugin.mid + "!" + (++dynamicPluginUidGenerator) + "!waitingForPlugin";
  885. }
  886. result = {plugin:plugin, mid:mid, req:createRequire(referenceModule), prid:prid};
  887. }else{
  888. result = getModuleInfo(mid, referenceModule);
  889. }
  890. return modules[result.mid] || (!immediate && (modules[result.mid] = result));
  891. },
  892. toAbsMid = req.toAbsMid = function(mid, referenceModule){
  893. return getModuleInfo(mid, referenceModule).mid;
  894. },
  895. toUrl = req.toUrl = function(name, referenceModule){
  896. var moduleInfo = getModuleInfo(name+"/x", referenceModule),
  897. url = moduleInfo.url;
  898. return fixupUrl(moduleInfo.pid===0 ?
  899. // if pid===0, then name had a protocol or absolute path; either way, toUrl is the identify function in such cases
  900. name :
  901. // "/x.js" since getModuleInfo automatically appends ".js" and we appended "/x" to make name look likde a module id
  902. url.substring(0, url.length-5)
  903. );
  904. },
  905. nonModuleProps = {
  906. injected: arrived,
  907. executed: executed,
  908. def: nonmodule,
  909. result: nonmodule
  910. },
  911. makeCjs = function(mid){
  912. return modules[mid] = mix({mid:mid}, nonModuleProps);
  913. },
  914. cjsRequireModule = makeCjs("require"),
  915. cjsExportsModule = makeCjs("exports"),
  916. cjsModuleModule = makeCjs("module"),
  917. runFactory = function(module, args){
  918. req.trace("loader-run-factory", [module.mid]);
  919. var factory = module.def,
  920. result;
  921. 1 && syncExecStack.unshift(module);
  922. if(has("config-dojo-loader-catches")){
  923. try{
  924. result= isFunction(factory) ? factory.apply(null, args) : factory;
  925. }catch(e){
  926. signal(error, module.result = makeError("factoryThrew", [module, e]));
  927. }
  928. }else{
  929. result= isFunction(factory) ? factory.apply(null, args) : factory;
  930. }
  931. module.result = result===undefined && module.cjs ? module.cjs.exports : result;
  932. 1 && syncExecStack.shift(module);
  933. },
  934. abortExec = {},
  935. defOrder = 0,
  936. promoteModuleToPlugin = function(pluginModule){
  937. var plugin = pluginModule.result;
  938. pluginModule.dynamic = plugin.dynamic;
  939. pluginModule.normalize = plugin.normalize;
  940. pluginModule.load = plugin.load;
  941. return pluginModule;
  942. },
  943. resolvePluginLoadQ = function(plugin){
  944. // plugins is a newly executed module that has a loadQ waiting to run
  945. // step 1: traverse the loadQ and fixup the mid and prid; remember the map from original mid to new mid
  946. // recall the original mid was created before the plugin was on board and therefore it was impossible to
  947. // compute the final mid; accordingly, prid may or may not change, but the mid will definitely change
  948. var map = {};
  949. forEach(plugin.loadQ, function(pseudoPluginResource){
  950. // manufacture and insert the real module in modules
  951. var pseudoMid = pseudoPluginResource.mid,
  952. prid = resolvePluginResourceId(plugin, pseudoPluginResource.prid, pseudoPluginResource.req.module),
  953. mid = plugin.dynamic ? pseudoPluginResource.mid.replace(/waitingForPlugin$/, prid) : (plugin.mid + "!" + prid),
  954. pluginResource = mix(mix({}, pseudoPluginResource), {mid:mid, prid:prid, injected:0});
  955. if(!modules[mid]){
  956. // create a new (the real) plugin resource and inject it normally now that the plugin is on board
  957. injectPlugin(modules[mid] = pluginResource);
  958. } // else this was a duplicate request for the same (plugin, rid) for a nondynamic plugin
  959. // pluginResource is really just a placeholder with the wrong mid (because we couldn't calculate it until the plugin was on board)
  960. // mark is as arrived and delete it from modules; the real module was requested above
  961. map[pseudoPluginResource.mid] = modules[mid];
  962. setArrived(pseudoPluginResource);
  963. delete modules[pseudoPluginResource.mid];
  964. });
  965. plugin.loadQ = 0;
  966. // step2: replace all references to any placeholder modules with real modules
  967. var substituteModules = function(module){
  968. for(var replacement, deps = module.deps || [], i = 0; i<deps.length; i++){
  969. replacement = map[deps[i].mid];
  970. if(replacement){
  971. deps[i] = replacement;
  972. }
  973. }
  974. };
  975. for(var p in modules){
  976. substituteModules(modules[p]);
  977. }
  978. forEach(execQ, substituteModules);
  979. },
  980. finishExec = function(module){
  981. req.trace("loader-finish-exec", [module.mid]);
  982. module.executed = executed;
  983. module.defOrder = defOrder++;
  984. 1 && forEach(module.provides, function(cb){ cb(); });
  985. if(module.loadQ){
  986. // the module was a plugin
  987. promoteModuleToPlugin(module);
  988. resolvePluginLoadQ(module);
  989. }
  990. // remove all occurences of this module from the execQ
  991. for(i = 0; i < execQ.length;){
  992. if(execQ[i] === module){
  993. execQ.splice(i, 1);
  994. }else{
  995. i++;
  996. }
  997. }
  998. },
  999. circleTrace = [],
  1000. execModule = function(module, strict){
  1001. // run the dependency vector, then run the factory for module
  1002. if(module.executed === executing){
  1003. req.trace("loader-circular-dependency", [circleTrace.concat(mid).join("->")]);
  1004. return (!module.def || strict) ? abortExec : (module.cjs && module.cjs.exports);
  1005. }
  1006. // at this point the module is either not executed or fully executed
  1007. if(!module.executed){
  1008. if(!module.def){
  1009. return abortExec;
  1010. }
  1011. var mid = module.mid,
  1012. deps = module.deps || [],
  1013. arg, argResult,
  1014. args = [],
  1015. i = 0;
  1016. if(0){
  1017. circleTrace.push(mid);
  1018. req.trace("loader-exec-module", ["exec", circleTrace.length, mid]);
  1019. }
  1020. // for circular dependencies, assume the first module encountered was executed OK
  1021. // modules that circularly depend on a module that has not run its factory will get
  1022. // the premade cjs.exports===module.result. They can take a reference to this object and/or
  1023. // add properties to it. When the module finally runs its factory, the factory can
  1024. // read/write/replace this object. Notice that so long as the object isn't replaced, any
  1025. // reference taken earlier while walking the deps list is still valid.
  1026. module.executed = executing;
  1027. while(i < deps.length){
  1028. arg = deps[i++];
  1029. argResult = ((arg === cjsRequireModule) ? createRequire(module) :
  1030. ((arg === cjsExportsModule) ? module.cjs.exports :
  1031. ((arg === cjsModuleModule) ? module.cjs :
  1032. execModule(arg, strict))));
  1033. if(argResult === abortExec){
  1034. module.executed = 0;
  1035. req.trace("loader-exec-module", ["abort", mid]);
  1036. 0 && circleTrace.pop();
  1037. return abortExec;
  1038. }
  1039. args.push(argResult);
  1040. }
  1041. runFactory(module, args);
  1042. finishExec(module);
  1043. }
  1044. // at this point the module is guaranteed fully executed
  1045. 0 && circleTrace.pop();
  1046. return module.result;
  1047. },
  1048. checkCompleteGuard = 0,
  1049. checkComplete = function(){
  1050. // keep going through the execQ as long as at least one factory is executed
  1051. // plugins, recursion, cached modules all make for many execution path possibilities
  1052. if(checkCompleteGuard){
  1053. return;
  1054. }
  1055. checkCompleteGuard++;
  1056. checkDojoRequirePlugin();
  1057. for(var currentDefOrder, module, i = 0; i < execQ.length;){
  1058. currentDefOrder = defOrder;
  1059. module = execQ[i];
  1060. execModule(module);
  1061. if(currentDefOrder!=defOrder){
  1062. // defOrder was bumped one or more times indicating something was executed (note, this indicates
  1063. // the execQ was modified, maybe a lot (for example a later module causes an earlier module to execute)
  1064. checkDojoRequirePlugin();
  1065. i = 0;
  1066. }else{
  1067. // nothing happened; check the next module in the exec queue
  1068. i++;
  1069. }
  1070. }
  1071. checkIdle();
  1072. },
  1073. checkIdle = function(){
  1074. checkCompleteGuard--;
  1075. if(execComplete()){
  1076. signal("idle", []);
  1077. }
  1078. };
  1079. if(0){
  1080. req.undef = function(moduleId, referenceModule){
  1081. // In order to reload a module, it must be undefined (this routine) and then re-requested.
  1082. // This is useful for testing frameworks (at least).
  1083. var module = getModule(moduleId, referenceModule);
  1084. setArrived(module);
  1085. delete modules[module.mid];
  1086. };
  1087. }
  1088. if(1){
  1089. if(has("dojo-loader-eval-hint-url")===undefined){
  1090. has.add("dojo-loader-eval-hint-url", 1);
  1091. }
  1092. var fixupUrl= function(url){
  1093. url += ""; // make sure url is a Javascript string (some paths may be a Java string)
  1094. return url + (cacheBust ? ((/\?/.test(url) ? "&" : "?") + cacheBust) : "");
  1095. },
  1096. injectPlugin = function(
  1097. module
  1098. ){
  1099. // injects the plugin module given by module; may have to inject the plugin itself
  1100. var plugin = module.plugin;
  1101. if(plugin.executed === executed && !plugin.load){
  1102. // executed the module not knowing it was a plugin
  1103. promoteModuleToPlugin(plugin);
  1104. }
  1105. var onLoad = function(def){
  1106. module.result = def;
  1107. setArrived(module);
  1108. finishExec(module);
  1109. checkComplete();
  1110. };
  1111. if(plugin.load){
  1112. plugin.load(module.prid, module.req, onLoad);
  1113. }else if(plugin.loadQ){
  1114. plugin.loadQ.push(module);
  1115. }else{
  1116. // the unshift instead of push is important: we don't want plugins to execute as
  1117. // dependencies of some other module because this may cause circles when the plugin
  1118. // loadQ is run; also, generally, we want plugins to run early since they may load
  1119. // several other modules and therefore can potentially unblock many modules
  1120. plugin.loadQ = [module];
  1121. execQ.unshift(plugin);
  1122. injectModule(plugin);
  1123. }
  1124. },
  1125. // for IE, injecting a module may result in a recursive execution if the module is in the cache
  1126. cached = 0,
  1127. injectingModule = 0,
  1128. injectingCachedModule = 0,
  1129. evalModuleText = function(text, module){
  1130. // see def() for the injectingCachedModule bracket; it simply causes a short, safe curcuit
  1131. injectingCachedModule = 1;
  1132. if(has("config-dojo-loader-catches")){
  1133. try{
  1134. if(text===cached){
  1135. cached.call(null);
  1136. }else{
  1137. req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid);
  1138. }
  1139. }catch(e){
  1140. signal(error, makeError("evalModuleThrew", module));
  1141. }
  1142. }else{
  1143. if(text===cached){
  1144. cached.call(null);
  1145. }else{
  1146. req.eval(text, has("dojo-loader-eval-hint-url") ? module.url : module.mid);
  1147. }
  1148. }
  1149. injectingCachedModule = 0;
  1150. },
  1151. injectModule = function(module){
  1152. // Inject the module. In the browser environment, this means appending a script element into
  1153. // the document; in other environments, it means loading a file.
  1154. //
  1155. // If in synchronous mode, then get the module synchronously if it's not xdomainLoading.
  1156. var mid = module.mid,
  1157. url = module.url;
  1158. if(module.executed || module.injected || waiting[mid] || (module.url && ((module.pack && waiting[module.url]===module.pack) || waiting[module.url]==1))){
  1159. return;
  1160. }
  1161. setRequested(module);
  1162. if(0){
  1163. var viaCombo = 0;
  1164. if(module.plugin && module.plugin.isCombo){
  1165. // a combo plugin; therefore, must be handled by combo service
  1166. // the prid should have already been converted to a URL (if required by the plugin) during
  1167. // the normalze process; in any event, there is no way for the loader to know how to
  1168. // to the conversion; therefore the third argument is zero
  1169. req.combo.add(module.plugin.mid, module.prid, 0, req);
  1170. viaCombo = 1;
  1171. }else if(!module.plugin){
  1172. viaCombo = req.combo.add(0, module.mid, module.url, req);
  1173. }
  1174. if(viaCombo){
  1175. comboPending= 1;
  1176. return;
  1177. }
  1178. }
  1179. if(module.plugin){
  1180. injectPlugin(module);
  1181. return;
  1182. } // else a normal module (not a plugin)
  1183. var onLoadCallback = function(){
  1184. runDefQ(module);
  1185. if(module.injected !== arrived){
  1186. // the script that contained the module arrived and has been executed yet
  1187. // nothing was added to the defQ (so it wasn't an AMD module) and the module
  1188. // wasn't marked as arrived by dojo.provide (so it wasn't a v1.6- module);
  1189. // therefore, it must not have been a module; adjust state accordingly
  1190. setArrived(module);
  1191. mix(module, nonModuleProps);
  1192. }
  1193. if(1 && legacyMode){
  1194. // must call checkComplete even in for sync loader because we may be in xdomainLoading mode;
  1195. // but, if xd loading, then don't call checkComplete until out of the current sync traversal
  1196. // in order to preserve order of execution of the dojo.required modules
  1197. !syncExecStack.length && checkComplete();
  1198. }else{
  1199. checkComplete();
  1200. }
  1201. };
  1202. cached = cache[mid] || cache[module.cacheId];
  1203. if(cached){
  1204. req.trace("loader-inject", ["cache", module.mid, url]);
  1205. evalModuleText(cached, module);
  1206. onLoadCallback();
  1207. return;
  1208. }
  1209. if(1 && legacyMode){
  1210. if(module.isXd){
  1211. // switch to async mode temporarily; if current legacyMode!=sync, then is must be one of {legacyAsync, xd, false}
  1212. legacyMode==sync && (legacyMode = xd);
  1213. // fall through and load via script injection
  1214. }else if(module.isAmd && legacyMode!=sync){
  1215. // fall through and load via script injection
  1216. }else{
  1217. // mode may be sync, xd/legacyAsync, or async; module may be AMD or legacy; but module is always located on the same domain
  1218. var xhrCallback = function(text){
  1219. if(legacyMode==sync){
  1220. // the top of syncExecStack gives the current synchronously executing module; the loader needs
  1221. // to know this if it has to switch to async loading in the middle of evaluating a legacy module
  1222. // this happens when a modules dojo.require's a module that must be loaded async because it's xdomain
  1223. // (using unshift/shift because there is no back() methods for Javascript arrays)
  1224. syncExecStack.unshift(module);
  1225. evalModuleText(text, module);
  1226. syncExecStack.shift();
  1227. // maybe the module was an AMD module
  1228. runDefQ(module);
  1229. // legacy modules never get to defineModule() => cjs and injected never set; also evaluation implies executing
  1230. if(!module.cjs){
  1231. setArrived(module);
  1232. finishExec(module);
  1233. }
  1234. if(module.finish){
  1235. // while synchronously evaluating this module, dojo.require was applied referencing a module
  1236. // that had to be loaded async; therefore, the loader stopped answering all dojo.require
  1237. // requests so they could be answered completely in the correct sequence; module.finish gives
  1238. // the list of dojo.requires that must be re-applied once all target modules are available;
  1239. // make a synthetic module to execute the dojo.require's in the correct order
  1240. // compute a guarnateed-unique mid for the synthetic finish module; remember the finish vector; remove it from the reference module
  1241. // TODO: can we just leave the module.finish...what's it hurting?
  1242. var finishMid = mid + "*finish",
  1243. finish = module.finish;
  1244. delete module.finish;
  1245. def(finishMid, ["dojo", ("dojo/require!" + finish.join(",")).replace(/\./g, "/")], function(dojo){
  1246. forEach(finish, function(mid){ dojo.require(mid); });
  1247. });
  1248. // unshift, not push, which causes the current traversal to be reattempted from the top
  1249. execQ.unshift(getModule(finishMid));
  1250. }
  1251. onLoadCallback();
  1252. }else{
  1253. text = transformToAmd(module, text);
  1254. if(text){
  1255. evalModuleText(text, module);
  1256. onLoadCallback();
  1257. }else{
  1258. // if transformToAmd returned falsy, then the module was already AMD and it can be script-injected
  1259. // do so to improve debugability(even though it means another download...which probably won't happen with a good browser cache)
  1260. injectingModule = module;
  1261. req.injectUrl(fixupUrl(url), onLoadCallback, module);
  1262. injectingModule = 0;
  1263. }
  1264. }
  1265. };
  1266. req.trace("loader-inject", ["xhr", module.mid, url, legacyMode!=sync]);
  1267. if(has("config-dojo-loader-catches")){
  1268. try{
  1269. req.getText(url, legacyMode!=sync, xhrCallback);
  1270. }catch(e){
  1271. signal(error, makeError("xhrInjectFailed", [module, e]));
  1272. }
  1273. }else{
  1274. req.getText(url, legacyMode!=sync, xhrCallback);
  1275. }
  1276. return;
  1277. }
  1278. } // else async mode or fell through in xdomain loading mode; either way, load by script injection
  1279. req.trace("loader-inject", ["script", module.mid, url]);
  1280. injectingModule = module;
  1281. req.injectUrl(fixupUrl(url), onLoadCallback, module);
  1282. injectingModule = 0;
  1283. },
  1284. defineModule = function(module, deps, def){
  1285. req.trace("loader-define-module", [module.mid, deps]);
  1286. if(0 && module.plugin && module.plugin.isCombo){
  1287. // the module is a plugin resource loaded by the combo service
  1288. // note: check for module.plugin should be enough since normal plugin resources should
  1289. // not follow this path; module.plugin.isCombo is future-proofing belt and suspenders
  1290. module.result = isFunction(def) ? def() : def;
  1291. setArrived(module);
  1292. finishExec(module);
  1293. return module;
  1294. };
  1295. var mid = module.mid;
  1296. if(module.injected === arrived){
  1297. signal(error, makeError("multipleDefine", module));
  1298. return module;
  1299. }
  1300. mix(module, {
  1301. deps: deps,
  1302. def: def,
  1303. cjs: {
  1304. id: module.mid,
  1305. uri: module.url,
  1306. exports: (module.result = {}),
  1307. setExports: function(exports){
  1308. module.cjs.exports = exports;
  1309. }
  1310. }
  1311. });
  1312. // resolve deps with respect to this module
  1313. for(var i = 0; i < deps.length; i++){
  1314. deps[i] = getModule(deps[i], module);
  1315. }
  1316. if(1 && legacyMode && !waiting[mid]){
  1317. // the module showed up without being asked for; it was probably in a <script> element
  1318. injectDependencies(module);
  1319. execQ.push(module);
  1320. checkComplete();
  1321. }
  1322. setArrived(module);
  1323. if(!isFunction(def) && !deps.length){
  1324. module.result = def;
  1325. finishExec(module);
  1326. }
  1327. return module;
  1328. },
  1329. runDefQ = function(referenceModule, mids){
  1330. // defQ is an array of [id, dependencies, factory]
  1331. // mids (if any) is a vector of mids given by a combo service
  1332. var definedModules = [],
  1333. module, args;
  1334. while(defQ.length){
  1335. args = defQ.shift();
  1336. mids && (args[0]= mids.shift());
  1337. // explicit define indicates possible multiple modules in a single file; delay injecting dependencies until defQ fully
  1338. // processed since modules earlier in the queue depend on already-arrived modules that are later in the queue
  1339. // TODO: what if no args[0] and no referenceModule
  1340. module = (args[0] && getModule(args[0])) || referenceModule;
  1341. definedModules.push([module, args[1], args[2]]);
  1342. }
  1343. consumePendingCacheInsert(referenceModule);
  1344. forEach(definedModules, function(args){
  1345. injectDependencies(defineModule.apply(null, args));
  1346. });
  1347. };
  1348. }
  1349. var timerId = 0,
  1350. clearTimer = noop,
  1351. startTimer = noop;
  1352. if(1){
  1353. // Timer machinery that monitors how long the loader is waiting and signals an error when the timer runs out.
  1354. clearTimer = function(){
  1355. timerId && clearTimeout(timerId);
  1356. timerId = 0;
  1357. },
  1358. startTimer = function(){
  1359. clearTimer();
  1360. req.waitms && (timerId = setTimeout(function(){
  1361. clearTimer();
  1362. signal(error, makeError("timeout", waiting));
  1363. }, req.waitms));
  1364. };
  1365. }
  1366. if(1){
  1367. has.add("ie-event-behavior", doc.attachEvent && (typeof opera === "undefined" || opera.toString() != "[object Opera]"));
  1368. }
  1369. if(1 && (1 || 1)){
  1370. var domOn = function(node, eventName, ieEventName, handler){
  1371. // Add an event listener to a DOM node using the API appropriate for the current browser;
  1372. // return a function that will disconnect the listener.
  1373. if(!has("ie-event-behavior")){
  1374. node.addEventListener(eventName, handler, false);
  1375. return function(){
  1376. node.removeEventListener(eventName, handler, false);
  1377. };
  1378. }else{
  1379. node.attachEvent(ieEventName, handler);
  1380. return function(){
  1381. node.detachEvent(ieEventName, handler);
  1382. };
  1383. }
  1384. },
  1385. windowOnLoadListener = domOn(window, "load", "onload", function(){
  1386. req.pageLoaded = 1;
  1387. doc.readyState!="complete" && (doc.readyState = "complete");
  1388. windowOnLoadListener();
  1389. });
  1390. if(1){
  1391. // if the loader is on the page, there must be at least one script element
  1392. // getting its parent and then doing insertBefore solves the "Operation Aborted"
  1393. // error in IE from appending to a node that isn't properly closed; see
  1394. // dojo/tests/_base/loader/requirejs/simple-badbase.html for an example
  1395. var sibling = doc.getElementsByTagName("script")[0],
  1396. insertPoint= sibling.parentNode;
  1397. req.injectUrl = function(url, callback, owner){
  1398. // insert a script element to the insert-point element with src=url;
  1399. // apply callback upon detecting the script has loaded.
  1400. startTimer();
  1401. var node = owner.node = doc.createElement("script"),
  1402. onLoad = function(e){
  1403. e = e || window.event;
  1404. var node = e.target || e.srcElement;
  1405. if(e.type === "load" || /complete|loaded/.test(node.readyState)){
  1406. disconnector();
  1407. callback && callback();
  1408. }
  1409. },
  1410. disconnector = domOn(node, "load", "onreadystatechange", onLoad);
  1411. node.type = "text/javascript";
  1412. node.charset = "utf-8";
  1413. node.src = url;
  1414. insertPoint.insertBefore(node, sibling);
  1415. return node;
  1416. };
  1417. }
  1418. }
  1419. if(1){
  1420. req.log = function(){
  1421. try{
  1422. for(var i = 0; i < arguments.length; i++){
  1423. console.log(arguments[i]);
  1424. }
  1425. }catch(e){}
  1426. };
  1427. }else{
  1428. req.log = noop;
  1429. }
  1430. if(0){
  1431. var trace = req.trace = function(
  1432. group, // the trace group to which this application belongs
  1433. args // the contents of the trace
  1434. ){
  1435. ///
  1436. // Tracing interface by group.
  1437. //
  1438. // Sends the contents of args to the console iff (req.trace.on && req.trace[group])
  1439. if(trace.on && trace.group[group]){
  1440. signal("trace", [group, args]);
  1441. for(var arg, dump = [], text= "trace:" + group + (args.length ? (":" + args[0]) : ""), i= 1; i<args.length;){
  1442. arg = args[i++];
  1443. if(isString(arg)){
  1444. text += ", " + arg;
  1445. }else{
  1446. dump.push(arg);
  1447. }
  1448. }
  1449. req.log(text);
  1450. dump.length && dump.push(".");
  1451. req.log.apply(req, dump);
  1452. }
  1453. };
  1454. mix(trace, {
  1455. on:1,
  1456. group:{},
  1457. set:function(group, value){
  1458. if(isString(group)){
  1459. trace.group[group]= value;
  1460. }else{
  1461. mix(trace.group, group);
  1462. }
  1463. }
  1464. });
  1465. trace.set(mix(mix(mix({}, defaultConfig.trace), userConfig.trace), dojoSniffConfig.trace));
  1466. on("config", function(config){
  1467. config.trace && trace.set(config.trace);
  1468. });
  1469. }else{
  1470. req.trace = noop;
  1471. }
  1472. var def = function(
  1473. mid, //(commonjs.moduleId, optional) list of modules to be loaded before running factory
  1474. dependencies, //(array of commonjs.moduleId, optional)
  1475. factory //(any)
  1476. ){
  1477. ///
  1478. // Advises the loader of a module factory. //Implements http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition.
  1479. ///
  1480. //note
  1481. // CommonJS factory scan courtesy of http://requirejs.org
  1482. var arity = arguments.length,
  1483. args = 0,
  1484. defaultDeps = ["require", "exports", "module"];
  1485. if(0){
  1486. if(arity == 1 && isFunction(mid)){
  1487. dependencies = [];
  1488. mid.toString()
  1489. .replace(/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg, "")
  1490. .replace(/require\(["']([\w\!\-_\.\/]+)["']\)/g, function (match, dep){
  1491. dependencies.push(dep);
  1492. });
  1493. args = [0, defaultDeps.concat(dependencies), mid];
  1494. }
  1495. }
  1496. if(!args){
  1497. args = arity == 1 ? [0, defaultDeps, mid] :
  1498. (arity == 2 ? (isArray(mid) ? [0, mid, dependencies] : (isFunction(dependencies) ? [mid, defaultDeps, dependencies] : [mid, [], dependencies])) :
  1499. [mid, dependencies, factory]);
  1500. }
  1501. req.trace("loader-define", args.slice(0, 2));
  1502. var targetModule = args[0] && getModule(args[0]),
  1503. module;
  1504. if(targetModule && !waiting[targetModule.mid]){
  1505. // given a mid that hasn't been requested; therefore, defined through means other than injecting
  1506. // consequent to a require() or define() application; examples include defining modules on-the-fly
  1507. // due to some code path or including a module in a script element. In any case,
  1508. // there is no callback waiting to finish processing and nothing to trigger the defQ and the
  1509. // dependencies are never requested; therefore, do it here.
  1510. injectDependencies(defineModule(targetModule, args[1], args[2]));
  1511. }else if(!has("ie-event-behavior") || !1 || injectingCachedModule){
  1512. // not IE path: anonymous module and therefore must have been injected; therefore, onLoad will fire immediately
  1513. // after script finishes being evaluated and the defQ can be run from that callback to detect the module id
  1514. defQ.push(args);
  1515. }else{
  1516. // IE path: possibly anonymous module and therefore injected; therefore, cannot depend on 1-to-1,
  1517. // in-order exec of onLoad with script eval (since it's IE) and must manually detect here
  1518. targetModule = targetModule || injectingModule;
  1519. if(!targetModule){
  1520. for(mid in waiting){
  1521. module = modules[mid];
  1522. if(module && module.node && module.node.readyState === 'interactive'){
  1523. targetModule = module;
  1524. break;
  1525. }
  1526. }
  1527. if(0 && !targetModule){
  1528. for(var i = 0; i<combosPending.length; i++){
  1529. targetModule = combosPending[i];
  1530. if(targetModule.node && targetModule.node.readyState === 'interactive'){
  1531. break;
  1532. }
  1533. targetModule= 0;
  1534. }
  1535. }
  1536. }
  1537. if(0 && isArray(targetModule)){
  1538. injectDependencies(defineModule(getModule(targetModule.shift()), args[1], args[2]));
  1539. if(!targetModule.length){
  1540. combosPending.splice(i, 1);
  1541. }
  1542. }else if(targetModule){
  1543. consumePendingCacheInsert(targetModule);
  1544. injectDependencies(defineModule(targetModule, args[1], args[2]));
  1545. }else{
  1546. signal(error, makeError("ieDefineFailed", args[0]));
  1547. }
  1548. checkComplete();
  1549. }
  1550. };
  1551. def.amd = {
  1552. vendor:"dojotoolkit.org"
  1553. };
  1554. if(0){
  1555. req.def = def;
  1556. }
  1557. // allow config to override default implemention of named functions; this is useful for
  1558. // non-browser environments, e.g., overriding injectUrl, getText, log, etc. in node.js, Rhino, etc.
  1559. // also useful for testing and monkey patching loader
  1560. mix(mix(req, defaultConfig.loaderPatch), userConfig.loaderPatch);
  1561. // now that req is fully initialized and won't change, we can hook it up to the error signal
  1562. on(error, function(arg){
  1563. try{
  1564. console.error(arg);
  1565. if(arg instanceof Error){
  1566. for(var p in arg){
  1567. console.log(p + ":", arg[p]);
  1568. }
  1569. console.log(".");
  1570. }
  1571. }catch(e){}
  1572. });
  1573. // always publish these
  1574. mix(req, {
  1575. uid:uid,
  1576. cache:cache,
  1577. packs:packs
  1578. });
  1579. if(0){
  1580. mix(req, {
  1581. // these may be interesting to look at when debugging
  1582. paths:paths,
  1583. aliases:aliases,
  1584. packageMap:packageMap,
  1585. modules:modules,
  1586. legacyMode:legacyMode,
  1587. execQ:execQ,
  1588. defQ:defQ,
  1589. waiting:waiting,
  1590. // these are used for testing
  1591. // TODO: move testing infrastructure to a different has feature
  1592. pathsMapProg:pathsMapProg,
  1593. packageMapProg:packageMapProg,
  1594. listenerQueues:listenerQueues,
  1595. // these are used by the builder (at least)
  1596. computeMapProg:computeMapProg,
  1597. runMapProg:runMapProg,
  1598. compactPath:compactPath,
  1599. getModuleInfo:getModuleInfo_
  1600. });
  1601. }
  1602. // the loader can be defined exactly once; look for global define which is the symbol AMD loaders are
  1603. // *required* to define (as opposed to require, which is optional)
  1604. if(global.define){
  1605. if(1){
  1606. signal(error, makeError("defineAlreadyDefined", 0));
  1607. }
  1608. }else{
  1609. global.define = def;
  1610. global.require = req;
  1611. }
  1612. if(0 && req.combo && req.combo.plugins){
  1613. var plugins = req.combo.plugins,
  1614. pluginName;
  1615. for(pluginName in plugins){
  1616. mix(mix(getModule(pluginName), plugins[pluginName]), {isCombo:1, executed:"executed", load:1});
  1617. }
  1618. }
  1619. if(1){
  1620. var bootDeps = dojoSniffConfig.deps || userConfig.deps || defaultConfig.deps,
  1621. bootCallback = dojoSniffConfig.callback || userConfig.callback || defaultConfig.callback;
  1622. req.boot = (bootDeps || bootCallback) ? [bootDeps || [], bootCallback] : 0;
  1623. }
  1624. if(!1){
  1625. !req.async && req(["dojo"]);
  1626. req.boot && req.apply(null, req.boot);
  1627. }
  1628. })
  1629. (this.dojoConfig || this.djConfig || this.require || {}, {
  1630. async:0,
  1631. hasCache:{
  1632. 'config-selectorEngine':"acme",
  1633. 'config-tlmSiblingOfDojo':1,
  1634. 'dojo-built':1,
  1635. 'dojo-loader':1,
  1636. dom:1,
  1637. 'host-browser':1
  1638. },
  1639. packages:[
  1640. {
  1641. location:"../dijit",
  1642. name:"dijit"
  1643. },
  1644. {
  1645. location:"../dojox",
  1646. name:"dojox"
  1647. },
  1648. {
  1649. location:".",
  1650. name:"dojo"
  1651. }
  1652. ]
  1653. });require({cache:{
  1654. 'dojo/_base/fx':function(){
  1655. define(["./kernel", "./lang", "../Evented", "./Color", "./connect", "./sniff", "../dom", "../dom-style"], function(dojo, lang, Evented, Color, connect, has, dom, style){
  1656. // module:
  1657. // dojo/_base/fx
  1658. // summary:
  1659. // This module defines the base dojo.fx implementation.
  1660. // notes:
  1661. // Animation loosely package based on Dan Pupius' work, contributed under CLA; see
  1662. // http://pupius.co.uk/js/Toolkit.Drawing.js
  1663. var _mixin = lang.mixin;
  1664. dojo._Line = function(/*int*/ start, /*int*/ end){
  1665. // summary:
  1666. // dojo._Line is the object used to generate values from a start value
  1667. // to an end value
  1668. // start: int
  1669. // Beginning value for range
  1670. // end: int
  1671. // Ending value for range
  1672. this.start = start;
  1673. this.end = end;
  1674. };
  1675. dojo._Line.prototype.getValue = function(/*float*/ n){
  1676. // summary: Returns the point on the line
  1677. // n: a floating point number greater than 0 and less than 1
  1678. return ((this.end - this.start) * n) + this.start; // Decimal
  1679. };
  1680. dojo.Animation = function(args){
  1681. // summary:
  1682. // A generic animation class that fires callbacks into its handlers
  1683. // object at various states.
  1684. // description:
  1685. // A generic animation class that fires callbacks into its handlers
  1686. // object at various states. Nearly all dojo animation functions
  1687. // return an instance of this method, usually without calling the
  1688. // .play() method beforehand. Therefore, you will likely need to
  1689. // call .play() on instances of `dojo.Animation` when one is
  1690. // returned.
  1691. // args: Object
  1692. // The 'magic argument', mixing all the properties into this
  1693. // animation instance.
  1694. _mixin(this, args);
  1695. if(lang.isArray(this.curve)){
  1696. this.curve = new dojo._Line(this.curve[0], this.curve[1]);
  1697. }
  1698. };
  1699. dojo.Animation.prototype = new Evented();
  1700. // Alias to drop come 2.0:
  1701. dojo._Animation = dojo.Animation;
  1702. lang.extend(dojo.Animation, {
  1703. // duration: Integer
  1704. // The time in milliseonds the animation will take to run
  1705. duration: 350,
  1706. /*=====
  1707. // curve: dojo._Line|Array
  1708. // A two element array of start and end values, or a `dojo._Line` instance to be
  1709. // used in the Animation.
  1710. curve: null,
  1711. // easing: Function?
  1712. // A Function to adjust the acceleration (or deceleration) of the progress
  1713. // across a dojo._Line
  1714. easing: null,
  1715. =====*/
  1716. // repeat: Integer?
  1717. // The number of times to loop the animation
  1718. repeat: 0,
  1719. // rate: Integer?
  1720. // the time in milliseconds to wait before advancing to next frame
  1721. // (used as a fps timer: 1000/rate = fps)
  1722. rate: 20 /* 50 fps */,
  1723. /*=====
  1724. // delay: Integer?
  1725. // The time in milliseconds to wait before starting animation after it
  1726. // has been .play()'ed
  1727. delay: null,
  1728. // beforeBegin: Event?
  1729. // Synthetic event fired before a dojo.Animation begins playing (synchronous)
  1730. beforeBegin: null,
  1731. // onBegin: Event?
  1732. // Synthetic event fired as a dojo.Animation begins playing (useful?)
  1733. onBegin: null,
  1734. // onAnimate: Event?
  1735. // Synthetic event fired at each interval of a `dojo.Animation`
  1736. onAnimate: null,
  1737. // onEnd: Event?
  1738. // Synthetic event fired after the final frame of a `dojo.Animation`
  1739. onEnd: null,
  1740. // onPlay: Event?
  1741. // Synthetic event fired any time a `dojo.Animation` is play()'ed
  1742. onPlay: null,
  1743. // onPause: Event?
  1744. // Synthetic event fired when a `dojo.Animation` is paused
  1745. onPause: null,
  1746. // onStop: Event
  1747. // Synthetic event fires when a `dojo.Animation` is stopped
  1748. onStop: null,
  1749. =====*/
  1750. _percent: 0,
  1751. _startRepeatCount: 0,
  1752. _getStep: function(){
  1753. var _p = this._percent,
  1754. _e = this.easing
  1755. ;
  1756. return _e ? _e(_p) : _p;
  1757. },
  1758. _fire: function(/*Event*/ evt, /*Array?*/ args){
  1759. // summary:
  1760. // Convenience function. Fire event "evt" and pass it the
  1761. // arguments specified in "args".
  1762. // description:
  1763. // Convenience function. Fire event "evt" and pass it the
  1764. // arguments specified in "args".
  1765. // Fires the callback in the scope of the `dojo.Animation`
  1766. // instance.
  1767. // evt:
  1768. // The event to fire.
  1769. // args:
  1770. // The arguments to pass to the event.
  1771. var a = args||[];
  1772. if(this[evt]){
  1773. if(dojo.config.debugAtAllCosts){
  1774. this[evt].apply(this, a);
  1775. }else{
  1776. try{
  1777. this[evt].apply(this, a);
  1778. }catch(e){
  1779. // squelch and log because we shouldn't allow exceptions in
  1780. // synthetic event handlers to cause the internal timer to run
  1781. // amuck, potentially pegging the CPU. I'm not a fan of this
  1782. // squelch, but hopefully logging will make it clear what's
  1783. // going on
  1784. console.error("exception in animation handler for:", evt);
  1785. console.error(e);
  1786. }
  1787. }
  1788. }
  1789. return this; // dojo.Animation
  1790. },
  1791. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  1792. // summary:
  1793. // Start the animation.
  1794. // delay:
  1795. // How many milliseconds to delay before starting.
  1796. // gotoStart:
  1797. // If true, starts the animation from the beginning; otherwise,
  1798. // starts it from its current position.
  1799. // returns: dojo.Animation
  1800. // The instance to allow chaining.
  1801. var _t = this;
  1802. if(_t._delayTimer){ _t._clearTimer(); }
  1803. if(gotoStart){
  1804. _t._stopTimer();
  1805. _t._active = _t._paused = false;
  1806. _t._percent = 0;
  1807. }else if(_t._active && !_t._paused){
  1808. return _t;
  1809. }
  1810. _t._fire("beforeBegin", [_t.node]);
  1811. var de = delay || _t.delay,
  1812. _p = lang.hitch(_t, "_play", gotoStart);
  1813. if(de > 0){
  1814. _t._delayTimer = setTimeout(_p, de);
  1815. return _t;
  1816. }
  1817. _p();
  1818. return _t; // dojo.Animation
  1819. },
  1820. _play: function(gotoStart){
  1821. var _t = this;
  1822. if(_t._delayTimer){ _t._clearTimer(); }
  1823. _t._startTime = new Date().valueOf();
  1824. if(_t._paused){
  1825. _t._startTime -= _t.duration * _t._percent;
  1826. }
  1827. _t._active = true;
  1828. _t._paused = false;
  1829. var value = _t.curve.getValue(_t._getStep());
  1830. if(!_t._percent){
  1831. if(!_t._startRepeatCount){
  1832. _t._startRepeatCount = _t.repeat;
  1833. }
  1834. _t._fire("onBegin", [value]);
  1835. }
  1836. _t._fire("onPlay", [value]);
  1837. _t._cycle();
  1838. return _t; // dojo.Animation
  1839. },
  1840. pause: function(){
  1841. // summary: Pauses a running animation.
  1842. var _t = this;
  1843. if(_t._delayTimer){ _t._clearTimer(); }
  1844. _t._stopTimer();
  1845. if(!_t._active){ return _t; /*dojo.Animation*/ }
  1846. _t._paused = true;
  1847. _t._fire("onPause", [_t.curve.getValue(_t._getStep())]);
  1848. return _t; // dojo.Animation
  1849. },
  1850. gotoPercent: function(/*Decimal*/ percent, /*Boolean?*/ andPlay){
  1851. // summary:
  1852. // Sets the progress of the animation.
  1853. // percent:
  1854. // A percentage in decimal notation (between and including 0.0 and 1.0).
  1855. // andPlay:
  1856. // If true, play the animation after setting the progress.
  1857. var _t = this;
  1858. _t._stopTimer();
  1859. _t._active = _t._paused = true;
  1860. _t._percent = percent;
  1861. if(andPlay){ _t.play(); }
  1862. return _t; // dojo.Animation
  1863. },
  1864. stop: function(/*boolean?*/ gotoEnd){
  1865. // summary: Stops a running animation.
  1866. // gotoEnd: If true, the animation will end.
  1867. var _t = this;
  1868. if(_t._delayTimer){ _t._clearTimer(); }
  1869. if(!_t._timer){ return _t; /* dojo.Animation */ }
  1870. _t._stopTimer();
  1871. if(gotoEnd){
  1872. _t._percent = 1;
  1873. }
  1874. _t._fire("onStop", [_t.curve.getValue(_t._getStep())]);
  1875. _t._active = _t._paused = false;
  1876. return _t; // dojo.Animation
  1877. },
  1878. status: function(){
  1879. // summary:
  1880. // Returns a string token representation of the status of
  1881. // the animation, one of: "paused", "playing", "stopped"
  1882. if(this._active){
  1883. return this._paused ? "paused" : "playing"; // String
  1884. }
  1885. return "stopped"; // String
  1886. },
  1887. _cycle: function(){
  1888. var _t = this;
  1889. if(_t._active){
  1890. var curr = new Date().valueOf();
  1891. var step = (curr - _t._startTime) / (_t.duration);
  1892. if(step >= 1){
  1893. step = 1;
  1894. }
  1895. _t._percent = step;
  1896. // Perform easing
  1897. if(_t.easing){
  1898. step = _t.easing(step);
  1899. }
  1900. _t._fire("onAnimate", [_t.curve.getValue(step)]);
  1901. if(_t._percent < 1){
  1902. _t._startTimer();
  1903. }else{
  1904. _t._active = false;
  1905. if(_t.repeat > 0){
  1906. _t.repeat--;
  1907. _t.play(null, true);
  1908. }else if(_t.repeat == -1){
  1909. _t.play(null, true);
  1910. }else{
  1911. if(_t._startRepeatCount){
  1912. _t.repeat = _t._startRepeatCount;
  1913. _t._startRepeatCount = 0;
  1914. }
  1915. }
  1916. _t._percent = 0;
  1917. _t._fire("onEnd", [_t.node]);
  1918. !_t.repeat && _t._stopTimer();
  1919. }
  1920. }
  1921. return _t; // dojo.Animation
  1922. },
  1923. _clearTimer: function(){
  1924. // summary: Clear the play delay timer
  1925. clearTimeout(this._delayTimer);
  1926. delete this._delayTimer;
  1927. }
  1928. });
  1929. // the local timer, stubbed into all Animation instances
  1930. var ctr = 0,
  1931. timer = null,
  1932. runner = {
  1933. run: function(){}
  1934. };
  1935. lang.extend(dojo.Animation, {
  1936. _startTimer: function(){
  1937. if(!this._timer){
  1938. this._timer = connect.connect(runner, "run", this, "_cycle");
  1939. ctr++;
  1940. }
  1941. if(!timer){
  1942. timer = setInterval(lang.hitch(runner, "run"), this.rate);
  1943. }
  1944. },
  1945. _stopTimer: function(){
  1946. if(this._timer){
  1947. connect.disconnect(this._timer);
  1948. this._timer = null;
  1949. ctr--;
  1950. }
  1951. if(ctr <= 0){
  1952. clearInterval(timer);
  1953. timer = null;
  1954. ctr = 0;
  1955. }
  1956. }
  1957. });
  1958. var _makeFadeable =
  1959. has("ie") ? function(node){
  1960. // only set the zoom if the "tickle" value would be the same as the
  1961. // default
  1962. var ns = node.style;
  1963. // don't set the width to auto if it didn't already cascade that way.
  1964. // We don't want to f anyones designs
  1965. if(!ns.width.length && style.get(node, "width") == "auto"){
  1966. ns.width = "auto";
  1967. }
  1968. } :
  1969. function(){};
  1970. dojo._fade = function(/*Object*/ args){
  1971. // summary:
  1972. // Returns an animation that will fade the node defined by
  1973. // args.node from the start to end values passed (args.start
  1974. // args.end) (end is mandatory, start is optional)
  1975. args.node = dom.byId(args.node);
  1976. var fArgs = _mixin({ properties: {} }, args),
  1977. props = (fArgs.properties.opacity = {});
  1978. props.start = !("start" in fArgs) ?
  1979. function(){
  1980. return +style.get(fArgs.node, "opacity")||0;
  1981. } : fArgs.start;
  1982. props.end = fArgs.end;
  1983. var anim = dojo.animateProperty(fArgs);
  1984. connect.connect(anim, "beforeBegin", lang.partial(_makeFadeable, fArgs.node));
  1985. return anim; // dojo.Animation
  1986. };
  1987. /*=====
  1988. dojo.__FadeArgs = function(node, duration, easing){
  1989. // node: DOMNode|String
  1990. // The node referenced in the animation
  1991. // duration: Integer?
  1992. // Duration of the animation in milliseconds.
  1993. // easing: Function?
  1994. // An easing function.
  1995. this.node = node;
  1996. this.duration = duration;
  1997. this.easing = easing;
  1998. }
  1999. =====*/
  2000. dojo.fadeIn = function(/*dojo.__FadeArgs*/ args){
  2001. // summary:
  2002. // Returns an animation that will fade node defined in 'args' from
  2003. // its current opacity to fully opaque.
  2004. return dojo._fade(_mixin({ end: 1 }, args)); // dojo.Animation
  2005. };
  2006. dojo.fadeOut = function(/*dojo.__FadeArgs*/ args){
  2007. // summary:
  2008. // Returns an animation that will fade node defined in 'args'
  2009. // from its current opacity to fully transparent.
  2010. return dojo._fade(_mixin({ end: 0 }, args)); // dojo.Animation
  2011. };
  2012. dojo._defaultEasing = function(/*Decimal?*/ n){
  2013. // summary: The default easing function for dojo.Animation(s)
  2014. return 0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2); // Decimal
  2015. };
  2016. var PropLine = function(properties){
  2017. // PropLine is an internal class which is used to model the values of
  2018. // an a group of CSS properties across an animation lifecycle. In
  2019. // particular, the "getValue" function handles getting interpolated
  2020. // values between start and end for a particular CSS value.
  2021. this._properties = properties;
  2022. for(var p in properties){
  2023. var prop = properties[p];
  2024. if(prop.start instanceof Color){
  2025. // create a reusable temp color object to keep intermediate results
  2026. prop.tempColor = new Color();
  2027. }
  2028. }
  2029. };
  2030. PropLine.prototype.getValue = function(r){
  2031. var ret = {};
  2032. for(var p in this._properties){
  2033. var prop = this._properties[p],
  2034. start = prop.start;
  2035. if(start instanceof Color){
  2036. ret[p] = Color.blendColors(start, prop.end, r, prop.tempColor).toCss();
  2037. }else if(!lang.isArray(start)){
  2038. ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units || "px" : 0);
  2039. }
  2040. }
  2041. return ret;
  2042. };
  2043. /*=====
  2044. dojo.declare("dojo.__AnimArgs", [dojo.__FadeArgs], {
  2045. // Properties: Object?
  2046. // A hash map of style properties to Objects describing the transition,
  2047. // such as the properties of dojo._Line with an additional 'units' property
  2048. properties: {}
  2049. //TODOC: add event callbacks
  2050. });
  2051. =====*/
  2052. dojo.animateProperty = function(/*dojo.__AnimArgs*/ args){
  2053. // summary:
  2054. // Returns an animation that will transition the properties of
  2055. // node defined in `args` depending how they are defined in
  2056. // `args.properties`
  2057. //
  2058. // description:
  2059. // `dojo.animateProperty` is the foundation of most `dojo.fx`
  2060. // animations. It takes an object of "properties" corresponding to
  2061. // style properties, and animates them in parallel over a set
  2062. // duration.
  2063. //
  2064. // example:
  2065. // A simple animation that changes the width of the specified node.
  2066. // | dojo.animateProperty({
  2067. // | node: "nodeId",
  2068. // | properties: { width: 400 },
  2069. // | }).play();
  2070. // Dojo figures out the start value for the width and converts the
  2071. // integer specified for the width to the more expressive but
  2072. // verbose form `{ width: { end: '400', units: 'px' } }` which you
  2073. // can also specify directly. Defaults to 'px' if ommitted.
  2074. //
  2075. // example:
  2076. // Animate width, height, and padding over 2 seconds... the
  2077. // pedantic way:
  2078. // | dojo.animateProperty({ node: node, duration:2000,
  2079. // | properties: {
  2080. // | width: { start: '200', end: '400', units:"px" },
  2081. // | height: { start:'200', end: '400', units:"px" },
  2082. // | paddingTop: { start:'5', end:'50', units:"px" }
  2083. // | }
  2084. // | }).play();
  2085. // Note 'paddingTop' is used over 'padding-top'. Multi-name CSS properties
  2086. // are written using "mixed case", as the hyphen is illegal as an object key.
  2087. //
  2088. // example:
  2089. // Plug in a different easing function and register a callback for
  2090. // when the animation ends. Easing functions accept values between
  2091. // zero and one and return a value on that basis. In this case, an
  2092. // exponential-in curve.
  2093. // | dojo.animateProperty({
  2094. // | node: "nodeId",
  2095. // | // dojo figures out the start value
  2096. // | properties: { width: { end: 400 } },
  2097. // | easing: function(n){
  2098. // | return (n==0) ? 0 : Math.pow(2, 10 * (n - 1));
  2099. // | },
  2100. // | onEnd: function(node){
  2101. // | // called when the animation finishes. The animation
  2102. // | // target is passed to this function
  2103. // | }
  2104. // | }).play(500); // delay playing half a second
  2105. //
  2106. // example:
  2107. // Like all `dojo.Animation`s, animateProperty returns a handle to the
  2108. // Animation instance, which fires the events common to Dojo FX. Use `dojo.connect`
  2109. // to access these events outside of the Animation definiton:
  2110. // | var anim = dojo.animateProperty({
  2111. // | node:"someId",
  2112. // | properties:{
  2113. // | width:400, height:500
  2114. // | }
  2115. // | });
  2116. // | dojo.connect(anim,"onEnd", function(){
  2117. // | console.log("animation ended");
  2118. // | });
  2119. // | // play the animation now:
  2120. // | anim.play();
  2121. //
  2122. // example:
  2123. // Each property can be a function whose return value is substituted along.
  2124. // Additionally, each measurement (eg: start, end) can be a function. The node
  2125. // reference is passed direcly to callbacks.
  2126. // | dojo.animateProperty({
  2127. // | node:"mine",
  2128. // | properties:{
  2129. // | height:function(node){
  2130. // | // shrink this node by 50%
  2131. // | return dojo.position(node).h / 2
  2132. // | },
  2133. // | width:{
  2134. // | start:function(node){ return 100; },
  2135. // | end:function(node){ return 200; }
  2136. // | }
  2137. // | }
  2138. // | }).play();
  2139. //
  2140. var n = args.node = dom.byId(args.node);
  2141. if(!args.easing){ args.easing = dojo._defaultEasing; }
  2142. var anim = new dojo.Animation(args);
  2143. connect.connect(anim, "beforeBegin", anim, function(){
  2144. var pm = {};
  2145. for(var p in this.properties){
  2146. // Make shallow copy of properties into pm because we overwrite
  2147. // some values below. In particular if start/end are functions
  2148. // we don't want to overwrite them or the functions won't be
  2149. // called if the animation is reused.
  2150. if(p == "width" || p == "height"){
  2151. this.node.display = "block";
  2152. }
  2153. var prop = this.properties[p];
  2154. if(lang.isFunction(prop)){
  2155. prop = prop(n);
  2156. }
  2157. prop = pm[p] = _mixin({}, (lang.isObject(prop) ? prop: { end: prop }));
  2158. if(lang.isFunction(prop.start)){
  2159. prop.start = prop.start(n);
  2160. }
  2161. if(lang.isFunction(prop.end)){
  2162. prop.end = prop.end(n);
  2163. }
  2164. var isColor = (p.toLowerCase().indexOf("color") >= 0);
  2165. function getStyle(node, p){
  2166. // dojo.style(node, "height") can return "auto" or "" on IE; this is more reliable:
  2167. var v = { height: node.offsetHeight, width: node.offsetWidth }[p];
  2168. if(v !== undefined){ return v; }
  2169. v = style.get(node, p);
  2170. return (p == "opacity") ? +v : (isColor ? v : parseFloat(v));
  2171. }
  2172. if(!("end" in prop)){
  2173. prop.end = getStyle(n, p);
  2174. }else if(!("start" in prop)){
  2175. prop.start = getStyle(n, p);
  2176. }
  2177. if(isColor){
  2178. prop.start = new Color(prop.start);
  2179. prop.end = new Color(prop.end);
  2180. }else{
  2181. prop.start = (p == "opacity") ? +prop.start : parseFloat(prop.start);
  2182. }
  2183. }
  2184. this.curve = new PropLine(pm);
  2185. });
  2186. connect.connect(anim, "onAnimate", lang.hitch(style, "set", anim.node));
  2187. return anim; // dojo.Animation
  2188. };
  2189. dojo.anim = function( /*DOMNode|String*/ node,
  2190. /*Object*/ properties,
  2191. /*Integer?*/ duration,
  2192. /*Function?*/ easing,
  2193. /*Function?*/ onEnd,
  2194. /*Integer?*/ delay){
  2195. // summary:
  2196. // A simpler interface to `dojo.animateProperty()`, also returns
  2197. // an instance of `dojo.Animation` but begins the animation
  2198. // immediately, unlike nearly every other Dojo animation API.
  2199. // description:
  2200. // `dojo.anim` is a simpler (but somewhat less powerful) version
  2201. // of `dojo.animateProperty`. It uses defaults for many basic properties
  2202. // and allows for positional parameters to be used in place of the
  2203. // packed "property bag" which is used for other Dojo animation
  2204. // methods.
  2205. //
  2206. // The `dojo.Animation` object returned from `dojo.anim` will be
  2207. // already playing when it is returned from this function, so
  2208. // calling play() on it again is (usually) a no-op.
  2209. // node:
  2210. // a DOM node or the id of a node to animate CSS properties on
  2211. // duration:
  2212. // The number of milliseconds over which the animation
  2213. // should run. Defaults to the global animation default duration
  2214. // (350ms).
  2215. // easing:
  2216. // An easing function over which to calculate acceleration
  2217. // and deceleration of the animation through its duration.
  2218. // A default easing algorithm is provided, but you may
  2219. // plug in any you wish. A large selection of easing algorithms
  2220. // are available in `dojo.fx.easing`.
  2221. // onEnd:
  2222. // A function to be called when the animation finishes
  2223. // running.
  2224. // delay:
  2225. // The number of milliseconds to delay beginning the
  2226. // animation by. The default is 0.
  2227. // example:
  2228. // Fade out a node
  2229. // | dojo.anim("id", { opacity: 0 });
  2230. // example:
  2231. // Fade out a node over a full second
  2232. // | dojo.anim("id", { opacity: 0 }, 1000);
  2233. return dojo.animateProperty({ // dojo.Animation
  2234. node: node,
  2235. duration: duration || dojo.Animation.prototype.duration,
  2236. properties: properties,
  2237. easing: easing,
  2238. onEnd: onEnd
  2239. }).play(delay || 0);
  2240. };
  2241. return {
  2242. _Line: dojo._Line,
  2243. Animation: dojo.Animation,
  2244. _fade: dojo._fade,
  2245. fadeIn: dojo.fadeIn,
  2246. fadeOut: dojo.fadeOut,
  2247. _defaultEasing: dojo._defaultEasing,
  2248. animateProperty: dojo.animateProperty,
  2249. anim: dojo.anim
  2250. };
  2251. });
  2252. },
  2253. 'dojo/dom-form':function(){
  2254. define(["./_base/lang", "./dom", "./io-query", "./json"], function(lang, dom, ioq, json){
  2255. // module:
  2256. // dojo/dom-form
  2257. // summary:
  2258. // This module defines form-processing functions.
  2259. /*=====
  2260. dojo.fieldToObject = function(inputNode){
  2261. // summary:
  2262. // Serialize a form field to a JavaScript object.
  2263. // description:
  2264. // Returns the value encoded in a form field as
  2265. // as a string or an array of strings. Disabled form elements
  2266. // and unchecked radio and checkboxes are skipped. Multi-select
  2267. // elements are returned as an array of string values.
  2268. // inputNode: DOMNode|String
  2269. // returns: Object
  2270. };
  2271. =====*/
  2272. /*=====
  2273. dojo.formToObject = function(formNode){
  2274. // summary:
  2275. // Serialize a form node to a JavaScript object.
  2276. // description:
  2277. // Returns the values encoded in an HTML form as
  2278. // string properties in an object which it then returns. Disabled form
  2279. // elements, buttons, and other non-value form elements are skipped.
  2280. // Multi-select elements are returned as an array of string values.
  2281. // formNode: DOMNode|String
  2282. // returns: Object
  2283. //
  2284. // example:
  2285. // This form:
  2286. // | <form id="test_form">
  2287. // | <input type="text" name="blah" value="blah">
  2288. // | <input type="text" name="no_value" value="blah" disabled>
  2289. // | <input type="button" name="no_value2" value="blah">
  2290. // | <select type="select" multiple name="multi" size="5">
  2291. // | <option value="blah">blah</option>
  2292. // | <option value="thud" selected>thud</option>
  2293. // | <option value="thonk" selected>thonk</option>
  2294. // | </select>
  2295. // | </form>
  2296. //
  2297. // yields this object structure as the result of a call to
  2298. // formToObject():
  2299. //
  2300. // | {
  2301. // | blah: "blah",
  2302. // | multi: [
  2303. // | "thud",
  2304. // | "thonk"
  2305. // | ]
  2306. // | };
  2307. };
  2308. =====*/
  2309. /*=====
  2310. dojo.formToQuery = function(formNode){
  2311. // summary:
  2312. // Returns a URL-encoded string representing the form passed as either a
  2313. // node or string ID identifying the form to serialize
  2314. // formNode: DOMNode|String
  2315. // returns: String
  2316. };
  2317. =====*/
  2318. /*=====
  2319. dojo.formToJson = function(formNode, prettyPrint){
  2320. // summary:
  2321. // Create a serialized JSON string from a form node or string
  2322. // ID identifying the form to serialize
  2323. // formNode: DOMNode|String
  2324. // prettyPrint: Boolean?
  2325. // returns: String
  2326. };
  2327. =====*/
  2328. function setValue(/*Object*/obj, /*String*/name, /*String*/value){
  2329. // summary:
  2330. // For the named property in object, set the value. If a value
  2331. // already exists and it is a string, convert the value to be an
  2332. // array of values.
  2333. // Skip it if there is no value
  2334. if(value === null){
  2335. return;
  2336. }
  2337. var val = obj[name];
  2338. if(typeof val == "string"){ // inline'd type check
  2339. obj[name] = [val, value];
  2340. }else if(lang.isArray(val)){
  2341. val.push(value);
  2342. }else{
  2343. obj[name] = value;
  2344. }
  2345. }
  2346. var exclude = "file|submit|image|reset|button";
  2347. var form = {
  2348. fieldToObject: function fieldToObject(/*DOMNode|String*/ inputNode){
  2349. var ret = null;
  2350. inputNode = dom.byId(inputNode);
  2351. if(inputNode){
  2352. var _in = inputNode.name, type = (inputNode.type || "").toLowerCase();
  2353. if(_in && type && !inputNode.disabled){
  2354. if(type == "radio" || type == "checkbox"){
  2355. if(inputNode.checked){
  2356. ret = inputNode.value;
  2357. }
  2358. }else if(inputNode.multiple){
  2359. ret = [];
  2360. var nodes = [inputNode.firstChild];
  2361. while(nodes.length){
  2362. for(var node = nodes.pop(); node; node = node.nextSibling){
  2363. if(node.nodeType == 1 && node.tagName.toLowerCase() == "option"){
  2364. if(node.selected){
  2365. ret.push(node.value);
  2366. }
  2367. }else{
  2368. if(node.nextSibling){
  2369. nodes.push(node.nextSibling);
  2370. }
  2371. if(node.firstChild){
  2372. nodes.push(node.firstChild);
  2373. }
  2374. break;
  2375. }
  2376. }
  2377. }
  2378. }else{
  2379. ret = inputNode.value;
  2380. }
  2381. }
  2382. }
  2383. return ret; // Object
  2384. },
  2385. toObject: function formToObject(/*DOMNode|String*/ formNode){
  2386. var ret = {}, elems = dom.byId(formNode).elements;
  2387. for(var i = 0, l = elems.length; i < l; ++i){
  2388. var item = elems[i], _in = item.name, type = (item.type || "").toLowerCase();
  2389. if(_in && type && exclude.indexOf(type) < 0 && !item.disabled){
  2390. setValue(ret, _in, form.fieldToObject(item));
  2391. if(type == "image"){
  2392. ret[_in + ".x"] = ret[_in + ".y"] = ret[_in].x = ret[_in].y = 0;
  2393. }
  2394. }
  2395. }
  2396. return ret; // Object
  2397. },
  2398. toQuery: function formToQuery(/*DOMNode|String*/ formNode){
  2399. return ioq.objectToQuery(form.toObject(formNode)); // String
  2400. },
  2401. toJson: function formToJson(/*DOMNode|String*/ formNode, /*Boolean?*/prettyPrint){
  2402. return json.stringify(form.toObject(formNode), null, prettyPrint ? 4 : 0); // String
  2403. }
  2404. };
  2405. return form;
  2406. });
  2407. },
  2408. 'dojo/i18n':function(){
  2409. define(["./_base/kernel", "require", "./has", "./_base/array", "./_base/config", "./_base/lang", "./_base/xhr", "./json"],
  2410. function(dojo, require, has, array, config, lang, xhr, json) {
  2411. // module:
  2412. // dojo/i18n
  2413. // summary:
  2414. // This module implements the !dojo/i18n plugin and the v1.6- i18n API
  2415. // description:
  2416. // We choose to include our own plugin to leverage functionality already contained in dojo
  2417. // and thereby reduce the size of the plugin compared to various loader implementations. Also, this
  2418. // allows foreign AMD loaders to be used without their plugins.
  2419. has.add("dojo-preload-i18n-Api",
  2420. // if true, define the preload localizations machinery
  2421. 1
  2422. );
  2423. true || has.add("dojo-v1x-i18n-Api",
  2424. // if true, define the v1.x i18n functions
  2425. 1
  2426. );
  2427. var
  2428. thisModule= dojo.i18n=
  2429. // the dojo.i18n module
  2430. {},
  2431. nlsRe=
  2432. // regexp for reconstructing the master bundle name from parts of the regexp match
  2433. // nlsRe.exec("foo/bar/baz/nls/en-ca/foo") gives:
  2434. // ["foo/bar/baz/nls/en-ca/foo", "foo/bar/baz/nls/", "/", "/", "en-ca", "foo"]
  2435. // nlsRe.exec("foo/bar/baz/nls/foo") gives:
  2436. // ["foo/bar/baz/nls/foo", "foo/bar/baz/nls/", "/", "/", "foo", ""]
  2437. // so, if match[5] is blank, it means this is the top bundle definition.
  2438. // courtesy of http://requirejs.org
  2439. /(^.*(^|\/)nls)(\/|$)([^\/]*)\/?([^\/]*)/,
  2440. getAvailableLocales= function(
  2441. root,
  2442. locale,
  2443. bundlePath,
  2444. bundleName
  2445. ){
  2446. // return a vector of module ids containing all available locales with respect to the target locale
  2447. // For example, assuming:
  2448. // * the root bundle indicates specific bundles for "fr" and "fr-ca",
  2449. // * bundlePath is "myPackage/nls"
  2450. // * bundleName is "myBundle"
  2451. // Then a locale argument of "fr-ca" would return
  2452. // ["myPackage/nls/myBundle", "myPackage/nls/fr/myBundle", "myPackage/nls/fr-ca/myBundle"]
  2453. // Notice that bundles are returned least-specific to most-specific, starting with the root.
  2454. //
  2455. // If root===false indicates we're working with a pre-AMD i18n bundle that doesn't tell about the available locales;
  2456. // therefore, assume everything is available and get 404 errors that indicate a particular localization is not available
  2457. //
  2458. for(var result= [bundlePath + bundleName], localeParts= locale.split("-"), current= "", i= 0; i<localeParts.length; i++){
  2459. current+= (current ? "-" : "") + localeParts[i];
  2460. if(!root || root[current]){
  2461. result.push(bundlePath + current + "/" + bundleName);
  2462. }
  2463. }
  2464. return result;
  2465. },
  2466. cache= {},
  2467. getL10nName= dojo.getL10nName = function(moduleName, bundleName, locale){
  2468. locale = locale ? locale.toLowerCase() : dojo.locale;
  2469. moduleName = "dojo/i18n!" + moduleName.replace(/\./g, "/");
  2470. bundleName = bundleName.replace(/\./g, "/");
  2471. return (/root/i.test(locale)) ?
  2472. (moduleName + "/nls/" + bundleName) :
  2473. (moduleName + "/nls/" + locale + "/" + bundleName);
  2474. },
  2475. doLoad = function(require, bundlePathAndName, bundlePath, bundleName, locale, load){
  2476. // get the root bundle which instructs which other bundles are required to construct the localized bundle
  2477. require([bundlePathAndName], function(root){
  2478. var current = lang.clone(root.root || root.ROOT),// 1.6 built bundle defined ROOT
  2479. availableLocales= getAvailableLocales(!root._v1x && root, locale, bundlePath, bundleName);
  2480. require(availableLocales, function(){
  2481. for (var i= 1; i<availableLocales.length; i++){
  2482. current= lang.mixin(lang.clone(current), arguments[i]);
  2483. }
  2484. // target may not have been resolve (e.g., maybe only "fr" exists when "fr-ca" was requested)
  2485. var target= bundlePathAndName + "/" + locale;
  2486. cache[target]= current;
  2487. load();
  2488. });
  2489. });
  2490. },
  2491. normalize = function(id, toAbsMid){
  2492. // id may be relative
  2493. // preload has form *preload*<path>/nls/<module>*<flattened locales> and
  2494. // therefore never looks like a relative
  2495. return /^\./.test(id) ? toAbsMid(id) : id;
  2496. },
  2497. getLocalesToLoad = function(targetLocale){
  2498. var list = config.extraLocale || [];
  2499. list = lang.isArray(list) ? list : [list];
  2500. list.push(targetLocale);
  2501. return list;
  2502. },
  2503. load = function(id, require, load){
  2504. //
  2505. // id is in one of the following formats
  2506. //
  2507. // 1. <path>/nls/<bundle>
  2508. // => load the bundle, localized to config.locale; load all bundles localized to
  2509. // config.extraLocale (if any); return the loaded bundle localized to config.locale.
  2510. //
  2511. // 2. <path>/nls/<locale>/<bundle>
  2512. // => load then return the bundle localized to <locale>
  2513. //
  2514. // 3. *preload*<path>/nls/<module>*<JSON array of available locales>
  2515. // => for config.locale and all config.extraLocale, load all bundles found
  2516. // in the best-matching bundle rollup. A value of 1 is returned, which
  2517. // is meaningless other than to say the plugin is executing the requested
  2518. // preloads
  2519. //
  2520. // In cases 1 and 2, <path> is always normalized to an absolute module id upon entry; see
  2521. // normalize. In case 3, it <path> is assumed to be absolue; this is arranged by the builder.
  2522. //
  2523. // To load a bundle means to insert the bundle into the plugin's cache and publish the bundle
  2524. // value to the loader. Given <path>, <bundle>, and a particular <locale>, the cache key
  2525. //
  2526. // <path>/nls/<bundle>/<locale>
  2527. //
  2528. // will hold the value. Similarly, then plugin will publish this value to the loader by
  2529. //
  2530. // define("<path>/nls/<bundle>/<locale>", <bundle-value>);
  2531. //
  2532. // Given this algorithm, other machinery can provide fast load paths be preplacing
  2533. // values in the plugin's cache, which is public. When a load is demanded the
  2534. // cache is inspected before starting any loading. Explicitly placing values in the plugin
  2535. // cache is an advanced/experimental feature that should not be needed; use at your own risk.
  2536. //
  2537. // For the normal AMD algorithm, the root bundle is loaded first, which instructs the
  2538. // plugin what additional localized bundles are required for a particular locale. These
  2539. // additional locales are loaded and a mix of the root and each progressively-specific
  2540. // locale is returned. For example:
  2541. //
  2542. // 1. The client demands "dojo/i18n!some/path/nls/someBundle
  2543. //
  2544. // 2. The loader demands load(some/path/nls/someBundle)
  2545. //
  2546. // 3. This plugin require's "some/path/nls/someBundle", which is the root bundle.
  2547. //
  2548. // 4. Assuming config.locale is "ab-cd-ef" and the root bundle indicates that localizations
  2549. // are available for "ab" and "ab-cd-ef" (note the missing "ab-cd", then the plugin
  2550. // requires "some/path/nls/ab/someBundle" and "some/path/nls/ab-cd-ef/someBundle"
  2551. //
  2552. // 5. Upon receiving all required bundles, the plugin constructs the value of the bundle
  2553. // ab-cd-ef as...
  2554. //
  2555. // mixin(mixin(mixin({}, require("some/path/nls/someBundle"),
  2556. // require("some/path/nls/ab/someBundle")),
  2557. // require("some/path/nls/ab-cd-ef/someBundle"));
  2558. //
  2559. // This value is inserted into the cache and published to the loader at the
  2560. // key/module-id some/path/nls/someBundle/ab-cd-ef.
  2561. //
  2562. // The special preload signature (case 3) instructs the plugin to stop servicing all normal requests
  2563. // (further preload requests will be serviced) until all ongoing preloading has completed.
  2564. //
  2565. // The preload signature instructs the plugin that a special rollup module is available that contains
  2566. // one or more flattened, localized bundles. The JSON array of available locales indicates which locales
  2567. // are available. Here is an example:
  2568. //
  2569. // *preload*some/path/nls/someModule*["root", "ab", "ab-cd-ef"]
  2570. //
  2571. // This indicates the following rollup modules are available:
  2572. //
  2573. // some/path/nls/someModule_ROOT
  2574. // some/path/nls/someModule_ab
  2575. // some/path/nls/someModule_ab-cd-ef
  2576. //
  2577. // Each of these modules is a normal AMD module that contains one or more flattened bundles in a hash.
  2578. // For example, assume someModule contained the bundles some/bundle/path/someBundle and
  2579. // some/bundle/path/someOtherBundle, then some/path/nls/someModule_ab would be expressed as folllows:
  2580. //
  2581. // define({
  2582. // some/bundle/path/someBundle:<value of someBundle, flattened with respect to locale ab>,
  2583. // some/bundle/path/someOtherBundle:<value of someOtherBundle, flattened with respect to locale ab>,
  2584. // });
  2585. //
  2586. // E.g., given this design, preloading for locale=="ab" can execute the following algorithm:
  2587. //
  2588. // require(["some/path/nls/someModule_ab"], function(rollup){
  2589. // for(var p in rollup){
  2590. // var id = p + "/ab",
  2591. // cache[id] = rollup[p];
  2592. // define(id, rollup[p]);
  2593. // }
  2594. // });
  2595. //
  2596. // Similarly, if "ab-cd" is requested, the algorithm can determine that "ab" is the best available and
  2597. // load accordingly.
  2598. //
  2599. // The builder will write such rollups for every layer if a non-empty localeList profile property is
  2600. // provided. Further, the builder will include the following cache entry in the cache associated with
  2601. // any layer.
  2602. //
  2603. // "*now":function(r){r(['dojo/i18n!*preload*<path>/nls/<module>*<JSON array of available locales>']);}
  2604. //
  2605. // The *now special cache module instructs the loader to apply the provided function to context-require
  2606. // with respect to the particular layer being defined. This causes the plugin to hold all normal service
  2607. // requests until all preloading is complete.
  2608. //
  2609. // Notice that this algorithm is rarely better than the standard AMD load algorithm. Consider the normal case
  2610. // where the target locale has a single segment and a layer depends on a single bundle:
  2611. //
  2612. // Without Preloads:
  2613. //
  2614. // 1. Layer loads root bundle.
  2615. // 2. bundle is demanded; plugin loads single localized bundle.
  2616. //
  2617. // With Preloads:
  2618. //
  2619. // 1. Layer causes preloading of target bundle.
  2620. // 2. bundle is demanded; service is delayed until preloading complete; bundle is returned.
  2621. //
  2622. // In each case a single transaction is required to load the target bundle. In cases where multiple bundles
  2623. // are required and/or the locale has multiple segments, preloads still requires a single transaction whereas
  2624. // the normal path requires an additional transaction for each additional bundle/locale-segment. However all
  2625. // of these additional transactions can be done concurrently. Owing to this analysis, the entire preloading
  2626. // algorithm can be discard during a build by setting the has feature dojo-preload-i18n-Api to false.
  2627. //
  2628. if(has("dojo-preload-i18n-Api")){
  2629. var split = id.split("*"),
  2630. preloadDemand = split[1]=="preload";
  2631. if(preloadDemand){
  2632. if(!cache[id]){
  2633. // use cache[id] to prevent multiple preloads of the same preload; this shouldn't happen, but
  2634. // who knows what over-aggressive human optimizers may attempt
  2635. cache[id] = 1;
  2636. preloadL10n(split[2], json.parse(split[3]), 1);
  2637. }
  2638. // don't stall the loader!
  2639. load(1);
  2640. }
  2641. if(preloadDemand || waitForPreloads(id, require, load)){
  2642. return;
  2643. }
  2644. }
  2645. var match= nlsRe.exec(id),
  2646. bundlePath= match[1] + "/",
  2647. bundleName= match[5] || match[4],
  2648. bundlePathAndName= bundlePath + bundleName,
  2649. localeSpecified = (match[5] && match[4]),
  2650. targetLocale= localeSpecified || dojo.locale,
  2651. loadTarget= bundlePathAndName + "/" + targetLocale,
  2652. loadList = localeSpecified ? [targetLocale] : getLocalesToLoad(targetLocale),
  2653. remaining = loadList.length,
  2654. finish = function(){
  2655. if(!--remaining){
  2656. load(lang.delegate(cache[loadTarget]));
  2657. }
  2658. };
  2659. array.forEach(loadList, function(locale){
  2660. var target = bundlePathAndName + "/" + locale;
  2661. if(has("dojo-preload-i18n-Api")){
  2662. checkForLegacyModules(target);
  2663. }
  2664. if(!cache[target]){
  2665. doLoad(require, bundlePathAndName, bundlePath, bundleName, locale, finish);
  2666. }else{
  2667. finish();
  2668. }
  2669. });
  2670. };
  2671. if(has("dojo-unit-tests")){
  2672. var unitTests = thisModule.unitTests = [];
  2673. }
  2674. if(has("dojo-preload-i18n-Api") || 1){
  2675. var normalizeLocale = thisModule.normalizeLocale= function(locale){
  2676. var result = locale ? locale.toLowerCase() : dojo.locale;
  2677. return result == "root" ? "ROOT" : result;
  2678. },
  2679. isXd = function(mid){
  2680. return (1 && 1) ?
  2681. require.isXdUrl(require.toUrl(mid + ".js")) :
  2682. true;
  2683. },
  2684. preloading = 0,
  2685. preloadWaitQueue = [],
  2686. preloadL10n = thisModule._preloadLocalizations = function(/*String*/bundlePrefix, /*Array*/localesGenerated, /*boolean*/ guaranteedAmdFormat){
  2687. // summary:
  2688. // Load available flattened resource bundles associated with a particular module for dojo.locale and all dojo.config.extraLocale (if any)
  2689. //
  2690. // descirption:
  2691. // Only called by built layer files. The entire locale hierarchy is loaded. For example,
  2692. // if locale=="ab-cd", then ROOT, "ab", and "ab-cd" are loaded. This is different than v1.6-
  2693. // in that the v1.6- would lonly load ab-cd...which was *always* flattened.
  2694. //
  2695. // If guaranteedAmdFormat is true, then the module can be loaded with require thereby circumventing the detection algorithm
  2696. // and the extra possible extra transaction.
  2697. //
  2698. function forEachLocale(locale, func){
  2699. // given locale= "ab-cd-ef", calls func on "ab-cd-ef", "ab-cd", "ab", "ROOT"; stops calling the first time func returns truthy
  2700. var parts = locale.split("-");
  2701. while(parts.length){
  2702. if(func(parts.join("-"))){
  2703. return true;
  2704. }
  2705. parts.pop();
  2706. }
  2707. return func("ROOT");
  2708. }
  2709. function preload(locale){
  2710. locale = normalizeLocale(locale);
  2711. forEachLocale(locale, function(loc){
  2712. if(array.indexOf(localesGenerated, loc)>=0){
  2713. var mid = bundlePrefix.replace(/\./g, "/")+"_"+loc;
  2714. preloading++;
  2715. (isXd(mid) || guaranteedAmdFormat ? require : syncRequire)([mid], function(rollup){
  2716. for(var p in rollup){
  2717. cache[p + "/" + loc] = rollup[p];
  2718. }
  2719. --preloading;
  2720. while(!preloading && preloadWaitQueue.length){
  2721. load.apply(null, preloadWaitQueue.shift());
  2722. }
  2723. });
  2724. return true;
  2725. }
  2726. return false;
  2727. });
  2728. }
  2729. preload();
  2730. array.forEach(dojo.config.extraLocale, preload);
  2731. },
  2732. waitForPreloads = function(id, require, load){
  2733. if(preloading){
  2734. preloadWaitQueue.push([id, require, load]);
  2735. }
  2736. return preloading;
  2737. };
  2738. }
  2739. if(1){
  2740. // this code path assumes the dojo loader and won't work with a standard AMD loader
  2741. var evalBundle=
  2742. // use the function ctor to keep the minifiers away (also come close to global scope, but this is secondary)
  2743. new Function(
  2744. "__bundle", // the bundle to evalutate
  2745. "__checkForLegacyModules", // a function that checks if __bundle defined __mid in the global space
  2746. "__mid", // the mid that __bundle is intended to define
  2747. // returns one of:
  2748. // 1 => the bundle was an AMD bundle
  2749. // a legacy bundle object that is the value of __mid
  2750. // instance of Error => could not figure out how to evaluate bundle
  2751. // used to detect when __bundle calls define
  2752. "var define = function(){define.called = 1;},"
  2753. + " require = function(){define.called = 1;};"
  2754. + "try{"
  2755. + "define.called = 0;"
  2756. + "eval(__bundle);"
  2757. + "if(define.called==1)"
  2758. // bundle called define; therefore signal it's an AMD bundle
  2759. + "return 1;"
  2760. + "if((__checkForLegacyModules = __checkForLegacyModules(__mid)))"
  2761. // bundle was probably a v1.6- built NLS flattened NLS bundle that defined __mid in the global space
  2762. + "return __checkForLegacyModules;"
  2763. + "}catch(e){}"
  2764. // evaulating the bundle was *neither* an AMD *nor* a legacy flattened bundle
  2765. // either way, re-eval *after* surrounding with parentheses
  2766. + "try{"
  2767. + "return eval('('+__bundle+')');"
  2768. + "}catch(e){"
  2769. + "return e;"
  2770. + "}"
  2771. ),
  2772. syncRequire= function(deps, callback){
  2773. var results= [];
  2774. array.forEach(deps, function(mid){
  2775. var url= require.toUrl(mid + ".js");
  2776. function load(text){
  2777. var result = evalBundle(text, checkForLegacyModules, mid);
  2778. if(result===1){
  2779. // the bundle was an AMD module; re-inject it through the normal AMD path
  2780. // we gotta do this since it could be an anonymous module and simply evaluating
  2781. // the text here won't provide the loader with the context to know what
  2782. // module is being defined()'d. With browser caching, this should be free; further
  2783. // this entire code path can be circumvented by using the AMD format to begin with
  2784. require([mid], function(bundle){
  2785. results.push(cache[url]= bundle);
  2786. });
  2787. }else{
  2788. if(result instanceof Error){
  2789. console.error("failed to evaluate i18n bundle; url=" + url, result);
  2790. result = {};
  2791. }
  2792. // nls/<locale>/<bundle-name> indicates not the root.
  2793. results.push(cache[url] = (/nls\/[^\/]+\/[^\/]+$/.test(url) ? result : {root:result, _v1x:1}));
  2794. }
  2795. }
  2796. if(cache[url]){
  2797. results.push(cache[url]);
  2798. }else{
  2799. var bundle = require.syncLoadNls(mid);
  2800. // need to check for legacy module here because there might be a legacy module for a
  2801. // less specific locale (which was not looked up during the first checkForLegacyModules
  2802. // call in load()).
  2803. // Also need to reverse the locale and the module name in the mid because syncRequire
  2804. // deps parameters uses the AMD style package/nls/locale/module while legacy code uses
  2805. // package/nls/module/locale.
  2806. if(!bundle){
  2807. bundle = checkForLegacyModules(mid.replace(/nls\/([^\/]*)\/([^\/]*)$/, "nls/$2/$1"));
  2808. }
  2809. if(bundle){
  2810. results.push(bundle);
  2811. }else{
  2812. if(!xhr){
  2813. try{
  2814. require.getText(url, true, load);
  2815. }catch(e){
  2816. results.push(cache[url]= {});
  2817. }
  2818. }else{
  2819. xhr.get({
  2820. url:url,
  2821. sync:true,
  2822. load:load,
  2823. error:function(){
  2824. results.push(cache[url]= {});
  2825. }
  2826. });
  2827. }
  2828. }
  2829. }
  2830. });
  2831. callback && callback.apply(null, results);
  2832. },
  2833. checkForLegacyModules = function(target){
  2834. // legacy code may have already loaded [e.g] the raw bundle x/y/z at x.y.z; when true, push into the cache
  2835. for(var result, names = target.split("/"), object = dojo.global[names[0]], i = 1; object && i<names.length-1; object = object[names[i++]]){}
  2836. if(object){
  2837. result = object[names[i]];
  2838. if(!result){
  2839. // fallback for incorrect bundle build of 1.6
  2840. result = object[names[i].replace(/-/g,"_")];
  2841. }
  2842. if(result){
  2843. cache[target] = result;
  2844. }
  2845. }
  2846. return result;
  2847. };
  2848. thisModule.getLocalization= function(moduleName, bundleName, locale){
  2849. var result,
  2850. l10nName= getL10nName(moduleName, bundleName, locale).substring(10);
  2851. load(l10nName, (!isXd(l10nName) ? syncRequire : require), function(result_){ result= result_; });
  2852. return result;
  2853. };
  2854. if(has("dojo-unit-tests")){
  2855. unitTests.push(function(doh){
  2856. doh.register("tests.i18n.unit", function(t){
  2857. var check;
  2858. check = evalBundle("{prop:1}");
  2859. t.is({prop:1}, check); t.is(undefined, check[1]);
  2860. check = evalBundle("({prop:1})");
  2861. t.is({prop:1}, check); t.is(undefined, check[1]);
  2862. check = evalBundle("{'prop-x':1}");
  2863. t.is({'prop-x':1}, check); t.is(undefined, check[1]);
  2864. check = evalBundle("({'prop-x':1})");
  2865. t.is({'prop-x':1}, check); t.is(undefined, check[1]);
  2866. check = evalBundle("define({'prop-x':1})");
  2867. t.is(1, check);
  2868. check = evalBundle("this is total nonsense and should throw an error");
  2869. t.is(check instanceof Error, true);
  2870. });
  2871. });
  2872. }
  2873. }
  2874. return lang.mixin(thisModule, {
  2875. dynamic:true,
  2876. normalize:normalize,
  2877. load:load,
  2878. cache:cache
  2879. });
  2880. });
  2881. },
  2882. 'dojo/_base/html':function(){
  2883. 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){
  2884. // module:
  2885. // dojo/dom
  2886. // summary:
  2887. // This module is a stub for the core dojo DOM API.
  2888. // mix-in dom
  2889. dojo.byId = dom.byId;
  2890. dojo.isDescendant = dom.isDescendant;
  2891. dojo.setSelectable = dom.setSelectable;
  2892. // mix-in dom-attr
  2893. dojo.getAttr = attr.get;
  2894. dojo.setAttr = attr.set;
  2895. dojo.hasAttr = attr.has;
  2896. dojo.removeAttr = attr.remove;
  2897. dojo.getNodeProp = attr.getNodeProp;
  2898. dojo.attr = function(node, name, value){
  2899. // summary:
  2900. // Gets or sets an attribute on an HTML element.
  2901. // description:
  2902. // Handles normalized getting and setting of attributes on DOM
  2903. // Nodes. If 2 arguments are passed, and a the second argument is a
  2904. // string, acts as a getter.
  2905. //
  2906. // If a third argument is passed, or if the second argument is a
  2907. // map of attributes, acts as a setter.
  2908. //
  2909. // When passing functions as values, note that they will not be
  2910. // directly assigned to slots on the node, but rather the default
  2911. // behavior will be removed and the new behavior will be added
  2912. // using `dojo.connect()`, meaning that event handler properties
  2913. // will be normalized and that some caveats with regards to
  2914. // non-standard behaviors for onsubmit apply. Namely that you
  2915. // should cancel form submission using `dojo.stopEvent()` on the
  2916. // passed event object instead of returning a boolean value from
  2917. // the handler itself.
  2918. // node: DOMNode|String
  2919. // id or reference to the element to get or set the attribute on
  2920. // name: String|Object
  2921. // the name of the attribute to get or set.
  2922. // value: String?
  2923. // The value to set for the attribute
  2924. // returns:
  2925. // when used as a getter, the value of the requested attribute
  2926. // or null if that attribute does not have a specified or
  2927. // default value;
  2928. //
  2929. // when used as a setter, the DOM node
  2930. //
  2931. // example:
  2932. // | // get the current value of the "foo" attribute on a node
  2933. // | dojo.attr(dojo.byId("nodeId"), "foo");
  2934. // | // or we can just pass the id:
  2935. // | dojo.attr("nodeId", "foo");
  2936. //
  2937. // example:
  2938. // | // use attr() to set the tab index
  2939. // | dojo.attr("nodeId", "tabIndex", 3);
  2940. // |
  2941. //
  2942. // example:
  2943. // Set multiple values at once, including event handlers:
  2944. // | dojo.attr("formId", {
  2945. // | "foo": "bar",
  2946. // | "tabIndex": -1,
  2947. // | "method": "POST",
  2948. // | "onsubmit": function(e){
  2949. // | // stop submitting the form. Note that the IE behavior
  2950. // | // of returning true or false will have no effect here
  2951. // | // since our handler is connect()ed to the built-in
  2952. // | // onsubmit behavior and so we need to use
  2953. // | // dojo.stopEvent() to ensure that the submission
  2954. // | // doesn't proceed.
  2955. // | dojo.stopEvent(e);
  2956. // |
  2957. // | // submit the form with Ajax
  2958. // | dojo.xhrPost({ form: "formId" });
  2959. // | }
  2960. // | });
  2961. //
  2962. // example:
  2963. // Style is s special case: Only set with an object hash of styles
  2964. // | dojo.attr("someNode",{
  2965. // | id:"bar",
  2966. // | style:{
  2967. // | width:"200px", height:"100px", color:"#000"
  2968. // | }
  2969. // | });
  2970. //
  2971. // example:
  2972. // Again, only set style as an object hash of styles:
  2973. // | var obj = { color:"#fff", backgroundColor:"#000" };
  2974. // | dojo.attr("someNode", "style", obj);
  2975. // |
  2976. // | // though shorter to use `dojo.style()` in this case:
  2977. // | dojo.style("someNode", obj);
  2978. if(arguments.length == 2){
  2979. return attr[typeof name == "string" ? "get" : "set"](node, name);
  2980. }
  2981. return attr.set(node, name, value);
  2982. };
  2983. // mix-in dom-class
  2984. dojo.hasClass = cls.contains;
  2985. dojo.addClass = cls.add;
  2986. dojo.removeClass = cls.remove;
  2987. dojo.toggleClass = cls.toggle;
  2988. dojo.replaceClass = cls.replace;
  2989. // mix-in dom-construct
  2990. dojo._toDom = dojo.toDom = ctr.toDom;
  2991. dojo.place = ctr.place;
  2992. dojo.create = ctr.create;
  2993. dojo.empty = function(node){ ctr.empty(node); };
  2994. dojo._destroyElement = dojo.destroy = function(node){ ctr.destroy(node); };
  2995. // mix-in dom-geometry
  2996. dojo._getPadExtents = dojo.getPadExtents = geom.getPadExtents;
  2997. dojo._getBorderExtents = dojo.getBorderExtents = geom.getBorderExtents;
  2998. dojo._getPadBorderExtents = dojo.getPadBorderExtents = geom.getPadBorderExtents;
  2999. dojo._getMarginExtents = dojo.getMarginExtents = geom.getMarginExtents;
  3000. dojo._getMarginSize = dojo.getMarginSize = geom.getMarginSize;
  3001. dojo._getMarginBox = dojo.getMarginBox = geom.getMarginBox;
  3002. dojo.setMarginBox = geom.setMarginBox;
  3003. dojo._getContentBox = dojo.getContentBox = geom.getContentBox;
  3004. dojo.setContentSize = geom.setContentSize;
  3005. dojo._isBodyLtr = dojo.isBodyLtr = geom.isBodyLtr;
  3006. dojo._docScroll = dojo.docScroll = geom.docScroll;
  3007. dojo._getIeDocumentElementOffset = dojo.getIeDocumentElementOffset = geom.getIeDocumentElementOffset;
  3008. dojo._fixIeBiDiScrollLeft = dojo.fixIeBiDiScrollLeft = geom.fixIeBiDiScrollLeft;
  3009. dojo.position = geom.position;
  3010. dojo.marginBox = function marginBox(/*DomNode|String*/node, /*Object?*/box){
  3011. // summary:
  3012. // Getter/setter for the margin-box of node.
  3013. // description:
  3014. // Getter/setter for the margin-box of node.
  3015. // Returns an object in the expected format of box (regardless
  3016. // if box is passed). The object might look like:
  3017. // `{ l: 50, t: 200, w: 300: h: 150 }`
  3018. // for a node offset from its parent 50px to the left, 200px from
  3019. // the top with a margin width of 300px and a margin-height of
  3020. // 150px.
  3021. // node:
  3022. // id or reference to DOM Node to get/set box for
  3023. // box:
  3024. // If passed, denotes that dojo.marginBox() should
  3025. // update/set the margin box for node. Box is an object in the
  3026. // above format. All properties are optional if passed.
  3027. // example:
  3028. // Retrieve the margin box of a passed node
  3029. // | var box = dojo.marginBox("someNodeId");
  3030. // | console.dir(box);
  3031. //
  3032. // example:
  3033. // Set a node's margin box to the size of another node
  3034. // | var box = dojo.marginBox("someNodeId");
  3035. // | dojo.marginBox("someOtherNode", box);
  3036. return box ? geom.setMarginBox(node, box) : geom.getMarginBox(node); // Object
  3037. };
  3038. dojo.contentBox = function contentBox(/*DomNode|String*/node, /*Object?*/box){
  3039. // summary:
  3040. // Getter/setter for the content-box of node.
  3041. // description:
  3042. // Returns an object in the expected format of box (regardless if box is passed).
  3043. // The object might look like:
  3044. // `{ l: 50, t: 200, w: 300: h: 150 }`
  3045. // for a node offset from its parent 50px to the left, 200px from
  3046. // the top with a content width of 300px and a content-height of
  3047. // 150px. Note that the content box may have a much larger border
  3048. // or margin box, depending on the box model currently in use and
  3049. // CSS values set/inherited for node.
  3050. // While the getter will return top and left values, the
  3051. // setter only accepts setting the width and height.
  3052. // node:
  3053. // id or reference to DOM Node to get/set box for
  3054. // box:
  3055. // If passed, denotes that dojo.contentBox() should
  3056. // update/set the content box for node. Box is an object in the
  3057. // above format, but only w (width) and h (height) are supported.
  3058. // All properties are optional if passed.
  3059. return box ? geom.setContentSize(node, box) : geom.getContentBox(node); // Object
  3060. };
  3061. dojo.coords = function(/*DomNode|String*/node, /*Boolean?*/includeScroll){
  3062. // summary:
  3063. // Deprecated: Use position() for border-box x/y/w/h
  3064. // or marginBox() for margin-box w/h/l/t.
  3065. // Returns an object representing a node's size and position.
  3066. //
  3067. // description:
  3068. // Returns an object that measures margin-box (w)idth/(h)eight
  3069. // and absolute position x/y of the border-box. Also returned
  3070. // is computed (l)eft and (t)op values in pixels from the
  3071. // node's offsetParent as returned from marginBox().
  3072. // Return value will be in the form:
  3073. //| { l: 50, t: 200, w: 300: h: 150, x: 100, y: 300 }
  3074. // Does not act as a setter. If includeScroll is passed, the x and
  3075. // y params are affected as one would expect in dojo.position().
  3076. dojo.deprecated("dojo.coords()", "Use dojo.position() or dojo.marginBox().");
  3077. node = dom.byId(node);
  3078. var s = style.getComputedStyle(node), mb = geom.getMarginBox(node, s);
  3079. var abs = geom.position(node, includeScroll);
  3080. mb.x = abs.x;
  3081. mb.y = abs.y;
  3082. return mb; // Object
  3083. };
  3084. // mix-in dom-prop
  3085. dojo.getProp = prop.get;
  3086. dojo.setProp = prop.set;
  3087. dojo.prop = function(/*DomNode|String*/node, /*String|Object*/name, /*String?*/value){
  3088. // summary:
  3089. // Gets or sets a property on an HTML element.
  3090. // description:
  3091. // Handles normalized getting and setting of properties on DOM
  3092. // Nodes. If 2 arguments are passed, and a the second argument is a
  3093. // string, acts as a getter.
  3094. //
  3095. // If a third argument is passed, or if the second argument is a
  3096. // map of attributes, acts as a setter.
  3097. //
  3098. // When passing functions as values, note that they will not be
  3099. // directly assigned to slots on the node, but rather the default
  3100. // behavior will be removed and the new behavior will be added
  3101. // using `dojo.connect()`, meaning that event handler properties
  3102. // will be normalized and that some caveats with regards to
  3103. // non-standard behaviors for onsubmit apply. Namely that you
  3104. // should cancel form submission using `dojo.stopEvent()` on the
  3105. // passed event object instead of returning a boolean value from
  3106. // the handler itself.
  3107. // node:
  3108. // id or reference to the element to get or set the property on
  3109. // name:
  3110. // the name of the property to get or set.
  3111. // value:
  3112. // The value to set for the property
  3113. // returns:
  3114. // when used as a getter, the value of the requested property
  3115. // or null if that attribute does not have a specified or
  3116. // default value;
  3117. //
  3118. // when used as a setter, the DOM node
  3119. //
  3120. // example:
  3121. // | // get the current value of the "foo" property on a node
  3122. // | dojo.prop(dojo.byId("nodeId"), "foo");
  3123. // | // or we can just pass the id:
  3124. // | dojo.prop("nodeId", "foo");
  3125. //
  3126. // example:
  3127. // | // use prop() to set the tab index
  3128. // | dojo.prop("nodeId", "tabIndex", 3);
  3129. // |
  3130. //
  3131. // example:
  3132. // Set multiple values at once, including event handlers:
  3133. // | dojo.prop("formId", {
  3134. // | "foo": "bar",
  3135. // | "tabIndex": -1,
  3136. // | "method": "POST",
  3137. // | "onsubmit": function(e){
  3138. // | // stop submitting the form. Note that the IE behavior
  3139. // | // of returning true or false will have no effect here
  3140. // | // since our handler is connect()ed to the built-in
  3141. // | // onsubmit behavior and so we need to use
  3142. // | // dojo.stopEvent() to ensure that the submission
  3143. // | // doesn't proceed.
  3144. // | dojo.stopEvent(e);
  3145. // |
  3146. // | // submit the form with Ajax
  3147. // | dojo.xhrPost({ form: "formId" });
  3148. // | }
  3149. // | });
  3150. //
  3151. // example:
  3152. // Style is s special case: Only set with an object hash of styles
  3153. // | dojo.prop("someNode",{
  3154. // | id:"bar",
  3155. // | style:{
  3156. // | width:"200px", height:"100px", color:"#000"
  3157. // | }
  3158. // | });
  3159. //
  3160. // example:
  3161. // Again, only set style as an object hash of styles:
  3162. // | var obj = { color:"#fff", backgroundColor:"#000" };
  3163. // | dojo.prop("someNode", "style", obj);
  3164. // |
  3165. // | // though shorter to use `dojo.style()` in this case:
  3166. // | dojo.style("someNode", obj);
  3167. if(arguments.length == 2){
  3168. return prop[typeof name == "string" ? "get" : "set"](node, name);
  3169. }
  3170. // setter
  3171. return prop.set(node, name, value);
  3172. };
  3173. // mix-in dom-style
  3174. dojo.getStyle = style.get;
  3175. dojo.setStyle = style.set;
  3176. dojo.getComputedStyle = style.getComputedStyle;
  3177. dojo.__toPixelValue = dojo.toPixelValue = style.toPixelValue;
  3178. dojo.style = function(node, name, value){
  3179. // summary:
  3180. // Accesses styles on a node. If 2 arguments are
  3181. // passed, acts as a getter. If 3 arguments are passed, acts
  3182. // as a setter.
  3183. // description:
  3184. // Getting the style value uses the computed style for the node, so the value
  3185. // will be a calculated value, not just the immediate node.style value.
  3186. // Also when getting values, use specific style names,
  3187. // like "borderBottomWidth" instead of "border" since compound values like
  3188. // "border" are not necessarily reflected as expected.
  3189. // If you want to get node dimensions, use `dojo.marginBox()`,
  3190. // `dojo.contentBox()` or `dojo.position()`.
  3191. // node: DOMNode|String
  3192. // id or reference to node to get/set style for
  3193. // name: String?|Object?
  3194. // the style property to set in DOM-accessor format
  3195. // ("borderWidth", not "border-width") or an object with key/value
  3196. // pairs suitable for setting each property.
  3197. // value: String?
  3198. // If passed, sets value on the node for style, handling
  3199. // cross-browser concerns. When setting a pixel value,
  3200. // be sure to include "px" in the value. For instance, top: "200px".
  3201. // Otherwise, in some cases, some browsers will not apply the style.
  3202. // returns:
  3203. // when used as a getter, return the computed style of the node if passing in an ID or node,
  3204. // or return the normalized, computed value for the property when passing in a node and a style property
  3205. // example:
  3206. // Passing only an ID or node returns the computed style object of
  3207. // the node:
  3208. // | dojo.style("thinger");
  3209. // example:
  3210. // Passing a node and a style property returns the current
  3211. // normalized, computed value for that property:
  3212. // | dojo.style("thinger", "opacity"); // 1 by default
  3213. //
  3214. // example:
  3215. // Passing a node, a style property, and a value changes the
  3216. // current display of the node and returns the new computed value
  3217. // | dojo.style("thinger", "opacity", 0.5); // == 0.5
  3218. //
  3219. // example:
  3220. // Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
  3221. // | dojo.style("thinger", {
  3222. // | "opacity": 0.5,
  3223. // | "border": "3px solid black",
  3224. // | "height": "300px"
  3225. // | });
  3226. //
  3227. // example:
  3228. // When the CSS style property is hyphenated, the JavaScript property is camelCased.
  3229. // font-size becomes fontSize, and so on.
  3230. // | dojo.style("thinger",{
  3231. // | fontSize:"14pt",
  3232. // | letterSpacing:"1.2em"
  3233. // | });
  3234. //
  3235. // example:
  3236. // dojo.NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
  3237. // dojo.style() on every element of the list. See: `dojo.query()` and `dojo.NodeList()`
  3238. // | dojo.query(".someClassName").style("visibility","hidden");
  3239. // | // or
  3240. // | dojo.query("#baz > div").style({
  3241. // | opacity:0.75,
  3242. // | fontSize:"13pt"
  3243. // | });
  3244. switch(arguments.length){
  3245. case 1:
  3246. return style.get(node);
  3247. case 2:
  3248. return style[typeof name == "string" ? "get" : "set"](node, name);
  3249. }
  3250. // setter
  3251. return style.set(node, name, value);
  3252. };
  3253. return dojo;
  3254. });
  3255. },
  3256. 'dojo/_base/kernel':function(){
  3257. define(["../has", "./config", "require", "module"], function(has, config, require, module){
  3258. // module:
  3259. // dojo/_base/kernel
  3260. // summary:
  3261. // This module is the foundational module of the dojo boot sequence; it defines the dojo object.
  3262. var
  3263. // loop variables for this module
  3264. i, p,
  3265. // create dojo, dijit, and dojox
  3266. // FIXME: in 2.0 remove dijit, dojox being created by dojo
  3267. global = (function () { return this; })(),
  3268. dijit = {},
  3269. dojox = {},
  3270. dojo = {
  3271. // notice dojo takes ownership of the value of the config module
  3272. config:config,
  3273. global:global,
  3274. dijit:dijit,
  3275. dojox:dojox
  3276. };
  3277. // Configure the scope map. For a 100% AMD application, the scope map is not needed other than to provide
  3278. // a _scopeName property for the dojo, dijit, and dojox root object so those packages can create
  3279. // unique names in the global space.
  3280. //
  3281. // Built, legacy modules use the scope map to allow those modules to be expressed as if dojo, dijit, and dojox,
  3282. // where global when in fact they are either global under different names or not global at all. In v1.6-, the
  3283. // config variable "scopeMap" was used to map names as used within a module to global names. This has been
  3284. // subsumed by the dojo packageMap configuration variable which relocates packages to different names. See
  3285. // http://livedocs.dojotoolkit.org/developer/design/loader#legacy-cross-domain-mode for details.
  3286. //
  3287. // The following computations contort the packageMap for this dojo instance into a scopeMap.
  3288. var scopeMap =
  3289. // a map from a name used in a legacy module to the (global variable name, object addressed by that name)
  3290. // always map dojo, dijit, and dojox
  3291. {
  3292. dojo:["dojo", dojo],
  3293. dijit:["dijit", dijit],
  3294. dojox:["dojox", dojox]
  3295. },
  3296. packageMap =
  3297. // the package map for this dojo instance; note, a foreign loader or no pacakgeMap results in the above default config
  3298. (require.packs && require.packs[module.id.match(/[^\/]+/)[0]].packageMap) || {},
  3299. item;
  3300. // process all mapped top-level names for this instance of dojo
  3301. for(p in packageMap){
  3302. if(scopeMap[p]){
  3303. // mapped dojo, dijit, or dojox
  3304. scopeMap[p][0] = packageMap[p];
  3305. }else{
  3306. // some other top-level name
  3307. scopeMap[p] = [packageMap[p], {}];
  3308. }
  3309. }
  3310. // publish those names to _scopeName and, optionally, the global namespace
  3311. for(p in scopeMap){
  3312. item = scopeMap[p];
  3313. item[1]._scopeName = item[0];
  3314. if(!config.noGlobals){
  3315. global[item[0]] = item[1];
  3316. }
  3317. }
  3318. dojo.scopeMap = scopeMap;
  3319. // FIXME: dojo.baseUrl and dojo.config.baseUrl should be deprecated
  3320. dojo.baseUrl = dojo.config.baseUrl = require.baseUrl;
  3321. dojo.isAsync = !1 || require.async;
  3322. dojo.locale = config.locale;
  3323. /*=====
  3324. dojo.version = function(){
  3325. // summary:
  3326. // Version number of the Dojo Toolkit
  3327. // major: Integer
  3328. // Major version. If total version is "1.2.0beta1", will be 1
  3329. // minor: Integer
  3330. // Minor version. If total version is "1.2.0beta1", will be 2
  3331. // patch: Integer
  3332. // Patch version. If total version is "1.2.0beta1", will be 0
  3333. // flag: String
  3334. // Descriptor flag. If total version is "1.2.0beta1", will be "beta1"
  3335. // revision: Number
  3336. // The SVN rev from which dojo was pulled
  3337. this.major = 0;
  3338. this.minor = 0;
  3339. this.patch = 0;
  3340. this.flag = "";
  3341. this.revision = 0;
  3342. }
  3343. =====*/
  3344. var rev = "$Rev: f95cfee $".match(/[0-9a-f]{7,}/);
  3345. dojo.version = {
  3346. major: 1, minor: 7, patch: 9, flag: "-20220503-IBM",
  3347. revision: rev ? rev[0] : NaN,
  3348. toString: function(){
  3349. var v = dojo.version;
  3350. return v.major + "." + v.minor + "." + v.patch + v.flag + " (" + v.revision + ")"; // String
  3351. }
  3352. };
  3353. // If 1 is truthy, then as a dojo module is defined it should push it's definitions
  3354. // into the dojo object, and conversely. In 2.0, it will likely be unusual to augment another object
  3355. // as a result of defining a module. This has feature gives a way to force 2.0 behavior as the code
  3356. // is migrated. Absent specific advice otherwise, set extend-dojo to truthy.
  3357. true || has.add("extend-dojo", 1);
  3358. dojo.eval = function(scriptText){
  3359. // summary:
  3360. // A legacy method created for use exclusively by internal Dojo methods. Do not use this method
  3361. // directly unless you understand its possibly-different implications on the platforms your are targeting.
  3362. // description:
  3363. // Makes an attempt to evaluate scriptText in the global scope. The function works correctly for browsers
  3364. // that support indirect eval.
  3365. //
  3366. // As usual, IE does not. On IE, the only way to implement global eval is to
  3367. // use execScript. Unfortunately, execScript does not return a value and breaks some current usages of dojo.eval.
  3368. // This implementation uses the technique of executing eval in the scope of a function that is a single scope
  3369. // frame below the global scope; thereby coming close to the global scope. Note carefully that
  3370. //
  3371. // dojo.eval("var pi = 3.14;");
  3372. //
  3373. // will define global pi in non-IE environments, but define pi only in a temporary local scope for IE. If you want
  3374. // to define a global variable using dojo.eval, write something like
  3375. //
  3376. // dojo.eval("window.pi = 3.14;")
  3377. // scriptText:
  3378. // The text to evaluation.
  3379. // returns:
  3380. // The result of the evaluation. Often `undefined`
  3381. };
  3382. (Function("d", "d.eval = function(){return d.global.eval ? d.global.eval(arguments[0]) : eval(arguments[0]);}"))(dojo);
  3383. if(0){
  3384. dojo.exit = function(exitcode){
  3385. quit(exitcode);
  3386. };
  3387. } else{
  3388. dojo.exit = function(){
  3389. };
  3390. }
  3391. true || has.add("dojo-guarantee-console",
  3392. // ensure that console.log, console.warn, etc. are defined
  3393. 1
  3394. );
  3395. if(1){
  3396. typeof console != "undefined" || (console = {});
  3397. // Be careful to leave 'log' always at the end
  3398. var cn = [
  3399. "assert", "count", "debug", "dir", "dirxml", "error", "group",
  3400. "groupEnd", "info", "profile", "profileEnd", "time", "timeEnd",
  3401. "trace", "warn", "log"
  3402. ];
  3403. var tn;
  3404. i = 0;
  3405. while((tn = cn[i++])){
  3406. if(!console[tn]){
  3407. (function(){
  3408. var tcn = tn + "";
  3409. console[tcn] = ('log' in console) ? function(){
  3410. var a = Array.prototype.slice.call(arguments);
  3411. a.unshift(tcn + ":");
  3412. console["log"](a.join(" "));
  3413. } : function(){};
  3414. console[tcn]._fake = true;
  3415. })();
  3416. }
  3417. }
  3418. }
  3419. has.add("dojo-debug-messages",
  3420. // include dojo.deprecated/dojo.experimental implementations
  3421. !!config.isDebug
  3422. );
  3423. if(has("dojo-debug-messages")){
  3424. dojo.deprecated = function(/*String*/ behaviour, /*String?*/ extra, /*String?*/ removal){
  3425. // summary:
  3426. // Log a debug message to indicate that a behavior has been
  3427. // deprecated.
  3428. // behaviour: String
  3429. // The API or behavior being deprecated. Usually in the form
  3430. // of "myApp.someFunction()".
  3431. // extra: String?
  3432. // Text to append to the message. Often provides advice on a
  3433. // new function or facility to achieve the same goal during
  3434. // the deprecation period.
  3435. // removal: String?
  3436. // Text to indicate when in the future the behavior will be
  3437. // removed. Usually a version number.
  3438. // example:
  3439. // | dojo.deprecated("myApp.getTemp()", "use myApp.getLocaleTemp() instead", "1.0");
  3440. var message = "DEPRECATED: " + behaviour;
  3441. if(extra){ message += " " + extra; }
  3442. if(removal){ message += " -- will be removed in version: " + removal; }
  3443. console.warn(message);
  3444. };
  3445. dojo.experimental = function(/* String */ moduleName, /* String? */ extra){
  3446. // summary: Marks code as experimental.
  3447. // description:
  3448. // This can be used to mark a function, file, or module as
  3449. // experimental. Experimental code is not ready to be used, and the
  3450. // APIs are subject to change without notice. Experimental code may be
  3451. // completed deleted without going through the normal deprecation
  3452. // process.
  3453. // moduleName: String
  3454. // The name of a module, or the name of a module file or a specific
  3455. // function
  3456. // extra: String?
  3457. // some additional message for the user
  3458. // example:
  3459. // | dojo.experimental("dojo.data.Result");
  3460. // example:
  3461. // | dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA");
  3462. var message = "EXPERIMENTAL: " + moduleName + " -- APIs subject to change without notice.";
  3463. if(extra){ message += " " + extra; }
  3464. console.warn(message);
  3465. };
  3466. }else{
  3467. dojo.deprecated = dojo.experimental = function(){};
  3468. }
  3469. true || has.add("dojo-modulePaths",
  3470. // consume dojo.modulePaths processing
  3471. 1
  3472. );
  3473. if(1){
  3474. // notice that modulePaths won't be applied to any require's before the dojo/_base/kernel factory is run;
  3475. // this is the v1.6- behavior.
  3476. if(config.modulePaths){
  3477. dojo.deprecated("dojo.modulePaths", "use paths configuration");
  3478. var paths = {};
  3479. for(p in config.modulePaths){
  3480. paths[p.replace(/\./g, "/")] = config.modulePaths[p];
  3481. }
  3482. require({paths:paths});
  3483. }
  3484. }
  3485. true || has.add("dojo-moduleUrl",
  3486. // include dojo.moduleUrl
  3487. 1
  3488. );
  3489. if(1){
  3490. dojo.moduleUrl = function(/*String*/module, /*String?*/url){
  3491. // summary:
  3492. // Returns a URL relative to a module.
  3493. // example:
  3494. // | var pngPath = dojo.moduleUrl("acme","images/small.png");
  3495. // | console.dir(pngPath); // list the object properties
  3496. // | // create an image and set it's source to pngPath's value:
  3497. // | var img = document.createElement("img");
  3498. // | img.src = pngPath;
  3499. // | // add our image to the document
  3500. // | dojo.body().appendChild(img);
  3501. // example:
  3502. // you may de-reference as far as you like down the package
  3503. // hierarchy. This is sometimes handy to avoid lenghty relative
  3504. // urls or for building portable sub-packages. In this example,
  3505. // the `acme.widget` and `acme.util` directories may be located
  3506. // under different roots (see `dojo.registerModulePath`) but the
  3507. // the modules which reference them can be unaware of their
  3508. // relative locations on the filesystem:
  3509. // | // somewhere in a configuration block
  3510. // | dojo.registerModulePath("acme.widget", "../../acme/widget");
  3511. // | dojo.registerModulePath("acme.util", "../../util");
  3512. // |
  3513. // | // ...
  3514. // |
  3515. // | // code in a module using acme resources
  3516. // | var tmpltPath = dojo.moduleUrl("acme.widget","templates/template.html");
  3517. // | var dataPath = dojo.moduleUrl("acme.util","resources/data.json");
  3518. dojo.deprecated("dojo.moduleUrl()", "use require.toUrl", "2.0");
  3519. // require.toUrl requires a filetype; therefore, just append the suffix "/*.*" to guarantee a filetype, then
  3520. // remove the suffix from the result. This way clients can request a url w/out a filetype. This should be
  3521. // rare, but it maintains backcompat for the v1.x line (note: dojo.moduleUrl will be removed in v2.0).
  3522. // Notice * is an illegal filename so it won't conflict with any real path map that may exist the paths config.
  3523. var result = null;
  3524. if(module){
  3525. result = require.toUrl(module.replace(/\./g, "/") + (url ? ("/" + url) : "") + "/*.*").replace(/\/\*\.\*/, "") + (url ? "" : "/");
  3526. }
  3527. return result;
  3528. };
  3529. }
  3530. dojo._hasResource = {}; // for backward compatibility with layers built with 1.6 tooling
  3531. return dojo;
  3532. });
  3533. },
  3534. 'dojo/io-query':function(){
  3535. define(["./_base/lang"], function(lang){
  3536. // module:
  3537. // dojo/io-query
  3538. // summary:
  3539. // This module defines query string processing functions.
  3540. var backstop = {};
  3541. function objectToQuery(/*Object*/ map){
  3542. // summary:
  3543. // takes a name/value mapping object and returns a string representing
  3544. // a URL-encoded version of that object.
  3545. // example:
  3546. // this object:
  3547. //
  3548. // | {
  3549. // | blah: "blah",
  3550. // | multi: [
  3551. // | "thud",
  3552. // | "thonk"
  3553. // | ]
  3554. // | };
  3555. //
  3556. // yields the following query string:
  3557. //
  3558. // | "blah=blah&multi=thud&multi=thonk"
  3559. // FIXME: need to implement encodeAscii!!
  3560. var enc = encodeURIComponent, pairs = [];
  3561. for(var name in map){
  3562. var value = map[name];
  3563. if(value != backstop[name]){
  3564. var assign = enc(name) + "=";
  3565. if(lang.isArray(value)){
  3566. for(var i = 0, l = value.length; i < l; ++i){
  3567. pairs.push(assign + enc(value[i]));
  3568. }
  3569. }else{
  3570. pairs.push(assign + enc(value));
  3571. }
  3572. }
  3573. }
  3574. return pairs.join("&"); // String
  3575. }
  3576. function queryToObject(/*String*/ str){
  3577. // summary:
  3578. // Create an object representing a de-serialized query section of a
  3579. // URL. Query keys with multiple values are returned in an array.
  3580. //
  3581. // example:
  3582. // This string:
  3583. //
  3584. // | "foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
  3585. //
  3586. // results in this object structure:
  3587. //
  3588. // | {
  3589. // | foo: [ "bar", "baz" ],
  3590. // | thinger: " spaces =blah",
  3591. // | zonk: "blarg"
  3592. // | }
  3593. //
  3594. // Note that spaces and other urlencoded entities are correctly
  3595. // handled.
  3596. // FIXME: should we grab the URL string if we're not passed one?
  3597. var dec = decodeURIComponent, qp = str.split("&"), ret = {}, name, val;
  3598. for(var i = 0, l = qp.length, item; i < l; ++i){
  3599. item = qp[i];
  3600. if(item.length){
  3601. var s = item.indexOf("=");
  3602. if(s < 0){
  3603. name = dec(item);
  3604. val = "";
  3605. }else{
  3606. name = dec(item.slice(0, s));
  3607. val = dec(item.slice(s + 1));
  3608. }
  3609. if(typeof ret[name] == "string"){ // inline'd type check
  3610. ret[name] = [ret[name]];
  3611. }
  3612. if(lang.isArray(ret[name])){
  3613. ret[name].push(val);
  3614. }else{
  3615. ret[name] = val;
  3616. }
  3617. }
  3618. }
  3619. return ret; // Object
  3620. }
  3621. return {
  3622. objectToQuery: objectToQuery,
  3623. queryToObject: queryToObject
  3624. };
  3625. });
  3626. },
  3627. 'dojo/_base/Deferred':function(){
  3628. define(["./kernel", "./lang"], function(dojo, lang){
  3629. // module:
  3630. // dojo/_base/Deferred
  3631. // summary:
  3632. // This module defines dojo.Deferred.
  3633. var mutator = function(){};
  3634. var freeze = Object.freeze || function(){};
  3635. // A deferred provides an API for creating and resolving a promise.
  3636. dojo.Deferred = function(/*Function?*/ canceller){
  3637. // summary:
  3638. // Deferreds provide a generic means for encapsulating an asynchronous
  3639. // operation and notifying users of the completion and result of the operation.
  3640. // description:
  3641. // The dojo.Deferred API is based on the concept of promises that provide a
  3642. // generic interface into the eventual completion of an asynchronous action.
  3643. // The motivation for promises fundamentally is about creating a
  3644. // separation of concerns that allows one to achieve the same type of
  3645. // call patterns and logical data flow in asynchronous code as can be
  3646. // achieved in synchronous code. Promises allows one
  3647. // to be able to call a function purely with arguments needed for
  3648. // execution, without conflating the call with concerns of whether it is
  3649. // sync or async. One shouldn't need to alter a call's arguments if the
  3650. // implementation switches from sync to async (or vice versa). By having
  3651. // async functions return promises, the concerns of making the call are
  3652. // separated from the concerns of asynchronous interaction (which are
  3653. // handled by the promise).
  3654. //
  3655. // The dojo.Deferred is a type of promise that provides methods for fulfilling the
  3656. // promise with a successful result or an error. The most important method for
  3657. // working with Dojo's promises is the then() method, which follows the
  3658. // CommonJS proposed promise API. An example of using a Dojo promise:
  3659. //
  3660. // | var resultingPromise = someAsyncOperation.then(function(result){
  3661. // | ... handle result ...
  3662. // | },
  3663. // | function(error){
  3664. // | ... handle error ...
  3665. // | });
  3666. //
  3667. // The .then() call returns a new promise that represents the result of the
  3668. // execution of the callback. The callbacks will never affect the original promises value.
  3669. //
  3670. // The dojo.Deferred instances also provide the following functions for backwards compatibility:
  3671. //
  3672. // * addCallback(handler)
  3673. // * addErrback(handler)
  3674. // * callback(result)
  3675. // * errback(result)
  3676. //
  3677. // Callbacks are allowed to return promises themselves, so
  3678. // you can build complicated sequences of events with ease.
  3679. //
  3680. // The creator of the Deferred may specify a canceller. The canceller
  3681. // is a function that will be called if Deferred.cancel is called
  3682. // before the Deferred fires. You can use this to implement clean
  3683. // aborting of an XMLHttpRequest, etc. Note that cancel will fire the
  3684. // deferred with a CancelledError (unless your canceller returns
  3685. // another kind of error), so the errbacks should be prepared to
  3686. // handle that error for cancellable Deferreds.
  3687. // example:
  3688. // | var deferred = new dojo.Deferred();
  3689. // | setTimeout(function(){ deferred.callback({success: true}); }, 1000);
  3690. // | return deferred;
  3691. // example:
  3692. // Deferred objects are often used when making code asynchronous. It
  3693. // may be easiest to write functions in a synchronous manner and then
  3694. // split code using a deferred to trigger a response to a long-lived
  3695. // operation. For example, instead of register a callback function to
  3696. // denote when a rendering operation completes, the function can
  3697. // simply return a deferred:
  3698. //
  3699. // | // callback style:
  3700. // | function renderLotsOfData(data, callback){
  3701. // | var success = false
  3702. // | try{
  3703. // | for(var x in data){
  3704. // | renderDataitem(data[x]);
  3705. // | }
  3706. // | success = true;
  3707. // | }catch(e){ }
  3708. // | if(callback){
  3709. // | callback(success);
  3710. // | }
  3711. // | }
  3712. //
  3713. // | // using callback style
  3714. // | renderLotsOfData(someDataObj, function(success){
  3715. // | // handles success or failure
  3716. // | if(!success){
  3717. // | promptUserToRecover();
  3718. // | }
  3719. // | });
  3720. // | // NOTE: no way to add another callback here!!
  3721. // example:
  3722. // Using a Deferred doesn't simplify the sending code any, but it
  3723. // provides a standard interface for callers and senders alike,
  3724. // providing both with a simple way to service multiple callbacks for
  3725. // an operation and freeing both sides from worrying about details
  3726. // such as "did this get called already?". With Deferreds, new
  3727. // callbacks can be added at any time.
  3728. //
  3729. // | // Deferred style:
  3730. // | function renderLotsOfData(data){
  3731. // | var d = new dojo.Deferred();
  3732. // | try{
  3733. // | for(var x in data){
  3734. // | renderDataitem(data[x]);
  3735. // | }
  3736. // | d.callback(true);
  3737. // | }catch(e){
  3738. // | d.errback(new Error("rendering failed"));
  3739. // | }
  3740. // | return d;
  3741. // | }
  3742. //
  3743. // | // using Deferred style
  3744. // | renderLotsOfData(someDataObj).then(null, function(){
  3745. // | promptUserToRecover();
  3746. // | });
  3747. // | // NOTE: addErrback and addCallback both return the Deferred
  3748. // | // again, so we could chain adding callbacks or save the
  3749. // | // deferred for later should we need to be notified again.
  3750. // example:
  3751. // In this example, renderLotsOfData is synchronous and so both
  3752. // versions are pretty artificial. Putting the data display on a
  3753. // timeout helps show why Deferreds rock:
  3754. //
  3755. // | // Deferred style and async func
  3756. // | function renderLotsOfData(data){
  3757. // | var d = new dojo.Deferred();
  3758. // | setTimeout(function(){
  3759. // | try{
  3760. // | for(var x in data){
  3761. // | renderDataitem(data[x]);
  3762. // | }
  3763. // | d.callback(true);
  3764. // | }catch(e){
  3765. // | d.errback(new Error("rendering failed"));
  3766. // | }
  3767. // | }, 100);
  3768. // | return d;
  3769. // | }
  3770. //
  3771. // | // using Deferred style
  3772. // | renderLotsOfData(someDataObj).then(null, function(){
  3773. // | promptUserToRecover();
  3774. // | });
  3775. //
  3776. // Note that the caller doesn't have to change his code at all to
  3777. // handle the asynchronous case.
  3778. var result, finished, isError, head, nextListener;
  3779. var promise = (this.promise = {});
  3780. function complete(value){
  3781. if(finished){
  3782. throw new Error("This deferred has already been resolved");
  3783. }
  3784. result = value;
  3785. finished = true;
  3786. notify();
  3787. }
  3788. function notify(){
  3789. var mutated;
  3790. while(!mutated && nextListener){
  3791. var listener = nextListener;
  3792. nextListener = nextListener.next;
  3793. if((mutated = (listener.progress == mutator))){ // assignment and check
  3794. finished = false;
  3795. }
  3796. var func = (isError ? listener.error : listener.resolved);
  3797. if(func){
  3798. try{
  3799. var newResult = func(result);
  3800. if (newResult && typeof newResult.then === "function"){
  3801. newResult.then(lang.hitch(listener.deferred, "resolve"), lang.hitch(listener.deferred, "reject"), lang.hitch(listener.deferred, "progress"));
  3802. continue;
  3803. }
  3804. var unchanged = mutated && newResult === undefined;
  3805. if(mutated && !unchanged){
  3806. isError = newResult instanceof Error;
  3807. }
  3808. listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
  3809. }catch(e){
  3810. listener.deferred.reject(e);
  3811. }
  3812. }else{
  3813. if(isError){
  3814. listener.deferred.reject(result);
  3815. }else{
  3816. listener.deferred.resolve(result);
  3817. }
  3818. }
  3819. }
  3820. }
  3821. // calling resolve will resolve the promise
  3822. this.resolve = this.callback = function(value){
  3823. // summary:
  3824. // Fulfills the Deferred instance successfully with the provide value
  3825. this.fired = 0;
  3826. this.results = [value, null];
  3827. complete(value);
  3828. };
  3829. // calling error will indicate that the promise failed
  3830. this.reject = this.errback = function(error){
  3831. // summary:
  3832. // Fulfills the Deferred instance as an error with the provided error
  3833. isError = true;
  3834. this.fired = 1;
  3835. complete(error);
  3836. this.results = [null, error];
  3837. if(!error || error.log !== false){
  3838. (dojo.config.deferredOnError || function(x){ console.error(x); })(error);
  3839. }
  3840. };
  3841. // call progress to provide updates on the progress on the completion of the promise
  3842. this.progress = function(update){
  3843. // summary:
  3844. // Send progress events to all listeners
  3845. var listener = nextListener;
  3846. while(listener){
  3847. var progress = listener.progress;
  3848. progress && progress(update);
  3849. listener = listener.next;
  3850. }
  3851. };
  3852. this.addCallbacks = function(callback, errback){
  3853. // summary:
  3854. // Adds callback and error callback for this deferred instance.
  3855. // callback: Function?
  3856. // The callback attached to this deferred object.
  3857. // errback: Function?
  3858. // The error callback attached to this deferred object.
  3859. // returns:
  3860. // Returns this deferred object.
  3861. this.then(callback, errback, mutator);
  3862. return this; // dojo.Deferred
  3863. };
  3864. // provide the implementation of the promise
  3865. promise.then = this.then = function(/*Function?*/resolvedCallback, /*Function?*/errorCallback, /*Function?*/progressCallback){
  3866. // summary:
  3867. // Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
  3868. // completion of a promise. The fulfilledHandler is called when the promise
  3869. // is fulfilled. The errorHandler is called when a promise fails. The
  3870. // progressHandler is called for progress events. All arguments are optional
  3871. // and non-function values are ignored. The progressHandler is not only an
  3872. // optional argument, but progress events are purely optional. Promise
  3873. // providers are not required to ever create progress events.
  3874. //
  3875. // This function will return a new promise that is fulfilled when the given
  3876. // fulfilledHandler or errorHandler callback is finished. This allows promise
  3877. // operations to be chained together. The value returned from the callback
  3878. // handler is the fulfillment value for the returned promise. If the callback
  3879. // throws an error, the returned promise will be moved to failed state.
  3880. //
  3881. // returns:
  3882. // Returns a new promise that represents the result of the
  3883. // execution of the callback. The callbacks will never affect the original promises value.
  3884. // example:
  3885. // An example of using a CommonJS compliant promise:
  3886. // | asyncComputeTheAnswerToEverything().
  3887. // | then(addTwo).
  3888. // | then(printResult, onError);
  3889. // | >44
  3890. //
  3891. var returnDeferred = progressCallback == mutator ? this : new dojo.Deferred(promise.cancel);
  3892. var listener = {
  3893. resolved: resolvedCallback,
  3894. error: errorCallback,
  3895. progress: progressCallback,
  3896. deferred: returnDeferred
  3897. };
  3898. if(nextListener){
  3899. head = head.next = listener;
  3900. }
  3901. else{
  3902. nextListener = head = listener;
  3903. }
  3904. if(finished){
  3905. notify();
  3906. }
  3907. return returnDeferred.promise; // Promise
  3908. };
  3909. var deferred = this;
  3910. promise.cancel = this.cancel = function (){
  3911. // summary:
  3912. // Cancels the asynchronous operation
  3913. if(!finished){
  3914. var error = canceller && canceller(deferred);
  3915. if(!finished){
  3916. if (!(error instanceof Error)){
  3917. error = new Error(error);
  3918. }
  3919. error.log = false;
  3920. deferred.reject(error);
  3921. }
  3922. }
  3923. };
  3924. freeze(promise);
  3925. };
  3926. lang.extend(dojo.Deferred, {
  3927. addCallback: function (/*Function*/ callback){
  3928. // summary:
  3929. // Adds successful callback for this deferred instance.
  3930. // returns:
  3931. // Returns this deferred object.
  3932. return this.addCallbacks(lang.hitch.apply(dojo, arguments)); // dojo.Deferred
  3933. },
  3934. addErrback: function (/*Function*/ errback){
  3935. // summary:
  3936. // Adds error callback for this deferred instance.
  3937. // returns:
  3938. // Returns this deferred object.
  3939. return this.addCallbacks(null, lang.hitch.apply(dojo, arguments)); // dojo.Deferred
  3940. },
  3941. addBoth: function (/*Function*/ callback){
  3942. // summary:
  3943. // Add handler as both successful callback and error callback for this deferred instance.
  3944. // returns:
  3945. // Returns this deferred object.
  3946. var enclosed = lang.hitch.apply(dojo, arguments);
  3947. return this.addCallbacks(enclosed, enclosed); // dojo.Deferred
  3948. },
  3949. fired: -1
  3950. });
  3951. dojo.Deferred.when = dojo.when = function(promiseOrValue, /*Function?*/ callback, /*Function?*/ errback, /*Function?*/ progressHandler){
  3952. // summary:
  3953. // This provides normalization between normal synchronous values and
  3954. // asynchronous promises, so you can interact with them in a common way
  3955. // returns:
  3956. // Returns a new promise that represents the result of the execution of callback
  3957. // when parameter "promiseOrValue" is promise.
  3958. // Returns the execution result of callback when parameter "promiseOrValue" is value.
  3959. // example:
  3960. // | function printFirstAndLast(items){
  3961. // | dojo.when(findFirst(items), console.log);
  3962. // | dojo.when(findLast(items), console.log);
  3963. // | }
  3964. // | function findFirst(items){
  3965. // | return dojo.when(items, function(items){
  3966. // | return items[0];
  3967. // | });
  3968. // | }
  3969. // | function findLast(items){
  3970. // | return dojo.when(items, function(items){
  3971. // | return items[items.length - 1];
  3972. // | });
  3973. // | }
  3974. // And now all three of his functions can be used sync or async.
  3975. // | printFirstAndLast([1,2,3,4]) will work just as well as
  3976. // | printFirstAndLast(dojo.xhrGet(...));
  3977. if(promiseOrValue && typeof promiseOrValue.then === "function"){
  3978. return promiseOrValue.then(callback, errback, progressHandler);
  3979. }
  3980. return callback ? callback(promiseOrValue) : promiseOrValue; // Promise
  3981. };
  3982. return dojo.Deferred;
  3983. });
  3984. },
  3985. 'dojo/NodeList-dom':function(){
  3986. 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){
  3987. /*===== var NodeList = dojo.NodeList; =====*/
  3988. var magicGuard = function(a){
  3989. // summary:
  3990. // the guard function for dojo.attr() and dojo.style()
  3991. return a.length == 1 && (typeof a[0] == "string"); // inline'd type check
  3992. };
  3993. var orphan = function(node){
  3994. // summary:
  3995. // function to orphan nodes
  3996. var p = node.parentNode;
  3997. if(p){
  3998. p.removeChild(node);
  3999. }
  4000. };
  4001. // FIXME: should we move orphan() to dojo.html?
  4002. var NodeList = query.NodeList,
  4003. awc = NodeList._adaptWithCondition,
  4004. aafe = NodeList._adaptAsForEach,
  4005. aam = NodeList._adaptAsMap;
  4006. function getSet(module){
  4007. return function(node, name, value){
  4008. if(arguments.length == 2){
  4009. return module[typeof name == "string" ? "get" : "set"](node, name);
  4010. }
  4011. // setter
  4012. return module.set(node, name, value);
  4013. };
  4014. }
  4015. lang.extend(NodeList, {
  4016. _normalize: function(/*String||Element||Object||NodeList*/content, /*DOMNode?*/refNode){
  4017. // summary:
  4018. // normalizes data to an array of items to insert.
  4019. // description:
  4020. // If content is an object, it can have special properties "template" and
  4021. // "parse". If "template" is defined, then the template value is run through
  4022. // dojo.string.substitute (if dojo.string.substitute has been dojo.required elsewhere),
  4023. // or if templateFunc is a function on the content, that function will be used to
  4024. // transform the template into a final string to be used for for passing to dojo._toDom.
  4025. // If content.parse is true, then it is remembered for later, for when the content
  4026. // nodes are inserted into the DOM. At that point, the nodes will be parsed for widgets
  4027. // (if dojo.parser has been dojo.required elsewhere).
  4028. //Wanted to just use a DocumentFragment, but for the array/NodeList
  4029. //case that meant using cloneNode, but we may not want that.
  4030. //Cloning should only happen if the node operations span
  4031. //multiple refNodes. Also, need a real array, not a NodeList from the
  4032. //DOM since the node movements could change those NodeLists.
  4033. var parse = content.parse === true;
  4034. //Do we have an object that needs to be run through a template?
  4035. if(typeof content.template == "string"){
  4036. var templateFunc = content.templateFunc || (dojo.string && dojo.string.substitute);
  4037. content = templateFunc ? templateFunc(content.template, content) : content;
  4038. }
  4039. var type = (typeof content);
  4040. if(type == "string" || type == "number"){
  4041. content = domCtr.toDom(content, (refNode && refNode.ownerDocument));
  4042. if(content.nodeType == 11){
  4043. //DocumentFragment. It cannot handle cloneNode calls, so pull out the children.
  4044. content = lang._toArray(content.childNodes);
  4045. }else{
  4046. content = [content];
  4047. }
  4048. }else if(!lang.isArrayLike(content)){
  4049. content = [content];
  4050. }else if(!lang.isArray(content)){
  4051. //To get to this point, content is array-like, but
  4052. //not an array, which likely means a DOM NodeList. Convert it now.
  4053. content = lang._toArray(content);
  4054. }
  4055. //Pass around the parse info
  4056. if(parse){
  4057. content._runParse = true;
  4058. }
  4059. return content; //Array
  4060. },
  4061. _cloneNode: function(/*DOMNode*/ node){
  4062. // summary:
  4063. // private utility to clone a node. Not very interesting in the vanilla
  4064. // dojo.NodeList case, but delegates could do interesting things like
  4065. // clone event handlers if that is derivable from the node.
  4066. return node.cloneNode(true);
  4067. },
  4068. _place: function(/*Array*/ary, /*DOMNode*/refNode, /*String*/position, /*Boolean*/useClone){
  4069. // summary:
  4070. // private utility to handle placing an array of nodes relative to another node.
  4071. // description:
  4072. // Allows for cloning the nodes in the array, and for
  4073. // optionally parsing widgets, if ary._runParse is true.
  4074. //Avoid a disallowed operation if trying to do an innerHTML on a non-element node.
  4075. if(refNode.nodeType != 1 && position == "only"){
  4076. return;
  4077. }
  4078. var rNode = refNode, tempNode;
  4079. //Always cycle backwards in case the array is really a
  4080. //DOM NodeList and the DOM operations take it out of the live collection.
  4081. var length = ary.length;
  4082. for(var i = length - 1; i >= 0; i--){
  4083. var node = (useClone ? this._cloneNode(ary[i]) : ary[i]);
  4084. //If need widget parsing, use a temp node, instead of waiting after inserting into
  4085. //real DOM because we need to start widget parsing at one node up from current node,
  4086. //which could cause some already parsed widgets to be parsed again.
  4087. if(ary._runParse && dojo.parser && dojo.parser.parse){
  4088. if(!tempNode){
  4089. tempNode = rNode.ownerDocument.createElement("div");
  4090. }
  4091. tempNode.appendChild(node);
  4092. dojo.parser.parse(tempNode);
  4093. node = tempNode.firstChild;
  4094. while(tempNode.firstChild){
  4095. tempNode.removeChild(tempNode.firstChild);
  4096. }
  4097. }
  4098. if(i == length - 1){
  4099. domCtr.place(node, rNode, position);
  4100. }else{
  4101. rNode.parentNode.insertBefore(node, rNode);
  4102. }
  4103. rNode = node;
  4104. }
  4105. },
  4106. /*=====
  4107. position: function(){
  4108. // summary:
  4109. // Returns border-box objects (x/y/w/h) of all elements in a node list
  4110. // as an Array (*not* a NodeList). Acts like `dojo.position`, though
  4111. // assumes the node passed is each node in this list.
  4112. return dojo.map(this, dojo.position); // Array
  4113. },
  4114. attr: function(property, value){
  4115. // summary:
  4116. // gets or sets the DOM attribute for every element in the
  4117. // NodeList. See also `dojo.attr`
  4118. // property: String
  4119. // the attribute to get/set
  4120. // value: String?
  4121. // optional. The value to set the property to
  4122. // returns:
  4123. // if no value is passed, the result is an array of attribute values
  4124. // If a value is passed, the return is this NodeList
  4125. // example:
  4126. // Make all nodes with a particular class focusable:
  4127. // | dojo.query(".focusable").attr("tabIndex", -1);
  4128. // example:
  4129. // Disable a group of buttons:
  4130. // | dojo.query("button.group").attr("disabled", true);
  4131. // example:
  4132. // innerHTML can be assigned or retrieved as well:
  4133. // | // get the innerHTML (as an array) for each list item
  4134. // | var ih = dojo.query("li.replaceable").attr("innerHTML");
  4135. return; // dojo.NodeList
  4136. return; // Array
  4137. },
  4138. style: function(property, value){
  4139. // summary:
  4140. // gets or sets the CSS property for every element in the NodeList
  4141. // property: String
  4142. // the CSS property to get/set, in JavaScript notation
  4143. // ("lineHieght" instead of "line-height")
  4144. // value: String?
  4145. // optional. The value to set the property to
  4146. // returns:
  4147. // if no value is passed, the result is an array of strings.
  4148. // If a value is passed, the return is this NodeList
  4149. return; // dojo.NodeList
  4150. return; // Array
  4151. },
  4152. addClass: function(className){
  4153. // summary:
  4154. // adds the specified class to every node in the list
  4155. // className: String|Array
  4156. // A String class name to add, or several space-separated class names,
  4157. // or an array of class names.
  4158. return; // dojo.NodeList
  4159. },
  4160. removeClass: function(className){
  4161. // summary:
  4162. // removes the specified class from every node in the list
  4163. // className: String|Array?
  4164. // An optional String class name to remove, or several space-separated
  4165. // class names, or an array of class names. If omitted, all class names
  4166. // will be deleted.
  4167. // returns:
  4168. // dojo.NodeList, this list
  4169. return; // dojo.NodeList
  4170. },
  4171. toggleClass: function(className, condition){
  4172. // summary:
  4173. // Adds a class to node if not present, or removes if present.
  4174. // Pass a boolean condition if you want to explicitly add or remove.
  4175. // condition: Boolean?
  4176. // If passed, true means to add the class, false means to remove.
  4177. // className: String
  4178. // the CSS class to add
  4179. return; // dojo.NodeList
  4180. },
  4181. empty: function(){
  4182. // summary:
  4183. // clears all content from each node in the list. Effectively
  4184. // equivalent to removing all child nodes from every item in
  4185. // the list.
  4186. return this.forEach("item.innerHTML='';"); // dojo.NodeList
  4187. // FIXME: should we be checking for and/or disposing of widgets below these nodes?
  4188. },
  4189. =====*/
  4190. // useful html methods
  4191. attr: awc(getSet(domAttr), magicGuard),
  4192. style: awc(getSet(domStyle), magicGuard),
  4193. addClass: aafe(domCls.add),
  4194. removeClass: aafe(domCls.remove),
  4195. replaceClass: aafe(domCls.replace),
  4196. toggleClass: aafe(domCls.toggle),
  4197. empty: aafe(domCtr.empty),
  4198. removeAttr: aafe(domAttr.remove),
  4199. position: aam(domGeom.position),
  4200. marginBox: aam(domGeom.getMarginBox),
  4201. // FIXME: connectPublisher()? connectRunOnce()?
  4202. /*
  4203. destroy: function(){
  4204. // summary:
  4205. // destroys every item in the list.
  4206. this.forEach(d.destroy);
  4207. // FIXME: should we be checking for and/or disposing of widgets below these nodes?
  4208. },
  4209. */
  4210. place: function(/*String||Node*/ queryOrNode, /*String*/ position){
  4211. // summary:
  4212. // places elements of this node list relative to the first element matched
  4213. // by queryOrNode. Returns the original NodeList. See: `dojo.place`
  4214. // queryOrNode:
  4215. // may be a string representing any valid CSS3 selector or a DOM node.
  4216. // In the selector case, only the first matching element will be used
  4217. // for relative positioning.
  4218. // position:
  4219. // can be one of:
  4220. // | "last" (default)
  4221. // | "first"
  4222. // | "before"
  4223. // | "after"
  4224. // | "only"
  4225. // | "replace"
  4226. // or an offset in the childNodes property
  4227. var item = query(queryOrNode)[0];
  4228. return this.forEach(function(node){ domCtr.place(node, item, position); }); // dojo.NodeList
  4229. },
  4230. orphan: function(/*String?*/ filter){
  4231. // summary:
  4232. // removes elements in this list that match the filter
  4233. // from their parents and returns them as a new NodeList.
  4234. // filter:
  4235. // CSS selector like ".foo" or "div > span"
  4236. // returns:
  4237. // `dojo.NodeList` containing the orphaned elements
  4238. return (filter ? query._filterResult(this, filter) : this).forEach(orphan); // dojo.NodeList
  4239. },
  4240. adopt: function(/*String||Array||DomNode*/ queryOrListOrNode, /*String?*/ position){
  4241. // summary:
  4242. // places any/all elements in queryOrListOrNode at a
  4243. // position relative to the first element in this list.
  4244. // Returns a dojo.NodeList of the adopted elements.
  4245. // queryOrListOrNode:
  4246. // a DOM node or a query string or a query result.
  4247. // Represents the nodes to be adopted relative to the
  4248. // first element of this NodeList.
  4249. // position:
  4250. // can be one of:
  4251. // | "last" (default)
  4252. // | "first"
  4253. // | "before"
  4254. // | "after"
  4255. // | "only"
  4256. // | "replace"
  4257. // or an offset in the childNodes property
  4258. return query(queryOrListOrNode).place(this[0], position)._stash(this); // dojo.NodeList
  4259. },
  4260. // FIXME: do we need this?
  4261. query: function(/*String*/ queryStr){
  4262. // summary:
  4263. // Returns a new list whose members match the passed query,
  4264. // assuming elements of the current NodeList as the root for
  4265. // each search.
  4266. // example:
  4267. // assume a DOM created by this markup:
  4268. // | <div id="foo">
  4269. // | <p>
  4270. // | bacon is tasty, <span>dontcha think?</span>
  4271. // | </p>
  4272. // | </div>
  4273. // | <div id="bar">
  4274. // | <p>great comedians may not be funny <span>in person</span></p>
  4275. // | </div>
  4276. // If we are presented with the following definition for a NodeList:
  4277. // | var l = new dojo.NodeList(dojo.byId("foo"), dojo.byId("bar"));
  4278. // it's possible to find all span elements under paragraphs
  4279. // contained by these elements with this sub-query:
  4280. // | var spans = l.query("p span");
  4281. // FIXME: probably slow
  4282. if(!queryStr){ return this; }
  4283. var ret = new NodeList;
  4284. this.map(function(node){
  4285. // FIXME: why would we ever get undefined here?
  4286. query(queryStr, node).forEach(function(subNode){
  4287. if(subNode !== undefined){
  4288. ret.push(subNode);
  4289. }
  4290. });
  4291. });
  4292. return ret._stash(this); // dojo.NodeList
  4293. },
  4294. filter: function(/*String|Function*/ filter){
  4295. // summary:
  4296. // "masks" the built-in javascript filter() method (supported
  4297. // in Dojo via `dojo.filter`) to support passing a simple
  4298. // string filter in addition to supporting filtering function
  4299. // objects.
  4300. // filter:
  4301. // If a string, a CSS rule like ".thinger" or "div > span".
  4302. // example:
  4303. // "regular" JS filter syntax as exposed in dojo.filter:
  4304. // | dojo.query("*").filter(function(item){
  4305. // | // highlight every paragraph
  4306. // | return (item.nodeName == "p");
  4307. // | }).style("backgroundColor", "yellow");
  4308. // example:
  4309. // the same filtering using a CSS selector
  4310. // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
  4311. var a = arguments, items = this, start = 0;
  4312. if(typeof filter == "string"){ // inline'd type check
  4313. items = query._filterResult(this, a[0]);
  4314. if(a.length == 1){
  4315. // if we only got a string query, pass back the filtered results
  4316. return items._stash(this); // dojo.NodeList
  4317. }
  4318. // if we got a callback, run it over the filtered items
  4319. start = 1;
  4320. }
  4321. return this._wrap(array.filter(items, a[start], a[start + 1]), this); // dojo.NodeList
  4322. },
  4323. /*
  4324. // FIXME: should this be "copyTo" and include parenting info?
  4325. clone: function(){
  4326. // summary:
  4327. // creates node clones of each element of this list
  4328. // and returns a new list containing the clones
  4329. },
  4330. */
  4331. addContent: function(/*String||DomNode||Object||dojo.NodeList*/ content, /*String||Integer?*/ position){
  4332. // summary:
  4333. // add a node, NodeList or some HTML as a string to every item in the
  4334. // list. Returns the original list.
  4335. // description:
  4336. // a copy of the HTML content is added to each item in the
  4337. // list, with an optional position argument. If no position
  4338. // argument is provided, the content is appended to the end of
  4339. // each item.
  4340. // content:
  4341. // DOM node, HTML in string format, a NodeList or an Object. If a DOM node or
  4342. // NodeList, the content will be cloned if the current NodeList has more than one
  4343. // element. Only the DOM nodes are cloned, no event handlers. If it is an Object,
  4344. // it should be an object with at "template" String property that has the HTML string
  4345. // to insert. If dojo.string has already been dojo.required, then dojo.string.substitute
  4346. // will be used on the "template" to generate the final HTML string. Other allowed
  4347. // properties on the object are: "parse" if the HTML
  4348. // string should be parsed for widgets (dojo.require("dojo.parser") to get that
  4349. // option to work), and "templateFunc" if a template function besides dojo.string.substitute
  4350. // should be used to transform the "template".
  4351. // position:
  4352. // can be one of:
  4353. // | "last"||"end" (default)
  4354. // | "first||"start"
  4355. // | "before"
  4356. // | "after"
  4357. // | "replace" (replaces nodes in this NodeList with new content)
  4358. // | "only" (removes other children of the nodes so new content is the only child)
  4359. // or an offset in the childNodes property
  4360. // example:
  4361. // appends content to the end if the position is omitted
  4362. // | dojo.query("h3 > p").addContent("hey there!");
  4363. // example:
  4364. // add something to the front of each element that has a
  4365. // "thinger" property:
  4366. // | dojo.query("[thinger]").addContent("...", "first");
  4367. // example:
  4368. // adds a header before each element of the list
  4369. // | dojo.query(".note").addContent("<h4>NOTE:</h4>", "before");
  4370. // example:
  4371. // add a clone of a DOM node to the end of every element in
  4372. // the list, removing it from its existing parent.
  4373. // | dojo.query(".note").addContent(dojo.byId("foo"));
  4374. // example:
  4375. // Append nodes from a templatized string.
  4376. // dojo.require("dojo.string");
  4377. // dojo.query(".note").addContent({
  4378. // template: '<b>${id}: </b><span>${name}</span>',
  4379. // id: "user332",
  4380. // name: "Mr. Anderson"
  4381. // });
  4382. // example:
  4383. // Append nodes from a templatized string that also has widgets parsed.
  4384. // dojo.require("dojo.string");
  4385. // dojo.require("dojo.parser");
  4386. // var notes = dojo.query(".note").addContent({
  4387. // template: '<button dojoType="dijit.form.Button">${text}</button>',
  4388. // parse: true,
  4389. // text: "Send"
  4390. // });
  4391. content = this._normalize(content, this[0]);
  4392. for(var i = 0, node; (node = this[i]); i++){
  4393. this._place(content, node, position, i > 0);
  4394. }
  4395. return this; //dojo.NodeList
  4396. }
  4397. });
  4398. /*===== return dojo.NodeList; =====*/
  4399. return NodeList;
  4400. });
  4401. },
  4402. 'dojo/query':function(){
  4403. define(["./_base/kernel", "./has", "./dom", "./on", "./_base/array", "./_base/lang", "./selector/_loader", "./selector/_loader!default"],
  4404. function(dojo, has, dom, on, array, lang, loader, defaultEngine){
  4405. "use strict";
  4406. has.add("array-extensible", function(){
  4407. // test to see if we can extend an array (not supported in old IE)
  4408. return lang.delegate([], {length: 1}).length == 1 && !has("bug-for-in-skips-shadowed");
  4409. });
  4410. var ap = Array.prototype, aps = ap.slice, apc = ap.concat, forEach = array.forEach;
  4411. var tnl = function(/*Array*/ a, /*dojo.NodeList?*/ parent, /*Function?*/ NodeListCtor){
  4412. // summary:
  4413. // decorate an array to make it look like a `dojo.NodeList`.
  4414. // a:
  4415. // Array of nodes to decorate.
  4416. // parent:
  4417. // An optional parent NodeList that generated the current
  4418. // list of nodes. Used to call _stash() so the parent NodeList
  4419. // can be accessed via end() later.
  4420. // NodeListCtor:
  4421. // An optional constructor function to use for any
  4422. // new NodeList calls. This allows a certain chain of
  4423. // NodeList calls to use a different object than dojo.NodeList.
  4424. var nodeList = new (NodeListCtor || this._NodeListCtor || nl)(a);
  4425. return parent ? nodeList._stash(parent) : nodeList;
  4426. };
  4427. var loopBody = function(f, a, o){
  4428. a = [0].concat(aps.call(a, 0));
  4429. o = o || dojo.global;
  4430. return function(node){
  4431. a[0] = node;
  4432. return f.apply(o, a);
  4433. };
  4434. };
  4435. // adapters
  4436. var adaptAsForEach = function(f, o){
  4437. // summary:
  4438. // adapts a single node function to be used in the forEach-type
  4439. // actions. The initial object is returned from the specialized
  4440. // function.
  4441. // f: Function
  4442. // a function to adapt
  4443. // o: Object?
  4444. // an optional context for f
  4445. return function(){
  4446. this.forEach(loopBody(f, arguments, o));
  4447. return this; // Object
  4448. };
  4449. };
  4450. var adaptAsMap = function(f, o){
  4451. // summary:
  4452. // adapts a single node function to be used in the map-type
  4453. // actions. The return is a new array of values, as via `dojo.map`
  4454. // f: Function
  4455. // a function to adapt
  4456. // o: Object?
  4457. // an optional context for f
  4458. return function(){
  4459. return this.map(loopBody(f, arguments, o));
  4460. };
  4461. };
  4462. var adaptAsFilter = function(f, o){
  4463. // summary:
  4464. // adapts a single node function to be used in the filter-type actions
  4465. // f: Function
  4466. // a function to adapt
  4467. // o: Object?
  4468. // an optional context for f
  4469. return function(){
  4470. return this.filter(loopBody(f, arguments, o));
  4471. };
  4472. };
  4473. var adaptWithCondition = function(f, g, o){
  4474. // summary:
  4475. // adapts a single node function to be used in the map-type
  4476. // actions, behaves like forEach() or map() depending on arguments
  4477. // f: Function
  4478. // a function to adapt
  4479. // g: Function
  4480. // a condition function, if true runs as map(), otherwise runs as forEach()
  4481. // o: Object?
  4482. // an optional context for f and g
  4483. return function(){
  4484. var a = arguments, body = loopBody(f, a, o);
  4485. if(g.call(o || dojo.global, a)){
  4486. return this.map(body); // self
  4487. }
  4488. this.forEach(body);
  4489. return this; // self
  4490. };
  4491. };
  4492. var NodeList = function(array){
  4493. // summary:
  4494. // dojo.NodeList is an of Array-like object which adds syntactic
  4495. // sugar for chaining, common iteration operations, animation, and
  4496. // node manipulation. NodeLists are most often returned as the
  4497. // result of dojo.query() calls.
  4498. // description:
  4499. // dojo.NodeList instances provide many utilities that reflect
  4500. // core Dojo APIs for Array iteration and manipulation, DOM
  4501. // manipulation, and event handling. Instead of needing to dig up
  4502. // functions in the dojo.* namespace, NodeLists generally make the
  4503. // full power of Dojo available for DOM manipulation tasks in a
  4504. // simple, chainable way.
  4505. // example:
  4506. // create a node list from a node
  4507. // | new dojo.NodeList(dojo.byId("foo"));
  4508. // example:
  4509. // get a NodeList from a CSS query and iterate on it
  4510. // | var l = dojo.query(".thinger");
  4511. // | l.forEach(function(node, index, nodeList){
  4512. // | console.log(index, node.innerHTML);
  4513. // | });
  4514. // example:
  4515. // use native and Dojo-provided array methods to manipulate a
  4516. // NodeList without needing to use dojo.* functions explicitly:
  4517. // | var l = dojo.query(".thinger");
  4518. // | // since NodeLists are real arrays, they have a length
  4519. // | // property that is both readable and writable and
  4520. // | // push/pop/shift/unshift methods
  4521. // | console.log(l.length);
  4522. // | l.push(dojo.create("span"));
  4523. // |
  4524. // | // dojo's normalized array methods work too:
  4525. // | console.log( l.indexOf(dojo.byId("foo")) );
  4526. // | // ...including the special "function as string" shorthand
  4527. // | console.log( l.every("item.nodeType == 1") );
  4528. // |
  4529. // | // NodeLists can be [..] indexed, or you can use the at()
  4530. // | // function to get specific items wrapped in a new NodeList:
  4531. // | var node = l[3]; // the 4th element
  4532. // | var newList = l.at(1, 3); // the 2nd and 4th elements
  4533. // example:
  4534. // the style functions you expect are all there too:
  4535. // | // style() as a getter...
  4536. // | var borders = dojo.query(".thinger").style("border");
  4537. // | // ...and as a setter:
  4538. // | dojo.query(".thinger").style("border", "1px solid black");
  4539. // | // class manipulation
  4540. // | dojo.query("li:nth-child(even)").addClass("even");
  4541. // | // even getting the coordinates of all the items
  4542. // | var coords = dojo.query(".thinger").coords();
  4543. // example:
  4544. // DOM manipulation functions from the dojo.* namespace area also
  4545. // available:
  4546. // | // remove all of the elements in the list from their
  4547. // | // parents (akin to "deleting" them from the document)
  4548. // | dojo.query(".thinger").orphan();
  4549. // | // place all elements in the list at the front of #foo
  4550. // | dojo.query(".thinger").place("foo", "first");
  4551. // example:
  4552. // Event handling couldn't be easier. `dojo.connect` is mapped in,
  4553. // and shortcut handlers are provided for most DOM events:
  4554. // | // like dojo.connect(), but with implicit scope
  4555. // | dojo.query("li").connect("onclick", console, "log");
  4556. // |
  4557. // | // many common event handlers are already available directly:
  4558. // | dojo.query("li").onclick(console, "log");
  4559. // | var toggleHovered = dojo.hitch(dojo, "toggleClass", "hovered");
  4560. // | dojo.query("p")
  4561. // | .onmouseenter(toggleHovered)
  4562. // | .onmouseleave(toggleHovered);
  4563. // example:
  4564. // chainability is a key advantage of NodeLists:
  4565. // | dojo.query(".thinger")
  4566. // | .onclick(function(e){ /* ... */ })
  4567. // | .at(1, 3, 8) // get a subset
  4568. // | .style("padding", "5px")
  4569. // | .forEach(console.log);
  4570. var isNew = this instanceof nl && has("array-extensible");
  4571. if(typeof array == "number"){
  4572. array = Array(array);
  4573. }
  4574. var nodeArray = (array && "length" in array) ? array : arguments;
  4575. if(isNew || !nodeArray.sort){
  4576. // make sure it's a real array before we pass it on to be wrapped
  4577. var target = isNew ? this : [],
  4578. l = target.length = nodeArray.length;
  4579. for(var i = 0; i < l; i++){
  4580. target[i] = nodeArray[i];
  4581. }
  4582. if(isNew){
  4583. // called with new operator, this means we are going to use this instance and push
  4584. // the nodes on to it. This is usually much faster since the NodeList properties
  4585. // don't need to be copied (unless the list of nodes is extremely large).
  4586. return target;
  4587. }
  4588. nodeArray = target;
  4589. }
  4590. // called without new operator, use a real array and copy prototype properties,
  4591. // this is slower and exists for back-compat. Should be removed in 2.0.
  4592. lang._mixin(nodeArray, nlp);
  4593. nodeArray._NodeListCtor = function(array){
  4594. // call without new operator to preserve back-compat behavior
  4595. return nl(array);
  4596. };
  4597. return nodeArray;
  4598. };
  4599. var nl = NodeList, nlp = nl.prototype =
  4600. has("array-extensible") ? [] : {};// extend an array if it is extensible
  4601. // expose adapters and the wrapper as private functions
  4602. nl._wrap = nlp._wrap = tnl;
  4603. nl._adaptAsMap = adaptAsMap;
  4604. nl._adaptAsForEach = adaptAsForEach;
  4605. nl._adaptAsFilter = adaptAsFilter;
  4606. nl._adaptWithCondition = adaptWithCondition;
  4607. // mass assignment
  4608. // add array redirectors
  4609. forEach(["slice", "splice"], function(name){
  4610. var f = ap[name];
  4611. //Use a copy of the this array via this.slice() to allow .end() to work right in the splice case.
  4612. // CANNOT apply ._stash()/end() to splice since it currently modifies
  4613. // the existing this array -- it would break backward compatibility if we copy the array before
  4614. // the splice so that we can use .end(). So only doing the stash option to this._wrap for slice.
  4615. nlp[name] = function(){ return this._wrap(f.apply(this, arguments), name == "slice" ? this : null); };
  4616. });
  4617. // concat should be here but some browsers with native NodeList have problems with it
  4618. // add array.js redirectors
  4619. forEach(["indexOf", "lastIndexOf", "every", "some"], function(name){
  4620. var f = array[name];
  4621. nlp[name] = function(){ return f.apply(dojo, [this].concat(aps.call(arguments, 0))); };
  4622. });
  4623. /*===== var NodeList = dojo.NodeList; =====*/
  4624. lang.extend(NodeList, {
  4625. // copy the constructors
  4626. constructor: nl,
  4627. _NodeListCtor: nl,
  4628. toString: function(){
  4629. // Array.prototype.toString can't be applied to objects, so we use join
  4630. return this.join(",");
  4631. },
  4632. _stash: function(parent){
  4633. // summary:
  4634. // private function to hold to a parent NodeList. end() to return the parent NodeList.
  4635. //
  4636. // example:
  4637. // How to make a `dojo.NodeList` method that only returns the third node in
  4638. // the dojo.NodeList but allows access to the original NodeList by using this._stash:
  4639. // | dojo.extend(dojo.NodeList, {
  4640. // | third: function(){
  4641. // | var newNodeList = dojo.NodeList(this[2]);
  4642. // | return newNodeList._stash(this);
  4643. // | }
  4644. // | });
  4645. // | // then see how _stash applies a sub-list, to be .end()'ed out of
  4646. // | dojo.query(".foo")
  4647. // | .third()
  4648. // | .addClass("thirdFoo")
  4649. // | .end()
  4650. // | // access to the orig .foo list
  4651. // | .removeClass("foo")
  4652. // |
  4653. //
  4654. this._parent = parent;
  4655. return this; //dojo.NodeList
  4656. },
  4657. on: function(eventName, listener){
  4658. // summary:
  4659. // Listen for events on the nodes in the NodeList. Basic usage is:
  4660. // | query(".my-class").on("click", listener);
  4661. // This supports event delegation by using selectors as the first argument with the event names as
  4662. // pseudo selectors. For example:
  4663. // | dojo.query("#my-list").on("li:click", listener);
  4664. // This will listen for click events within <li> elements that are inside the #my-list element.
  4665. // Because on supports CSS selector syntax, we can use comma-delimited events as well:
  4666. // | dojo.query("#my-list").on("li button:mouseover, li:click", listener);
  4667. var handles = this.map(function(node){
  4668. return on(node, eventName, listener); // TODO: apply to the NodeList so the same selector engine is used for matches
  4669. });
  4670. handles.remove = function(){
  4671. for(var i = 0; i < handles.length; i++){
  4672. handles[i].remove();
  4673. }
  4674. };
  4675. return handles;
  4676. },
  4677. end: function(){
  4678. // summary:
  4679. // Ends use of the current `dojo.NodeList` by returning the previous dojo.NodeList
  4680. // that generated the current dojo.NodeList.
  4681. // description:
  4682. // Returns the `dojo.NodeList` that generated the current `dojo.NodeList`. If there
  4683. // is no parent dojo.NodeList, an empty dojo.NodeList is returned.
  4684. // example:
  4685. // | dojo.query("a")
  4686. // | .filter(".disabled")
  4687. // | // operate on the anchors that only have a disabled class
  4688. // | .style("color", "grey")
  4689. // | .end()
  4690. // | // jump back to the list of anchors
  4691. // | .style(...)
  4692. //
  4693. if(this._parent){
  4694. return this._parent;
  4695. }else{
  4696. //Just return empty list.
  4697. return new this._NodeListCtor(0);
  4698. }
  4699. },
  4700. // http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array#Methods
  4701. // FIXME: handle return values for #3244
  4702. // http://trac.dojotoolkit.org/ticket/3244
  4703. // FIXME:
  4704. // need to wrap or implement:
  4705. // join (perhaps w/ innerHTML/outerHTML overload for toString() of items?)
  4706. // reduce
  4707. // reduceRight
  4708. /*=====
  4709. slice: function(begin, end){
  4710. // summary:
  4711. // Returns a new NodeList, maintaining this one in place
  4712. // description:
  4713. // This method behaves exactly like the Array.slice method
  4714. // with the caveat that it returns a dojo.NodeList and not a
  4715. // raw Array. For more details, see Mozilla's (slice
  4716. // documentation)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:slice]
  4717. // begin: Integer
  4718. // Can be a positive or negative integer, with positive
  4719. // integers noting the offset to begin at, and negative
  4720. // integers denoting an offset from the end (i.e., to the left
  4721. // of the end)
  4722. // end: Integer?
  4723. // Optional parameter to describe what position relative to
  4724. // the NodeList's zero index to end the slice at. Like begin,
  4725. // can be positive or negative.
  4726. return this._wrap(a.slice.apply(this, arguments));
  4727. },
  4728. splice: function(index, howmany, item){
  4729. // summary:
  4730. // Returns a new NodeList, manipulating this NodeList based on
  4731. // the arguments passed, potentially splicing in new elements
  4732. // at an offset, optionally deleting elements
  4733. // description:
  4734. // This method behaves exactly like the Array.splice method
  4735. // with the caveat that it returns a dojo.NodeList and not a
  4736. // raw Array. For more details, see Mozilla's (splice
  4737. // documentation)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:splice]
  4738. // For backwards compatibility, calling .end() on the spliced NodeList
  4739. // does not return the original NodeList -- splice alters the NodeList in place.
  4740. // index: Integer
  4741. // begin can be a positive or negative integer, with positive
  4742. // integers noting the offset to begin at, and negative
  4743. // integers denoting an offset from the end (i.e., to the left
  4744. // of the end)
  4745. // howmany: Integer?
  4746. // Optional parameter to describe what position relative to
  4747. // the NodeList's zero index to end the slice at. Like begin,
  4748. // can be positive or negative.
  4749. // item: Object...?
  4750. // Any number of optional parameters may be passed in to be
  4751. // spliced into the NodeList
  4752. // returns:
  4753. // dojo.NodeList
  4754. return this._wrap(a.splice.apply(this, arguments));
  4755. },
  4756. indexOf: function(value, fromIndex){
  4757. // summary:
  4758. // see dojo.indexOf(). The primary difference is that the acted-on
  4759. // array is implicitly this NodeList
  4760. // value: Object:
  4761. // The value to search for.
  4762. // fromIndex: Integer?:
  4763. // The location to start searching from. Optional. Defaults to 0.
  4764. // description:
  4765. // For more details on the behavior of indexOf, see Mozilla's
  4766. // (indexOf
  4767. // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf]
  4768. // returns:
  4769. // Positive Integer or 0 for a match, -1 of not found.
  4770. return d.indexOf(this, value, fromIndex); // Integer
  4771. },
  4772. lastIndexOf: function(value, fromIndex){
  4773. // summary:
  4774. // see dojo.lastIndexOf(). The primary difference is that the
  4775. // acted-on array is implicitly this NodeList
  4776. // description:
  4777. // For more details on the behavior of lastIndexOf, see
  4778. // Mozilla's (lastIndexOf
  4779. // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:lastIndexOf]
  4780. // value: Object
  4781. // The value to search for.
  4782. // fromIndex: Integer?
  4783. // The location to start searching from. Optional. Defaults to 0.
  4784. // returns:
  4785. // Positive Integer or 0 for a match, -1 of not found.
  4786. return d.lastIndexOf(this, value, fromIndex); // Integer
  4787. },
  4788. every: function(callback, thisObject){
  4789. // summary:
  4790. // see `dojo.every()` and the (Array.every
  4791. // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:every].
  4792. // Takes the same structure of arguments and returns as
  4793. // dojo.every() with the caveat that the passed array is
  4794. // implicitly this NodeList
  4795. // callback: Function: the callback
  4796. // thisObject: Object?: the context
  4797. return d.every(this, callback, thisObject); // Boolean
  4798. },
  4799. some: function(callback, thisObject){
  4800. // summary:
  4801. // Takes the same structure of arguments and returns as
  4802. // `dojo.some()` with the caveat that the passed array is
  4803. // implicitly this NodeList. See `dojo.some()` and Mozilla's
  4804. // (Array.some
  4805. // documentation)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:some].
  4806. // callback: Function: the callback
  4807. // thisObject: Object?: the context
  4808. return d.some(this, callback, thisObject); // Boolean
  4809. },
  4810. =====*/
  4811. concat: function(item){
  4812. // summary:
  4813. // Returns a new NodeList comprised of items in this NodeList
  4814. // as well as items passed in as parameters
  4815. // description:
  4816. // This method behaves exactly like the Array.concat method
  4817. // with the caveat that it returns a `dojo.NodeList` and not a
  4818. // raw Array. For more details, see the (Array.concat
  4819. // docs)[http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:concat]
  4820. // item: Object?
  4821. // Any number of optional parameters may be passed in to be
  4822. // spliced into the NodeList
  4823. // returns:
  4824. // dojo.NodeList
  4825. //return this._wrap(apc.apply(this, arguments));
  4826. // the line above won't work for the native NodeList :-(
  4827. // implementation notes:
  4828. // 1) Native NodeList is not an array, and cannot be used directly
  4829. // in concat() --- the latter doesn't recognize it as an array, and
  4830. // does not inline it, but append as a single entity.
  4831. // 2) On some browsers (e.g., Safari) the "constructor" property is
  4832. // read-only and cannot be changed. So we have to test for both
  4833. // native NodeList and dojo.NodeList in this property to recognize
  4834. // the node list.
  4835. var t = lang.isArray(this) ? this : aps.call(this, 0),
  4836. m = array.map(arguments, function(a){
  4837. return a && !lang.isArray(a) &&
  4838. (typeof NodeList != "undefined" && a.constructor === NodeList || a.constructor === this._NodeListCtor) ?
  4839. aps.call(a, 0) : a;
  4840. });
  4841. return this._wrap(apc.apply(t, m), this); // dojo.NodeList
  4842. },
  4843. map: function(/*Function*/ func, /*Function?*/ obj){
  4844. // summary:
  4845. // see dojo.map(). The primary difference is that the acted-on
  4846. // array is implicitly this NodeList and the return is a
  4847. // dojo.NodeList (a subclass of Array)
  4848. ///return d.map(this, func, obj, d.NodeList); // dojo.NodeList
  4849. return this._wrap(array.map(this, func, obj), this); // dojo.NodeList
  4850. },
  4851. forEach: function(callback, thisObj){
  4852. // summary:
  4853. // see `dojo.forEach()`. The primary difference is that the acted-on
  4854. // array is implicitly this NodeList. If you want the option to break out
  4855. // of the forEach loop, use every() or some() instead.
  4856. forEach(this, callback, thisObj);
  4857. // non-standard return to allow easier chaining
  4858. return this; // dojo.NodeList
  4859. },
  4860. filter: function(/*String|Function*/ filter){
  4861. // summary:
  4862. // "masks" the built-in javascript filter() method (supported
  4863. // in Dojo via `dojo.filter`) to support passing a simple
  4864. // string filter in addition to supporting filtering function
  4865. // objects.
  4866. // filter:
  4867. // If a string, a CSS rule like ".thinger" or "div > span".
  4868. // example:
  4869. // "regular" JS filter syntax as exposed in dojo.filter:
  4870. // | dojo.query("*").filter(function(item){
  4871. // | // highlight every paragraph
  4872. // | return (item.nodeName == "p");
  4873. // | }).style("backgroundColor", "yellow");
  4874. // example:
  4875. // the same filtering using a CSS selector
  4876. // | dojo.query("*").filter("p").styles("backgroundColor", "yellow");
  4877. var a = arguments, items = this, start = 0;
  4878. if(typeof filter == "string"){ // inline'd type check
  4879. items = query._filterResult(this, a[0]);
  4880. if(a.length == 1){
  4881. // if we only got a string query, pass back the filtered results
  4882. return items._stash(this); // dojo.NodeList
  4883. }
  4884. // if we got a callback, run it over the filtered items
  4885. start = 1;
  4886. }
  4887. return this._wrap(array.filter(items, a[start], a[start + 1]), this); // dojo.NodeList
  4888. },
  4889. instantiate: function(/*String|Object*/ declaredClass, /*Object?*/ properties){
  4890. // summary:
  4891. // Create a new instance of a specified class, using the
  4892. // specified properties and each node in the nodeList as a
  4893. // srcNodeRef.
  4894. // example:
  4895. // Grabs all buttons in the page and converts them to diji.form.Buttons.
  4896. // | var buttons = dojo.query("button").instantiate("dijit.form.Button", {showLabel: true});
  4897. var c = lang.isFunction(declaredClass) ? declaredClass : lang.getObject(declaredClass);
  4898. properties = properties || {};
  4899. return this.forEach(function(node){
  4900. new c(properties, node);
  4901. }); // dojo.NodeList
  4902. },
  4903. at: function(/*===== index =====*/){
  4904. // summary:
  4905. // Returns a new NodeList comprised of items in this NodeList
  4906. // at the given index or indices.
  4907. //
  4908. // index: Integer...
  4909. // One or more 0-based indices of items in the current
  4910. // NodeList. A negative index will start at the end of the
  4911. // list and go backwards.
  4912. //
  4913. // example:
  4914. // Shorten the list to the first, second, and third elements
  4915. // | dojo.query("a").at(0, 1, 2).forEach(fn);
  4916. //
  4917. // example:
  4918. // Retrieve the first and last elements of a unordered list:
  4919. // | dojo.query("ul > li").at(0, -1).forEach(cb);
  4920. //
  4921. // example:
  4922. // Do something for the first element only, but end() out back to
  4923. // the original list and continue chaining:
  4924. // | dojo.query("a").at(0).onclick(fn).end().forEach(function(n){
  4925. // | console.log(n); // all anchors on the page.
  4926. // | })
  4927. //
  4928. // returns:
  4929. // dojo.NodeList
  4930. var t = new this._NodeListCtor(0);
  4931. forEach(arguments, function(i){
  4932. if(i < 0){ i = this.length + i; }
  4933. if(this[i]){ t.push(this[i]); }
  4934. }, this);
  4935. return t._stash(this); // dojo.NodeList
  4936. }
  4937. });
  4938. /*=====
  4939. dojo.query = function(selector, context){
  4940. // summary:
  4941. // This modules provides DOM querying functionality. The module export is a function
  4942. // that can be used to query for DOM nodes by CSS selector and returns a dojo.NodeList
  4943. // representing the matching nodes.
  4944. //
  4945. // selector: String
  4946. // A CSS selector to search for.
  4947. // context: String|DomNode?
  4948. // An optional context to limit the searching scope. Only nodes under `context` will be
  4949. // scanned.
  4950. //
  4951. // example:
  4952. // add an onclick handler to every submit button in the document
  4953. // which causes the form to be sent via Ajax instead:
  4954. // | define(["dojo/query"], function(query){
  4955. // | query("input[type='submit']").on("click", function(e){
  4956. // | dojo.stopEvent(e); // prevent sending the form
  4957. // | var btn = e.target;
  4958. // | dojo.xhrPost({
  4959. // | form: btn.form,
  4960. // | load: function(data){
  4961. // | // replace the form with the response
  4962. // | var div = dojo.doc.createElement("div");
  4963. // | dojo.place(div, btn.form, "after");
  4964. // | div.innerHTML = data;
  4965. // | dojo.style(btn.form, "display", "none");
  4966. // | }
  4967. // | });
  4968. // | });
  4969. //
  4970. // description:
  4971. // dojo/query is responsible for loading the appropriate query engine and wrapping
  4972. // its results with a `dojo.NodeList`. You can use dojo/query with a specific selector engine
  4973. // by using it as a plugin. For example, if you installed the sizzle package, you could
  4974. // use it as the selector engine with:
  4975. // | define("dojo/query!sizzle", function(query){
  4976. // | query("div")...
  4977. //
  4978. // The id after the ! can be a module id of the selector engine or one of the following values:
  4979. // | + acme: This is the default engine used by Dojo base, and will ensure that the full
  4980. // | Acme engine is always loaded.
  4981. // |
  4982. // | + css2: If the browser has a native selector engine, this will be used, otherwise a
  4983. // | very minimal lightweight selector engine will be loaded that can do simple CSS2 selectors
  4984. // | (by #id, .class, tag, and [name=value] attributes, with standard child or descendant (>)
  4985. // | operators) and nothing more.
  4986. // |
  4987. // | + css2.1: If the browser has a native selector engine, this will be used, otherwise the
  4988. // | full Acme engine will be loaded.
  4989. // |
  4990. // | + css3: If the browser has a native selector engine with support for CSS3 pseudo
  4991. // | selectors (most modern browsers except IE8), this will be used, otherwise the
  4992. // | full Acme engine will be loaded.
  4993. // |
  4994. // | + Or the module id of a selector engine can be used to explicitly choose the selector engine
  4995. //
  4996. // For example, if you are using CSS3 pseudo selectors in module, you can specify that
  4997. // you will need support them with:
  4998. // | define("dojo/query!css3", function(query){
  4999. // | query('#t > h3:nth-child(odd)')...
  5000. //
  5001. // You can also choose the selector engine/load configuration by setting the <FIXME:what is the configuration setting?>.
  5002. // For example:
  5003. // | <script data-dojo-config="query-selector:'css3'" src="dojo.js"></script>
  5004. //
  5005. return new dojo.NodeList(); // dojo.NodeList
  5006. };
  5007. =====*/
  5008. function queryForEngine(engine, NodeList){
  5009. var query = function(/*String*/ query, /*String|DOMNode?*/ root){
  5010. // summary:
  5011. // Returns nodes which match the given CSS selector, searching the
  5012. // entire document by default but optionally taking a node to scope
  5013. // the search by. Returns an instance of dojo.NodeList.
  5014. if(typeof root == "string"){
  5015. root = dom.byId(root);
  5016. if(!root){
  5017. return new NodeList([]);
  5018. }
  5019. }
  5020. var results = typeof query == "string" ? engine(query, root) : query ? query.orphan ? query : [query] : [];
  5021. if(results.orphan){
  5022. // already wrapped
  5023. return results;
  5024. }
  5025. return new NodeList(results);
  5026. };
  5027. query.matches = engine.match || function(node, selector, root){
  5028. // summary:
  5029. // Test to see if a node matches a selector
  5030. return query.filter([node], selector, root).length > 0;
  5031. };
  5032. // the engine provides a filtering function, use it to for matching
  5033. query.filter = engine.filter || function(nodes, selector, root){
  5034. // summary:
  5035. // Filters an array of nodes. Note that this does not guarantee to return a dojo.NodeList, just an array.
  5036. return query(selector, root).filter(function(node){
  5037. return array.indexOf(nodes, node) > -1;
  5038. });
  5039. };
  5040. if(typeof engine != "function"){
  5041. var search = engine.search;
  5042. engine = function(selector, root){
  5043. // Slick does it backwards (or everyone else does it backwards, probably the latter)
  5044. return search(root || document, selector);
  5045. };
  5046. }
  5047. return query;
  5048. }
  5049. var query = queryForEngine(defaultEngine, NodeList);
  5050. // the query that is returned from this module is slightly different than dojo.query,
  5051. // because dojo.query has to maintain backwards compatibility with returning a
  5052. // true array which has performance problems. The query returned from the module
  5053. // does not use true arrays, but rather inherits from Array, making it much faster to
  5054. // instantiate.
  5055. dojo.query = queryForEngine(defaultEngine, function(array){
  5056. // call it without the new operator to invoke the back-compat behavior that returns a true array
  5057. return NodeList(array);
  5058. });
  5059. query.load = /*===== dojo.query.load= ======*/ function(id, parentRequire, loaded, config){
  5060. // summary: can be used as AMD plugin to conditionally load new query engine
  5061. // example:
  5062. // | define(["dojo/query!custom"], function(qsa){
  5063. // | // loaded selector/custom.js as engine
  5064. // | qsa("#foobar").forEach(...);
  5065. // | });
  5066. loader.load(id, parentRequire, function(engine){
  5067. loaded(queryForEngine(engine, NodeList));
  5068. });
  5069. };
  5070. dojo._filterQueryResult = query._filterResult = function(nodes, selector, root){
  5071. return new NodeList(query.filter(nodes, selector, root));
  5072. };
  5073. dojo.NodeList = query.NodeList = NodeList;
  5074. return query;
  5075. });
  5076. },
  5077. 'dojo/has':function(){
  5078. define(["require"], function(require) {
  5079. // module:
  5080. // dojo/has
  5081. // summary:
  5082. // Defines the has.js API and several feature tests used by dojo.
  5083. // description:
  5084. // This module defines the has API as described by the project has.js with the following additional features:
  5085. //
  5086. // * the has test cache is exposed at has.cache.
  5087. // * the method has.add includes a forth parameter that controls whether or not existing tests are replaced
  5088. // * the loader's has cache may be optionally copied into this module's has cahce.
  5089. //
  5090. // This module adopted from https://github.com/phiggins42/has.js; thanks has.js team!
  5091. // try to pull the has implementation from the loader; both the dojo loader and bdLoad provide one
  5092. // WARNING: if a foreign loader defines require.has to be something other than the has.js API, then this implementation fail
  5093. var has = require.has || function(){};
  5094. if(!1){
  5095. // notice the condition is written so that if 1 is transformed to 1 during a build
  5096. // the conditional will be (!1 && typeof has=="function") which is statically false and the closure
  5097. // compiler will discard the block.
  5098. var
  5099. isBrowser =
  5100. // the most fundamental decision: are we in the browser?
  5101. typeof window != "undefined" &&
  5102. typeof location != "undefined" &&
  5103. typeof document != "undefined" &&
  5104. window.location == location && window.document == document,
  5105. // has API variables
  5106. global = (function () { return this; })(),
  5107. doc = isBrowser && document,
  5108. element = doc && doc.createElement("DiV"),
  5109. cache = {};
  5110. has = /*===== dojo.has= =====*/ function(name){
  5111. // summary:
  5112. // Return the current value of the named feature.
  5113. //
  5114. // name: String|Integer
  5115. // The name (if a string) or identifier (if an integer) of the feature to test.
  5116. //
  5117. // description:
  5118. // Returns the value of the feature named by name. The feature must have been
  5119. // previously added to the cache by has.add.
  5120. return typeof cache[name] == "function" ? (cache[name] = cache[name](global, doc, element)) : cache[name]; // Boolean
  5121. };
  5122. has.cache = cache;
  5123. has.add = /*====== dojo.has.add= ======*/ function(name, test, now, force){
  5124. // summary:
  5125. // Register a new feature test for some named feature.
  5126. //
  5127. // name: String|Integer
  5128. // The name (if a string) or identifier (if an integer) of the feature to test.
  5129. //
  5130. // test: Function
  5131. // A test function to register. If a function, queued for testing until actually
  5132. // needed. The test function should return a boolean indicating
  5133. // the presence of a feature or bug.
  5134. //
  5135. // now: Boolean?
  5136. // Optional. Omit if `test` is not a function. Provides a way to immediately
  5137. // run the test and cache the result.
  5138. //
  5139. // force: Boolean?
  5140. // Optional. If the test already exists and force is truthy, then the existing
  5141. // test will be replaced; otherwise, add does not replace an existing test (that
  5142. // is, by default, the first test advice wins).
  5143. //
  5144. // example:
  5145. // A redundant test, testFn with immediate execution:
  5146. // | has.add("javascript", function(){ return true; }, true);
  5147. //
  5148. // example:
  5149. // Again with the redundantness. You can do this in your tests, but we should
  5150. // not be doing this in any internal has.js tests
  5151. // | has.add("javascript", true);
  5152. //
  5153. // example:
  5154. // Three things are passed to the testFunction. `global`, `document`, and a generic element
  5155. // from which to work your test should the need arise.
  5156. // | has.add("bug-byid", function(g, d, el){
  5157. // | // g == global, typically window, yadda yadda
  5158. // | // d == document object
  5159. // | // el == the generic element. a `has` element.
  5160. // | return false; // fake test, byid-when-form-has-name-matching-an-id is slightly longer
  5161. // | });
  5162. (typeof cache[name]=="undefined" || force) && (cache[name]= test);
  5163. return now && has(name);
  5164. };
  5165. // since we're operating under a loader that doesn't provide a has API, we must explicitly initialize
  5166. // has as it would have otherwise been initialized by the dojo loader; use has.add to the builder
  5167. // can optimize these away iff desired
  5168. true || has.add("host-browser", isBrowser);
  5169. false && has.add("host-node", (typeof process == "object" && process.versions && process.versions.node && process.versions.v8));
  5170. false && has.add("host-rhino", (typeof load == "function" && (typeof Packages == "function" || typeof Packages == "object")));
  5171. true || has.add("dom", isBrowser);
  5172. true || has.add("dojo-dom-ready-api", 1);
  5173. true || has.add("dojo-sniff", 1);
  5174. }
  5175. if(1){
  5176. var agent = navigator.userAgent;
  5177. // Common application level tests
  5178. has.add("dom-addeventlistener", !!document.addEventListener);
  5179. has.add("touch", "ontouchstart" in document);
  5180. // I don't know if any of these tests are really correct, just a rough guess
  5181. has.add("device-width", screen.availWidth || innerWidth);
  5182. has.add("agent-ios", !!agent.match(/iPhone|iP[ao]d/));
  5183. has.add("agent-android", agent.indexOf("android") > 1);
  5184. }
  5185. has.clearElement = /*===== dojo.has.clearElement= ======*/ function(element) {
  5186. // summary:
  5187. // Deletes the contents of the element passed to test functions.
  5188. element.innerHTML= "";
  5189. return element;
  5190. };
  5191. has.normalize = /*===== dojo.has.normalize= ======*/ function(id, toAbsMid){
  5192. // summary:
  5193. // Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
  5194. //
  5195. // toAbsMid: Function
  5196. // Resolves a relative module id into an absolute module id
  5197. var
  5198. tokens = id.match(/[\?:]|[^:\?]*/g), i = 0,
  5199. get = function(skip){
  5200. var term = tokens[i++];
  5201. if(term == ":"){
  5202. // empty string module name, resolves to 0
  5203. return 0;
  5204. }else{
  5205. // postfixed with a ? means it is a feature to branch on, the term is the name of the feature
  5206. if(tokens[i++] == "?"){
  5207. if(!skip && has(term)){
  5208. // matched the feature, get the first value from the options
  5209. return get();
  5210. }else{
  5211. // did not match, get the second value, passing over the first
  5212. get(true);
  5213. return get(skip);
  5214. }
  5215. }
  5216. // a module
  5217. return term || 0;
  5218. }
  5219. };
  5220. id = get();
  5221. return id && toAbsMid(id);
  5222. };
  5223. has.load = /*===== dojo.has.load= ======*/ function(id, parentRequire, loaded){
  5224. // summary:
  5225. // Conditional loading of AMD modules based on a has feature test value.
  5226. //
  5227. // id: String
  5228. // Gives the resolved module id to load.
  5229. //
  5230. // parentRequire: Function
  5231. // The loader require function with respect to the module that contained the plugin resource in it's
  5232. // dependency list.
  5233. //
  5234. // loaded: Function
  5235. // Callback to loader that consumes result of plugin demand.
  5236. if(id){
  5237. parentRequire([id], loaded);
  5238. }else{
  5239. loaded();
  5240. }
  5241. };
  5242. return has;
  5243. });
  5244. },
  5245. 'dojo/_base/loader':function(){
  5246. define(["./kernel", "../has", "require", "module", "./json", "./lang", "./array"], function(dojo, has, require, thisModule, json, lang, array) {
  5247. // module:
  5248. // dojo/_base/lader
  5249. // summary:
  5250. // This module defines the v1.x synchronous loader API.
  5251. // signal the loader in sync mode...
  5252. //>>pure-amd
  5253. if (!1){
  5254. console.error("cannot load the Dojo v1.x loader with a foreign loader");
  5255. return 0;
  5256. }
  5257. var makeErrorToken = function(id){
  5258. return {src:thisModule.id, id:id};
  5259. },
  5260. slashName = function(name){
  5261. return name.replace(/\./g, "/");
  5262. },
  5263. buildDetectRe = /\/\/>>built/,
  5264. dojoRequireCallbacks = [],
  5265. dojoRequireModuleStack = [],
  5266. dojoRequirePlugin = function(mid, require, loaded){
  5267. dojoRequireCallbacks.push(loaded);
  5268. array.forEach(mid.split(","), function(mid){
  5269. var module = getModule(mid, require.module);
  5270. dojoRequireModuleStack.push(module);
  5271. injectModule(module);
  5272. });
  5273. checkDojoRequirePlugin();
  5274. },
  5275. // checkDojoRequirePlugin inspects all of the modules demanded by a dojo/require!<module-list> dependency
  5276. // to see if they have arrived. The loader does not release *any* of these modules to be instantiated
  5277. // until *all* of these modules are on board, thereby preventing the evaluation of a module with dojo.require's
  5278. // that reference modules that are not available.
  5279. //
  5280. // The algorithm works by traversing the dependency graphs (remember, there can be cycles so they are not trees)
  5281. // of each module in the dojoRequireModuleStack array (which contains the list of modules demanded by dojo/require!).
  5282. // The moment a single module is discovered that is missing, the algorithm gives up and indicates that not all
  5283. // modules are on board. dojo/loadInit! and dojo/require! are ignored because there dependencies are inserted
  5284. // directly in dojoRequireModuleStack. For example, if "your/module" module depends on "dojo/require!my/module", then
  5285. // *both* "dojo/require!my/module" and "my/module" will be in dojoRequireModuleStack. Obviously, if "my/module"
  5286. // is on board, then "dojo/require!my/module" is also satisfied, so the algorithm doesn't check for "dojo/require!my/module".
  5287. //
  5288. // Note: inserting a dojo/require!<some-module-list> dependency in the dojoRequireModuleStack achieves nothing
  5289. // with the current algorithm; however, having such modules present makes it possible to optimize the algorithm
  5290. //
  5291. // Note: prior versions of this algorithm had an optimization that signaled loaded on dojo/require! dependencies
  5292. // individually (rather than waiting for them all to be resolved). The implementation proved problematic with cycles
  5293. // and plugins. However, it is possible to reattach that strategy in the future.
  5294. // a set from module-id to {undefined | 1 | 0}, where...
  5295. // undefined => the module has not been inspected
  5296. // 0 => the module or at least one of its dependencies has not arrived
  5297. // 1 => the module is a loadInit! or require! plugin resource, or is currently being traversed (therefore, assume
  5298. // OK until proven otherwise), or has been completely traversed and all dependencies have arrived
  5299. touched,
  5300. traverse = function(m){
  5301. touched[m.mid] = 1;
  5302. for(var t, module, deps = m.deps || [], i= 0; i<deps.length; i++){
  5303. module = deps[i];
  5304. if(!(t = touched[module.mid])){
  5305. if(t===0 || !traverse(module)){
  5306. touched[m.mid] = 0;
  5307. return false;
  5308. }
  5309. }
  5310. }
  5311. return true;
  5312. },
  5313. checkDojoRequirePlugin = function(){
  5314. // initialize the touched hash with easy-to-compute values that help short circuit recursive algorithm;
  5315. // recall loadInit/require plugin modules are dependencies of modules in dojoRequireModuleStack...
  5316. // which would cause a circular dependency chain that would never be resolved if checked here
  5317. // notice all dependencies of any particular loadInit/require plugin module will already
  5318. // be checked since those are pushed into dojoRequireModuleStack explicitly by the
  5319. // plugin...so if a particular loadInitPlugin module's dependencies are not really
  5320. // on board, that *will* be detected elsewhere in the traversal.
  5321. var module, mid;
  5322. touched = {};
  5323. for(mid in modules){
  5324. module = modules[mid];
  5325. // this could be improved by remembering the result of the regex tests
  5326. if(module.executed || module.noReqPluginCheck){
  5327. touched[mid] = 1;
  5328. }else{
  5329. if(module.noReqPluginCheck!==0){
  5330. // tag the module as either a loadInit or require plugin or not for future reference
  5331. module.noReqPluginCheck = /loadInit\!/.test(mid) || /require\!/.test(mid) ? 1 : 0;
  5332. }
  5333. if(module.noReqPluginCheck){
  5334. touched[mid] = 1;
  5335. }else if(module.injected!==arrived){
  5336. // not executed, has not arrived, and is not a loadInit or require plugin resource
  5337. touched[mid] = 0;
  5338. }// else, leave undefined and we'll traverse the dependencies
  5339. }
  5340. }
  5341. for(var t, i = 0, end = dojoRequireModuleStack.length; i<end; i++){
  5342. module = dojoRequireModuleStack[i];
  5343. if(!(t = touched[module.mid])){
  5344. if(t===0 || !traverse(module)){
  5345. return;
  5346. }
  5347. }
  5348. }
  5349. loaderVars.holdIdle();
  5350. var oldCallbacks = dojoRequireCallbacks;
  5351. dojoRequireCallbacks = [];
  5352. array.forEach(oldCallbacks, function(cb){cb(1);});
  5353. loaderVars.releaseIdle();
  5354. },
  5355. dojoLoadInitPlugin = function(mid, require, loaded){
  5356. // mid names a module that defines a "dojo load init" bundle, an object with two properties:
  5357. //
  5358. // * names: a vector of module ids that give top-level names to define in the lexical scope of def
  5359. // * def: a function that contains some some legacy loader API applications
  5360. //
  5361. // The point of def is to possibly cause some modules to be loaded (but not executed) by dojo/require! where the module
  5362. // ids are possibly-determined at runtime. For example, here is dojox.gfx from v1.6 expressed as an AMD module using the dojo/loadInit
  5363. // and dojo/require plugins.
  5364. //
  5365. // // dojox/gfx:
  5366. //
  5367. // define("*loadInit_12, {
  5368. // names:["dojo", "dijit", "dojox"],
  5369. // def: function(){
  5370. // dojo.loadInit(function(){
  5371. // var gfx = lang.getObject("dojox.gfx", true);
  5372. //
  5373. // //
  5374. // // code required to set gfx properties ommitted...
  5375. // //
  5376. //
  5377. // // now use the calculations to include the runtime-dependent module
  5378. // dojo.require("dojox.gfx." + gfx.renderer);
  5379. // });
  5380. // }
  5381. // });
  5382. //
  5383. // define(["dojo", "dojo/loadInit!" + id].concat("dojo/require!dojox/gfx/matric,dojox/gfx/_base"), function(dojo){
  5384. // // when this AMD factory function is executed, the following modules are guaranteed downloaded but not executed:
  5385. // // "dojox.gfx." + gfx.renderer
  5386. // // dojox.gfx.matrix
  5387. // // dojox.gfx._base
  5388. // dojo.provide("dojo.gfx");
  5389. // dojo.require("dojox.gfx.matrix");
  5390. // dojo.require("dojox.gfx._base");
  5391. // dojo.require("dojox.gfx." + gfx.renderer);
  5392. // return lang.getObject("dojo.gfx");
  5393. // });
  5394. // })();
  5395. //
  5396. // The idea is to run the legacy loader API with global variables shadowed, which allows these variables to
  5397. // be relocated. For example, dojox and dojo could be relocated to different names by giving a packageMap and the code above will
  5398. // execute properly (because the plugin below resolves the load init bundle.names module with respect to the module that demanded
  5399. // the plugin resource).
  5400. //
  5401. // Note that the relocation is specified in the runtime configuration; relocated names need not be set at build-time.
  5402. //
  5403. // Warning: this is not the best way to express dojox.gfx as and AMD module. In fact, the module has been properly converted in
  5404. // v1.7. However, this technique allows the builder to convert legacy modules into AMD modules and guarantee the codepath is the
  5405. // same in the converted AMD module.
  5406. require([mid], function(bundle){
  5407. // notice how names is resolved with respect to the module that demanded the plugin resource
  5408. require(bundle.names, function(){
  5409. // bring the bundle names into scope
  5410. for(var scopeText = "", args= [], i = 0; i<arguments.length; i++){
  5411. scopeText+= "var " + bundle.names[i] + "= arguments[" + i + "]; ";
  5412. args.push(arguments[i]);
  5413. }
  5414. eval(scopeText);
  5415. var callingModule = require.module,
  5416. deps = [],
  5417. hold = {},
  5418. requireList = [],
  5419. p,
  5420. syncLoaderApi = {
  5421. provide:function(moduleName){
  5422. // mark modules that arrive consequent to multiple provides in this module as arrived since they can't be injected
  5423. moduleName = slashName(moduleName);
  5424. var providedModule = getModule(moduleName, callingModule);
  5425. if(providedModule!==callingModule){
  5426. setArrived(providedModule);
  5427. }
  5428. },
  5429. require:function(moduleName, omitModuleCheck){
  5430. moduleName = slashName(moduleName);
  5431. omitModuleCheck && (getModule(moduleName, callingModule).result = nonmodule);
  5432. requireList.push(moduleName);
  5433. },
  5434. requireLocalization:function(moduleName, bundleName, locale){
  5435. // since we're going to need dojo/i8n, add it to deps if not already there
  5436. deps.length || (deps = ["dojo/i18n"]);
  5437. // figure out if the bundle is xdomain; if so, add it to the depsSet
  5438. locale = (locale || dojo.locale).toLowerCase();
  5439. moduleName = slashName(moduleName) + "/nls/" + (/root/i.test(locale) ? "" : locale + "/") + slashName(bundleName);
  5440. if(getModule(moduleName, callingModule).isXd){
  5441. deps.push("dojo/i18n!" + moduleName);
  5442. }// else the bundle will be loaded synchronously when the module is evaluated
  5443. },
  5444. loadInit:function(f){
  5445. f();
  5446. }
  5447. };
  5448. // hijack the correct dojo and apply bundle.def
  5449. try{
  5450. for(p in syncLoaderApi){
  5451. hold[p] = dojo[p];
  5452. dojo[p] = syncLoaderApi[p];
  5453. }
  5454. bundle.def.apply(null, args);
  5455. }catch(e){
  5456. signal("error", [makeErrorToken("failedDojoLoadInit"), e]);
  5457. }finally{
  5458. for(p in syncLoaderApi){
  5459. dojo[p] = hold[p];
  5460. }
  5461. }
  5462. // requireList is the list of modules that need to be downloaded but not executed before the callingModule can be executed
  5463. requireList.length && deps.push("dojo/require!" + requireList.join(","));
  5464. dojoRequireCallbacks.push(loaded);
  5465. array.forEach(requireList, function(mid){
  5466. var module = getModule(mid, require.module);
  5467. dojoRequireModuleStack.push(module);
  5468. injectModule(module);
  5469. });
  5470. checkDojoRequirePlugin();
  5471. });
  5472. });
  5473. },
  5474. extractApplication = function(
  5475. text, // the text to search
  5476. startSearch, // the position in text to start looking for the closing paren
  5477. startApplication // the position in text where the function application expression starts
  5478. ){
  5479. // find end of the call by finding the matching end paren
  5480. // Warning: as usual, this will fail in the presense of unmatched right parans contained in strings, regexs, or unremoved comments
  5481. var parenRe = /\(|\)/g,
  5482. matchCount = 1,
  5483. match;
  5484. parenRe.lastIndex = startSearch;
  5485. while((match = parenRe.exec(text))){
  5486. if(match[0] == ")"){
  5487. matchCount -= 1;
  5488. }else{
  5489. matchCount += 1;
  5490. }
  5491. if(matchCount == 0){
  5492. break;
  5493. }
  5494. }
  5495. if(matchCount != 0){
  5496. throw "unmatched paren around character " + parenRe.lastIndex + " in: " + text;
  5497. }
  5498. //Put the master matching string in the results.
  5499. return [dojo.trim(text.substring(startApplication, parenRe.lastIndex))+";\n", parenRe.lastIndex];
  5500. },
  5501. // the following regex is taken from 1.6. It is a very poor technique to remove comments and
  5502. // will fail in some cases; for example, consider the code...
  5503. //
  5504. // var message = "Category-1 */* Category-2";
  5505. //
  5506. // The regex that follows will see a /* comment and trash the code accordingly. In fact, there are all
  5507. // kinds of cases like this with strings and regexs that will cause this design to fail miserably.
  5508. //
  5509. // Alternative regex designs exist that will result in less-likely failures, but will still fail in many cases.
  5510. // The only solution guaranteed 100% correct is to parse the code and that seems overkill for this
  5511. // backcompat/unbuilt-xdomain layer. In the end, since it's been this way for a while, we won't change it.
  5512. // See the opening paragraphs of Chapter 7 or ECME-262 which describes the lexical abiguity further.
  5513. removeCommentRe = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
  5514. syncLoaderApiRe = /(^|\s)dojo\.(loadInit|require|provide|requireLocalization|requireIf|requireAfterIf|platformRequire)\s*\(/mg,
  5515. amdLoaderApiRe = /(^|\s)(require|define)\s*\(/m,
  5516. extractLegacyApiApplications = function(text, noCommentText){
  5517. // scan the noCommentText for any legacy loader API applications. Copy such applications into result (this is
  5518. // used by the builder). Move dojo.loadInit applications to loadInitApplications string. Copy all other applications
  5519. // to otherApplications string. If no applications were found, return 0, signalling an AMD module. Otherwise, return
  5520. // loadInitApplications + otherApplications. Fixup text by replacing
  5521. //
  5522. // dojo.loadInit(// etc...
  5523. //
  5524. // with
  5525. //
  5526. // \n 0 && dojo.loadInit(// etc...
  5527. //
  5528. // Which results in the dojo.loadInit from *not* being applied. This design goes a long way towards protecting the
  5529. // code from an over-agressive removeCommentRe. However...
  5530. //
  5531. // WARNING: the removeCommentRe will cause an error if a detected comment removes all or part of a legacy-loader application
  5532. // that is not in a comment.
  5533. var match, startSearch, startApplication, application,
  5534. loadInitApplications = [],
  5535. otherApplications = [],
  5536. allApplications = [];
  5537. // noCommentText may be provided by a build app with comments extracted by a better method than regex (hopefully)
  5538. noCommentText = noCommentText || text.replace(removeCommentRe, function(match){
  5539. // remove iff the detected comment has text that looks like a sync loader API application; this helps by
  5540. // removing as little as possible, minimizing the changes the janky regex will kill the module
  5541. syncLoaderApiRe.lastIndex = amdLoaderApiRe.lastIndex = 0;
  5542. return (syncLoaderApiRe.test(match) || amdLoaderApiRe.test(match)) ? "" : match;
  5543. });
  5544. // find and extract all dojo.loadInit applications
  5545. while((match = syncLoaderApiRe.exec(noCommentText))){
  5546. startSearch = syncLoaderApiRe.lastIndex;
  5547. startApplication = startSearch - match[0].length;
  5548. application = extractApplication(noCommentText, startSearch, startApplication);
  5549. if(match[2]=="loadInit"){
  5550. loadInitApplications.push(application[0]);
  5551. }else{
  5552. otherApplications.push(application[0]);
  5553. }
  5554. syncLoaderApiRe.lastIndex = application[1];
  5555. }
  5556. allApplications = loadInitApplications.concat(otherApplications);
  5557. if(allApplications.length || !amdLoaderApiRe.test(noCommentText)){
  5558. // either there were some legacy loader API applications or there were no AMD API applications
  5559. return [text.replace(/(^|\s)dojo\.loadInit\s*\(/g, "\n0 && dojo.loadInit("), allApplications.join(""), allApplications];
  5560. }else{
  5561. // legacy loader API *was not* detected and AMD API *was* detected; therefore, assume it's an AMD module
  5562. return 0;
  5563. }
  5564. },
  5565. transformToAmd = function(module, text){
  5566. // This is roughly the equivalent of dojo._xdCreateResource in 1.6-; however, it expresses a v1.6- dojo
  5567. // module in terms of AMD define instead of creating the dojo proprietary xdomain module expression.
  5568. // The module could have originated from several sources:
  5569. //
  5570. // * amd require() a module, e.g., require(["my/module"])
  5571. // * amd require() a nonmodule, e.g., require(["my/resource.js"')
  5572. // * amd define() deps vector (always a module)
  5573. // * dojo.require() a module, e.g. dojo.require("my.module")
  5574. // * dojo.require() a nonmodule, e.g., dojo.require("my.module", true)
  5575. // * dojo.requireIf/requireAfterIf/platformRequire a module
  5576. //
  5577. // The module is scanned for legacy loader API applications; if none are found, then assume the module is an
  5578. // AMD module and return 0. Otherwise, a synthetic dojo/loadInit plugin resource is created and the module text
  5579. // is rewritten as an AMD module with the single dependency of this synthetic resource. When the dojo/loadInit
  5580. // plugin loaded the synthetic resource, it will cause all dojo.loadInit's to be executed, find all dojo.require's
  5581. // (either directly consequent to dojo.require or indirectly consequent to dojo.require[After]If or
  5582. // dojo.platformRequire, and finally cause loading of all dojo.required modules with the dojo/require plugin. Thus,
  5583. // when the dojo/loadInit plugin reports it has been loaded, all modules required by the given module are guaranteed
  5584. // loaded (but not executed). This then allows the module to execute it's code path without interupts, thereby
  5585. // following the synchronous code path.
  5586. var extractResult, id, names = [], namesAsStrings = [];
  5587. if(buildDetectRe.test(text) || !(extractResult = extractLegacyApiApplications(text))){
  5588. // buildDetectRe.test(text) => a built module, always AMD
  5589. // extractResult==0 => no sync API
  5590. return 0;
  5591. }
  5592. // manufacture a synthetic module id that can never be a real mdule id (just like require does)
  5593. id = module.mid + "-*loadInit";
  5594. // construct the dojo/loadInit names vector which causes any relocated names to be defined as lexical variables under their not-relocated name
  5595. // the dojo/loadInit plugin assumes the first name in names is "dojo"
  5596. for(var p in getModule("dojo", module).result.scopeMap){
  5597. names.push(p);
  5598. namesAsStrings.push('"' + p + '"');
  5599. }
  5600. // rewrite the module as a synthetic dojo/loadInit plugin resource + the module expressed as an AMD module that depends on this synthetic resource
  5601. return "// xdomain rewrite of " + module.path + "\n" +
  5602. "define('" + id + "',{\n" +
  5603. "\tnames:" + dojo.toJson(names) + ",\n" +
  5604. "\tdef:function(" + names.join(",") + "){" + extractResult[1] + "}" +
  5605. "});\n\n" +
  5606. "define(" + dojo.toJson(names.concat(["dojo/loadInit!"+id])) + ", function(" + names.join(",") + "){\n" + extractResult[0] + "});";
  5607. },
  5608. loaderVars = require.initSyncLoader(dojoRequirePlugin, checkDojoRequirePlugin, transformToAmd),
  5609. sync =
  5610. loaderVars.sync,
  5611. xd =
  5612. loaderVars.xd,
  5613. arrived =
  5614. loaderVars.arrived,
  5615. nonmodule =
  5616. loaderVars.nonmodule,
  5617. executing =
  5618. loaderVars.executing,
  5619. executed =
  5620. loaderVars.executed,
  5621. syncExecStack =
  5622. loaderVars.syncExecStack,
  5623. modules =
  5624. loaderVars.modules,
  5625. execQ =
  5626. loaderVars.execQ,
  5627. getModule =
  5628. loaderVars.getModule,
  5629. injectModule =
  5630. loaderVars.injectModule,
  5631. setArrived =
  5632. loaderVars.setArrived,
  5633. signal =
  5634. loaderVars.signal,
  5635. finishExec =
  5636. loaderVars.finishExec,
  5637. execModule =
  5638. loaderVars.execModule,
  5639. getLegacyMode =
  5640. loaderVars.getLegacyMode;
  5641. dojo.provide = function(mid){
  5642. var executingModule = syncExecStack[0],
  5643. module = lang.mixin(getModule(slashName(mid), require.module), {
  5644. executed:executing,
  5645. result:lang.getObject(mid, true)
  5646. });
  5647. setArrived(module);
  5648. if(executingModule){
  5649. (executingModule.provides || (executingModule.provides = [])).push(function(){
  5650. module.result = lang.getObject(mid);
  5651. delete module.provides;
  5652. module.executed!==executed && finishExec(module);
  5653. });
  5654. }// else dojo.provide called not consequent to loading; therefore, give up trying to publish module value to loader namespace
  5655. return module.result;
  5656. };
  5657. has.add("config-publishRequireResult", 1, 0, 0);
  5658. dojo.require = function(moduleName, omitModuleCheck) {
  5659. // summary:
  5660. // loads a Javascript module from the appropriate URI
  5661. //
  5662. // moduleName: String
  5663. // module name to load, using periods for separators,
  5664. // e.g. "dojo.date.locale". Module paths are de-referenced by dojo's
  5665. // internal mapping of locations to names and are disambiguated by
  5666. // longest prefix. See `dojo.registerModulePath()` for details on
  5667. // registering new modules.
  5668. //
  5669. // omitModuleCheck: Boolean?
  5670. // if `true`, omitModuleCheck skips the step of ensuring that the
  5671. // loaded file actually defines the symbol it is referenced by.
  5672. // For example if it called as `dojo.require("a.b.c")` and the
  5673. // file located at `a/b/c.js` does not define an object `a.b.c`,
  5674. // and exception will be throws whereas no exception is raised
  5675. // when called as `dojo.require("a.b.c", true)`
  5676. //
  5677. // description:
  5678. // Modules are loaded via dojo.require by using one of two loaders: the normal loader
  5679. // and the xdomain loader. The xdomain loader is used when dojo was built with a
  5680. // custom build that specified loader=xdomain and the module lives on a modulePath
  5681. // that is a whole URL, with protocol and a domain. The versions of Dojo that are on
  5682. // the Google and AOL CDNs use the xdomain loader.
  5683. //
  5684. // If the module is loaded via the xdomain loader, it is an asynchronous load, since
  5685. // the module is added via a dynamically created script tag. This
  5686. // means that dojo.require() can return before the module has loaded. However, this
  5687. // should only happen in the case where you do dojo.require calls in the top-level
  5688. // HTML page, or if you purposely avoid the loader checking for dojo.require
  5689. // dependencies in your module by using a syntax like dojo["require"] to load the module.
  5690. //
  5691. // Sometimes it is useful to not have the loader detect the dojo.require calls in the
  5692. // module so that you can dynamically load the modules as a result of an action on the
  5693. // page, instead of right at module load time.
  5694. //
  5695. // Also, for script blocks in an HTML page, the loader does not pre-process them, so
  5696. // it does not know to download the modules before the dojo.require calls occur.
  5697. //
  5698. // So, in those two cases, when you want on-the-fly module loading or for script blocks
  5699. // in the HTML page, special care must be taken if the dojo.required code is loaded
  5700. // asynchronously. To make sure you can execute code that depends on the dojo.required
  5701. // modules, be sure to add the code that depends on the modules in a dojo.addOnLoad()
  5702. // callback. dojo.addOnLoad waits for all outstanding modules to finish loading before
  5703. // executing.
  5704. //
  5705. // This type of syntax works with both xdomain and normal loaders, so it is good
  5706. // practice to always use this idiom for on-the-fly code loading and in HTML script
  5707. // blocks. If at some point you change loaders and where the code is loaded from,
  5708. // it will all still work.
  5709. //
  5710. // More on how dojo.require
  5711. // `dojo.require("A.B")` first checks to see if symbol A.B is
  5712. // defined. If it is, it is simply returned (nothing to do).
  5713. //
  5714. // If it is not defined, it will look for `A/B.js` in the script root
  5715. // directory.
  5716. //
  5717. // `dojo.require` throws an exception if it cannot find a file
  5718. // to load, or if the symbol `A.B` is not defined after loading.
  5719. //
  5720. // It returns the object `A.B`, but note the caveats above about on-the-fly loading and
  5721. // HTML script blocks when the xdomain loader is loading a module.
  5722. //
  5723. // `dojo.require()` does nothing about importing symbols into
  5724. // the current namespace. It is presumed that the caller will
  5725. // take care of that.
  5726. //
  5727. // example:
  5728. // To use dojo.require in conjunction with dojo.ready:
  5729. //
  5730. // | dojo.require("foo");
  5731. // | dojo.require("bar");
  5732. // | dojo.addOnLoad(function(){
  5733. // | //you can now safely do something with foo and bar
  5734. // | });
  5735. //
  5736. // example:
  5737. // For example, to import all symbols into a local block, you might write:
  5738. //
  5739. // | with (dojo.require("A.B")) {
  5740. // | ...
  5741. // | }
  5742. //
  5743. // And to import just the leaf symbol to a local variable:
  5744. //
  5745. // | var B = dojo.require("A.B");
  5746. // | ...
  5747. //
  5748. // returns:
  5749. // the required namespace object
  5750. function doRequire(mid, omitModuleCheck){
  5751. var module = getModule(slashName(mid), require.module);
  5752. if(syncExecStack.length && syncExecStack[0].finish){
  5753. // switched to async loading in the middle of evaluating a legacy module; stop
  5754. // applying dojo.require so the remaining dojo.requires are applied in order
  5755. syncExecStack[0].finish.push(mid);
  5756. return undefined;
  5757. }
  5758. // recall module.executed has values {0, executing, executed}; therefore, truthy indicates executing or executed
  5759. if(module.executed){
  5760. return module.result;
  5761. }
  5762. omitModuleCheck && (module.result = nonmodule);
  5763. var currentMode = getLegacyMode();
  5764. // recall, in sync mode to inject is to *eval* the module text
  5765. // if the module is a legacy module, this is the same as executing
  5766. // but if the module is an AMD module, this means defining, not executing
  5767. injectModule(module);
  5768. // the inject may have changed the mode
  5769. currentMode = getLegacyMode();
  5770. // in sync mode to dojo.require is to execute
  5771. if(module.executed!==executed && module.injected===arrived){
  5772. // the module was already here before injectModule was called probably finishing up a xdomain
  5773. // load, but maybe a module given to the loader directly rather than having the loader retrieve it
  5774. loaderVars.holdIdle();
  5775. execModule(module);
  5776. loaderVars.releaseIdle();
  5777. }
  5778. if(module.executed){
  5779. return module.result;
  5780. }
  5781. if(currentMode==sync){
  5782. // the only way to get here is in sync mode and dojo.required a module that
  5783. // * was loaded async in the injectModule application a few lines up
  5784. // * was an AMD module that had deps that are being loaded async and therefore couldn't execute
  5785. if(module.cjs){
  5786. // the module was an AMD module; unshift, not push, which causes the current traversal to be reattempted from the top
  5787. execQ.unshift(module);
  5788. }else{
  5789. // the module was a legacy module
  5790. syncExecStack.length && (syncExecStack[0].finish= [mid]);
  5791. }
  5792. }else{
  5793. // the loader wasn't in sync mode on entry; probably async mode; therefore, no expectation of getting
  5794. // the module value synchronously; make sure it gets executed though
  5795. execQ.push(module);
  5796. }
  5797. return undefined;
  5798. }
  5799. var result = doRequire(moduleName, omitModuleCheck);
  5800. if(has("config-publishRequireResult") && !lang.exists(moduleName) && result!==undefined){
  5801. lang.setObject(moduleName, result);
  5802. }
  5803. return result;
  5804. };
  5805. dojo.loadInit = function(f) {
  5806. f();
  5807. };
  5808. dojo.registerModulePath = function(/*String*/moduleName, /*String*/prefix){
  5809. // summary:
  5810. // Maps a module name to a path
  5811. // description:
  5812. // An unregistered module is given the default path of ../[module],
  5813. // relative to Dojo root. For example, module acme is mapped to
  5814. // ../acme. If you want to use a different module name, use
  5815. // dojo.registerModulePath.
  5816. // example:
  5817. // If your dojo.js is located at this location in the web root:
  5818. // | /myapp/js/dojo/dojo/dojo.js
  5819. // and your modules are located at:
  5820. // | /myapp/js/foo/bar.js
  5821. // | /myapp/js/foo/baz.js
  5822. // | /myapp/js/foo/thud/xyzzy.js
  5823. // Your application can tell Dojo to locate the "foo" namespace by calling:
  5824. // | dojo.registerModulePath("foo", "../../foo");
  5825. // At which point you can then use dojo.require() to load the
  5826. // modules (assuming they provide() the same things which are
  5827. // required). The full code might be:
  5828. // | <script type="text/javascript"
  5829. // | src="/myapp/js/dojo/dojo/dojo.js"></script>
  5830. // | <script type="text/javascript">
  5831. // | dojo.registerModulePath("foo", "../../foo");
  5832. // | dojo.require("foo.bar");
  5833. // | dojo.require("foo.baz");
  5834. // | dojo.require("foo.thud.xyzzy");
  5835. // | </script>
  5836. var paths = {};
  5837. paths[moduleName.replace(/\./g, "/")] = prefix;
  5838. require({paths:paths});
  5839. };
  5840. dojo.platformRequire = function(/*Object*/modMap){
  5841. // summary:
  5842. // require one or more modules based on which host environment
  5843. // Dojo is currently operating in
  5844. // description:
  5845. // This method takes a "map" of arrays which one can use to
  5846. // optionally load dojo modules. The map is indexed by the
  5847. // possible dojo.name_ values, with two additional values:
  5848. // "default" and "common". The items in the "default" array will
  5849. // be loaded if none of the other items have been choosen based on
  5850. // dojo.name_, set by your host environment. The items in the
  5851. // "common" array will *always* be loaded, regardless of which
  5852. // list is chosen.
  5853. // example:
  5854. // | dojo.platformRequire({
  5855. // | browser: [
  5856. // | "foo.sample", // simple module
  5857. // | "foo.test",
  5858. // | ["foo.bar.baz", true] // skip object check in _loadModule (dojo.require)
  5859. // | ],
  5860. // | default: [ "foo.sample._base" ],
  5861. // | common: [ "important.module.common" ]
  5862. // | });
  5863. var result = (modMap.common || []).concat(modMap[dojo._name] || modMap["default"] || []),
  5864. temp;
  5865. while(result.length){
  5866. if(lang.isArray(temp = result.shift())){
  5867. dojo.require.apply(dojo, temp);
  5868. }else{
  5869. dojo.require(temp);
  5870. }
  5871. }
  5872. };
  5873. dojo.requireIf = dojo.requireAfterIf = function(/*Boolean*/ condition, /*String*/ moduleName, /*Boolean?*/omitModuleCheck){
  5874. // summary:
  5875. // If the condition is true then call `dojo.require()` for the specified
  5876. // resource
  5877. //
  5878. // example:
  5879. // | dojo.requireIf(dojo.isBrowser, "my.special.Module");
  5880. if(condition){
  5881. dojo.require(moduleName, omitModuleCheck);
  5882. }
  5883. };
  5884. dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale){
  5885. require(["../i18n"], function(i18n){
  5886. i18n.getLocalization(moduleName, bundleName, locale);
  5887. });
  5888. };
  5889. return {
  5890. extractLegacyApiApplications:extractLegacyApiApplications,
  5891. require:loaderVars.dojoRequirePlugin,
  5892. loadInit:dojoLoadInitPlugin
  5893. };
  5894. });
  5895. },
  5896. 'dojo/json':function(){
  5897. define(["./has"], function(has){
  5898. "use strict";
  5899. var hasJSON = typeof JSON != "undefined";
  5900. has.add("json-parse", hasJSON); // all the parsers work fine
  5901. // Firefox 3.5/Gecko 1.9 fails to use replacer in stringify properly https://bugzilla.mozilla.org/show_bug.cgi?id=509184
  5902. has.add("json-stringify", hasJSON && JSON.stringify({a:0}, function(k,v){return v||1;}) == '{"a":1}');
  5903. if(has("json-stringify")){
  5904. return JSON;
  5905. }
  5906. else{
  5907. var escapeString = function(/*String*/str){
  5908. //summary:
  5909. // Adds escape sequences for non-visual characters, double quote and
  5910. // backslash and surrounds with double quotes to form a valid string
  5911. // literal.
  5912. return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
  5913. replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
  5914. replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
  5915. };
  5916. return {
  5917. parse: has("json-parse") ? JSON.parse : function(str, strict){
  5918. // summary:
  5919. // Parses a [JSON](http://json.org) string to return a JavaScript object.
  5920. // description:
  5921. // This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
  5922. // Throws for invalid JSON strings. This delegates to eval() if native JSON
  5923. // support is not available. By default this will evaluate any valid JS expression.
  5924. // With the strict parameter set to true, the parser will ensure that only
  5925. // valid JSON strings are parsed (otherwise throwing an error). Without the strict
  5926. // parameter, the content passed to this method must come
  5927. // from a trusted source.
  5928. // str:
  5929. // a string literal of a JSON item, for instance:
  5930. // `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
  5931. // strict:
  5932. // When set to true, this will ensure that only valid, secure JSON is ever parsed.
  5933. // Make sure this is set to true for untrusted content. Note that on browsers/engines
  5934. // without native JSON support, setting this to true will run slower.
  5935. if(strict && !/^([\s\[\{]*(?:"(?:\\.|[^"])+"|-?\d[\d\.]*(?:[Ee][+-]?\d+)?|null|true|false|)[\s\]\}]*(?:,|:|$))+$/.test(str)){
  5936. throw new SyntaxError("Invalid characters in JSON");
  5937. }
  5938. return eval('(' + str + ')');
  5939. },
  5940. stringify: function(value, replacer, spacer){
  5941. // summary:
  5942. // Returns a [JSON](http://json.org) serialization of an object.
  5943. // description:
  5944. // Returns a [JSON](http://json.org) serialization of an object.
  5945. // This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
  5946. // Note that this doesn't check for infinite recursion, so don't do that!
  5947. // value:
  5948. // A value to be serialized.
  5949. // replacer:
  5950. // A replacer function that is called for each value and can return a replacement
  5951. // spacer:
  5952. // A spacer string to be used for pretty printing of JSON
  5953. //
  5954. // example:
  5955. // simple serialization of a trivial object
  5956. // | define(["dojo/json"], function(JSON){
  5957. // | var jsonStr = JSON.stringify({ howdy: "stranger!", isStrange: true });
  5958. // | doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
  5959. var undef;
  5960. if(typeof replacer == "string"){
  5961. spacer = replacer;
  5962. replacer = null;
  5963. }
  5964. function stringify(it, indent, key){
  5965. if(replacer){
  5966. it = replacer(key, it);
  5967. }
  5968. var val, objtype = typeof it;
  5969. if(objtype == "number"){
  5970. return isFinite(it) ? it + "" : "null";
  5971. }
  5972. if(objtype == "boolean"){
  5973. return it + "";
  5974. }
  5975. if(it === null){
  5976. return "null";
  5977. }
  5978. if(typeof it == "string"){
  5979. return escapeString(it);
  5980. }
  5981. if(objtype == "function" || objtype == "undefined"){
  5982. return undef; // undefined
  5983. }
  5984. // short-circuit for objects that support "json" serialization
  5985. // if they return "self" then just pass-through...
  5986. if(typeof it.toJSON == "function"){
  5987. return stringify(it.toJSON(key), indent, key);
  5988. }
  5989. if(it instanceof Date){
  5990. return '"{FullYear}-{Month+}-{Date}T{Hours}:{Minutes}:{Seconds}Z"'.replace(/\{(\w+)(\+)?\}/g, function(t, prop, plus){
  5991. var num = it["getUTC" + prop]() + (plus ? 1 : 0);
  5992. return num < 10 ? "0" + num : num;
  5993. });
  5994. }
  5995. if(it.valueOf() !== it){
  5996. // primitive wrapper, try again unwrapped:
  5997. return stringify(it.valueOf(), indent, key);
  5998. }
  5999. var nextIndent= spacer ? (indent + spacer) : "";
  6000. /* we used to test for DOM nodes and throw, but FF serializes them as {}, so cross-browser consistency is probably not efficiently attainable */
  6001. var sep = spacer ? " " : "";
  6002. var newLine = spacer ? "\n" : "";
  6003. // array
  6004. if(it instanceof Array){
  6005. var itl = it.length, res = [];
  6006. for(key = 0; key < itl; key++){
  6007. var obj = it[key];
  6008. val = stringify(obj, nextIndent, key);
  6009. if(typeof val != "string"){
  6010. val = "null";
  6011. }
  6012. res.push(newLine + nextIndent + val);
  6013. }
  6014. return "[" + res.join(",") + newLine + indent + "]";
  6015. }
  6016. // generic object code path
  6017. var output = [];
  6018. for(key in it){
  6019. var keyStr;
  6020. if(typeof key == "number"){
  6021. keyStr = '"' + key + '"';
  6022. }else if(typeof key == "string"){
  6023. keyStr = escapeString(key);
  6024. }else{
  6025. // skip non-string or number keys
  6026. continue;
  6027. }
  6028. val = stringify(it[key], nextIndent, key);
  6029. if(typeof val != "string"){
  6030. // skip non-serializable values
  6031. continue;
  6032. }
  6033. // At this point, the most non-IE browsers don't get in this branch
  6034. // (they have native JSON), so push is definitely the way to
  6035. output.push(newLine + nextIndent + keyStr + ":" + sep + val);
  6036. }
  6037. return "{" + output.join(",") + newLine + indent + "}"; // String
  6038. }
  6039. return stringify(value, "", "");
  6040. }
  6041. };
  6042. }
  6043. });
  6044. },
  6045. 'dojo/_base/declare':function(){
  6046. define(["./kernel", "../has", "./lang"], function(dojo, has, lang){
  6047. // module:
  6048. // dojo/_base/declare
  6049. // summary:
  6050. // This module defines dojo.declare.
  6051. var mix = lang.mixin, op = Object.prototype, opts = op.toString,
  6052. xtor = new Function, counter = 0, cname = "constructor";
  6053. function err(msg, cls){ throw new Error("declare" + (cls ? " " + cls : "") + ": " + msg); }
  6054. // C3 Method Resolution Order (see http://www.python.org/download/releases/2.3/mro/)
  6055. function c3mro(bases, className){
  6056. var result = [], roots = [{cls: 0, refs: []}], nameMap = {}, clsCount = 1,
  6057. l = bases.length, i = 0, j, lin, base, top, proto, rec, name, refs;
  6058. // build a list of bases naming them if needed
  6059. for(; i < l; ++i){
  6060. base = bases[i];
  6061. if(!base){
  6062. err("mixin #" + i + " is unknown. Did you use dojo.require to pull it in?", className);
  6063. }else if(opts.call(base) != "[object Function]"){
  6064. err("mixin #" + i + " is not a callable constructor.", className);
  6065. }
  6066. lin = base._meta ? base._meta.bases : [base];
  6067. top = 0;
  6068. // add bases to the name map
  6069. for(j = lin.length - 1; j >= 0; --j){
  6070. proto = lin[j].prototype;
  6071. if(!proto.hasOwnProperty("declaredClass")){
  6072. proto.declaredClass = "uniqName_" + (counter++);
  6073. }
  6074. name = proto.declaredClass;
  6075. if(!nameMap.hasOwnProperty(name)){
  6076. nameMap[name] = {count: 0, refs: [], cls: lin[j]};
  6077. ++clsCount;
  6078. }
  6079. rec = nameMap[name];
  6080. if(top && top !== rec){
  6081. rec.refs.push(top);
  6082. ++top.count;
  6083. }
  6084. top = rec;
  6085. }
  6086. ++top.count;
  6087. roots[0].refs.push(top);
  6088. }
  6089. // remove classes without external references recursively
  6090. while(roots.length){
  6091. top = roots.pop();
  6092. result.push(top.cls);
  6093. --clsCount;
  6094. // optimization: follow a single-linked chain
  6095. while(refs = top.refs, refs.length == 1){
  6096. top = refs[0];
  6097. if(!top || --top.count){
  6098. // branch or end of chain => do not end to roots
  6099. top = 0;
  6100. break;
  6101. }
  6102. result.push(top.cls);
  6103. --clsCount;
  6104. }
  6105. if(top){
  6106. // branch
  6107. for(i = 0, l = refs.length; i < l; ++i){
  6108. top = refs[i];
  6109. if(!--top.count){
  6110. roots.push(top);
  6111. }
  6112. }
  6113. }
  6114. }
  6115. if(clsCount){
  6116. err("can't build consistent linearization", className);
  6117. }
  6118. // calculate the superclass offset
  6119. base = bases[0];
  6120. result[0] = base ?
  6121. base._meta && base === result[result.length - base._meta.bases.length] ?
  6122. base._meta.bases.length : 1 : 0;
  6123. return result;
  6124. }
  6125. function inherited(args, a, f){
  6126. var name, chains, bases, caller, meta, base, proto, opf, pos,
  6127. cache = this._inherited = this._inherited || {};
  6128. // crack arguments
  6129. if(typeof args == "string"){
  6130. name = args;
  6131. args = a;
  6132. a = f;
  6133. }
  6134. f = 0;
  6135. caller = args.callee;
  6136. name = name || caller.nom;
  6137. if(!name){
  6138. err("can't deduce a name to call inherited()", this.declaredClass);
  6139. }
  6140. meta = this.constructor._meta;
  6141. bases = meta.bases;
  6142. pos = cache.p;
  6143. if(name != cname){
  6144. // method
  6145. if(cache.c !== caller){
  6146. // cache bust
  6147. pos = 0;
  6148. base = bases[0];
  6149. meta = base._meta;
  6150. if(meta.hidden[name] !== caller){
  6151. // error detection
  6152. chains = meta.chains;
  6153. if(chains && typeof chains[name] == "string"){
  6154. err("calling chained method with inherited: " + name, this.declaredClass);
  6155. }
  6156. // find caller
  6157. do{
  6158. meta = base._meta;
  6159. proto = base.prototype;
  6160. if(meta && (proto[name] === caller && proto.hasOwnProperty(name) || meta.hidden[name] === caller)){
  6161. break;
  6162. }
  6163. }while(base = bases[++pos]); // intentional assignment
  6164. pos = base ? pos : -1;
  6165. }
  6166. }
  6167. // find next
  6168. base = bases[++pos];
  6169. if(base){
  6170. proto = base.prototype;
  6171. if(base._meta && proto.hasOwnProperty(name)){
  6172. f = proto[name];
  6173. }else{
  6174. opf = op[name];
  6175. do{
  6176. proto = base.prototype;
  6177. f = proto[name];
  6178. if(f && (base._meta ? proto.hasOwnProperty(name) : f !== opf)){
  6179. break;
  6180. }
  6181. }while(base = bases[++pos]); // intentional assignment
  6182. }
  6183. }
  6184. f = base && f || op[name];
  6185. }else{
  6186. // constructor
  6187. if(cache.c !== caller){
  6188. // cache bust
  6189. pos = 0;
  6190. meta = bases[0]._meta;
  6191. if(meta && meta.ctor !== caller){
  6192. // error detection
  6193. chains = meta.chains;
  6194. if(!chains || chains.constructor !== "manual"){
  6195. err("calling chained constructor with inherited", this.declaredClass);
  6196. }
  6197. // find caller
  6198. while(base = bases[++pos]){ // intentional assignment
  6199. meta = base._meta;
  6200. if(meta && meta.ctor === caller){
  6201. break;
  6202. }
  6203. }
  6204. pos = base ? pos : -1;
  6205. }
  6206. }
  6207. // find next
  6208. while(base = bases[++pos]){ // intentional assignment
  6209. meta = base._meta;
  6210. f = meta ? meta.ctor : base;
  6211. if(f){
  6212. break;
  6213. }
  6214. }
  6215. f = base && f;
  6216. }
  6217. // cache the found super method
  6218. cache.c = f;
  6219. cache.p = pos;
  6220. // now we have the result
  6221. if(f){
  6222. return a === true ? f : f.apply(this, a || args);
  6223. }
  6224. // intentionally no return if a super method was not found
  6225. }
  6226. function getInherited(name, args){
  6227. if(typeof name == "string"){
  6228. return this.__inherited(name, args, true);
  6229. }
  6230. return this.__inherited(name, true);
  6231. }
  6232. function inherited__debug(args, a1, a2){
  6233. var f = this.getInherited(args, a1);
  6234. if(f){ return f.apply(this, a2 || a1 || args); }
  6235. // intentionally no return if a super method was not found
  6236. }
  6237. var inheritedImpl = dojo.config.isDebug ? inherited__debug : inherited;
  6238. // emulation of "instanceof"
  6239. function isInstanceOf(cls){
  6240. var bases = this.constructor._meta.bases;
  6241. for(var i = 0, l = bases.length; i < l; ++i){
  6242. if(bases[i] === cls){
  6243. return true;
  6244. }
  6245. }
  6246. return this instanceof cls;
  6247. }
  6248. function mixOwn(target, source){
  6249. // add props adding metadata for incoming functions skipping a constructor
  6250. for(var name in source){
  6251. if(name != cname && source.hasOwnProperty(name)){
  6252. target[name] = source[name];
  6253. }
  6254. }
  6255. if(has("bug-for-in-skips-shadowed")){
  6256. for(var extraNames= lang._extraNames, i= extraNames.length; i;){
  6257. name = extraNames[--i];
  6258. if(name != cname && source.hasOwnProperty(name)){
  6259. target[name] = source[name];
  6260. }
  6261. }
  6262. }
  6263. }
  6264. // implementation of safe mixin function
  6265. function safeMixin(target, source){
  6266. var name, t;
  6267. // add props adding metadata for incoming functions skipping a constructor
  6268. for(name in source){
  6269. t = source[name];
  6270. if((t !== op[name] || !(name in op)) && name != cname){
  6271. if(opts.call(t) == "[object Function]"){
  6272. // non-trivial function method => attach its name
  6273. t.nom = name;
  6274. }
  6275. target[name] = t;
  6276. }
  6277. }
  6278. if(has("bug-for-in-skips-shadowed")){
  6279. for(var extraNames= lang._extraNames, i= extraNames.length; i;){
  6280. name = extraNames[--i];
  6281. t = source[name];
  6282. if((t !== op[name] || !(name in op)) && name != cname){
  6283. if(opts.call(t) == "[object Function]"){
  6284. // non-trivial function method => attach its name
  6285. t.nom = name;
  6286. }
  6287. target[name] = t;
  6288. }
  6289. }
  6290. }
  6291. return target;
  6292. }
  6293. function extend(source){
  6294. declare.safeMixin(this.prototype, source);
  6295. return this;
  6296. }
  6297. function createSubclass(mixins){
  6298. return declare([this].concat(mixins));
  6299. }
  6300. // chained constructor compatible with the legacy dojo.declare()
  6301. function chainedConstructor(bases, ctorSpecial){
  6302. return function(){
  6303. var a = arguments, args = a, a0 = a[0], f, i, m,
  6304. l = bases.length, preArgs;
  6305. if(!(this instanceof a.callee)){
  6306. // not called via new, so force it
  6307. return applyNew(a);
  6308. }
  6309. //this._inherited = {};
  6310. // perform the shaman's rituals of the original dojo.declare()
  6311. // 1) call two types of the preamble
  6312. if(ctorSpecial && (a0 && a0.preamble || this.preamble)){
  6313. // full blown ritual
  6314. preArgs = new Array(bases.length);
  6315. // prepare parameters
  6316. preArgs[0] = a;
  6317. for(i = 0;;){
  6318. // process the preamble of the 1st argument
  6319. a0 = a[0];
  6320. if(a0){
  6321. f = a0.preamble;
  6322. if(f){
  6323. a = f.apply(this, a) || a;
  6324. }
  6325. }
  6326. // process the preamble of this class
  6327. f = bases[i].prototype;
  6328. f = f.hasOwnProperty("preamble") && f.preamble;
  6329. if(f){
  6330. a = f.apply(this, a) || a;
  6331. }
  6332. // one peculiarity of the preamble:
  6333. // it is called if it is not needed,
  6334. // e.g., there is no constructor to call
  6335. // let's watch for the last constructor
  6336. // (see ticket #9795)
  6337. if(++i == l){
  6338. break;
  6339. }
  6340. preArgs[i] = a;
  6341. }
  6342. }
  6343. // 2) call all non-trivial constructors using prepared arguments
  6344. for(i = l - 1; i >= 0; --i){
  6345. f = bases[i];
  6346. m = f._meta;
  6347. f = m ? m.ctor : f;
  6348. if(f){
  6349. f.apply(this, preArgs ? preArgs[i] : a);
  6350. }
  6351. }
  6352. // 3) continue the original ritual: call the postscript
  6353. f = this.postscript;
  6354. if(f){
  6355. f.apply(this, args);
  6356. }
  6357. };
  6358. }
  6359. // chained constructor compatible with the legacy dojo.declare()
  6360. function singleConstructor(ctor, ctorSpecial){
  6361. return function(){
  6362. var a = arguments, t = a, a0 = a[0], f;
  6363. if(!(this instanceof a.callee)){
  6364. // not called via new, so force it
  6365. return applyNew(a);
  6366. }
  6367. //this._inherited = {};
  6368. // perform the shaman's rituals of the original dojo.declare()
  6369. // 1) call two types of the preamble
  6370. if(ctorSpecial){
  6371. // full blown ritual
  6372. if(a0){
  6373. // process the preamble of the 1st argument
  6374. f = a0.preamble;
  6375. if(f){
  6376. t = f.apply(this, t) || t;
  6377. }
  6378. }
  6379. f = this.preamble;
  6380. if(f){
  6381. // process the preamble of this class
  6382. f.apply(this, t);
  6383. // one peculiarity of the preamble:
  6384. // it is called even if it is not needed,
  6385. // e.g., there is no constructor to call
  6386. // let's watch for the last constructor
  6387. // (see ticket #9795)
  6388. }
  6389. }
  6390. // 2) call a constructor
  6391. if(ctor){
  6392. ctor.apply(this, a);
  6393. }
  6394. // 3) continue the original ritual: call the postscript
  6395. f = this.postscript;
  6396. if(f){
  6397. f.apply(this, a);
  6398. }
  6399. };
  6400. }
  6401. // plain vanilla constructor (can use inherited() to call its base constructor)
  6402. function simpleConstructor(bases){
  6403. return function(){
  6404. var a = arguments, i = 0, f, m;
  6405. if(!(this instanceof a.callee)){
  6406. // not called via new, so force it
  6407. return applyNew(a);
  6408. }
  6409. //this._inherited = {};
  6410. // perform the shaman's rituals of the original dojo.declare()
  6411. // 1) do not call the preamble
  6412. // 2) call the top constructor (it can use this.inherited())
  6413. for(; f = bases[i]; ++i){ // intentional assignment
  6414. m = f._meta;
  6415. f = m ? m.ctor : f;
  6416. if(f){
  6417. f.apply(this, a);
  6418. break;
  6419. }
  6420. }
  6421. // 3) call the postscript
  6422. f = this.postscript;
  6423. if(f){
  6424. f.apply(this, a);
  6425. }
  6426. };
  6427. }
  6428. function chain(name, bases, reversed){
  6429. return function(){
  6430. var b, m, f, i = 0, step = 1;
  6431. if(reversed){
  6432. i = bases.length - 1;
  6433. step = -1;
  6434. }
  6435. for(; b = bases[i]; i += step){ // intentional assignment
  6436. m = b._meta;
  6437. f = (m ? m.hidden : b.prototype)[name];
  6438. if(f){
  6439. f.apply(this, arguments);
  6440. }
  6441. }
  6442. };
  6443. }
  6444. // forceNew(ctor)
  6445. // return a new object that inherits from ctor.prototype but
  6446. // without actually running ctor on the object.
  6447. function forceNew(ctor){
  6448. // create object with correct prototype using a do-nothing
  6449. // constructor
  6450. xtor.prototype = ctor.prototype;
  6451. var t = new xtor;
  6452. xtor.prototype = null; // clean up
  6453. return t;
  6454. }
  6455. // applyNew(args)
  6456. // just like 'new ctor()' except that the constructor and its arguments come
  6457. // from args, which must be an array or an arguments object
  6458. function applyNew(args){
  6459. // create an object with ctor's prototype but without
  6460. // calling ctor on it.
  6461. var ctor = args.callee, t = forceNew(ctor);
  6462. // execute the real constructor on the new object
  6463. ctor.apply(t, args);
  6464. return t;
  6465. }
  6466. function declare(className, superclass, props){
  6467. // crack parameters
  6468. if(typeof className != "string"){
  6469. props = superclass;
  6470. superclass = className;
  6471. className = "";
  6472. }
  6473. props = props || {};
  6474. var proto, i, t, ctor, name, bases, chains, mixins = 1, parents = superclass;
  6475. // build a prototype
  6476. if(opts.call(superclass) == "[object Array]"){
  6477. // C3 MRO
  6478. bases = c3mro(superclass, className);
  6479. t = bases[0];
  6480. mixins = bases.length - t;
  6481. superclass = bases[mixins];
  6482. }else{
  6483. bases = [0];
  6484. if(superclass){
  6485. if(opts.call(superclass) == "[object Function]"){
  6486. t = superclass._meta;
  6487. bases = bases.concat(t ? t.bases : superclass);
  6488. }else{
  6489. err("base class is not a callable constructor.", className);
  6490. }
  6491. }else if(superclass !== null){
  6492. err("unknown base class. Did you use dojo.require to pull it in?", className);
  6493. }
  6494. }
  6495. if(superclass){
  6496. for(i = mixins - 1;; --i){
  6497. proto = forceNew(superclass);
  6498. if(!i){
  6499. // stop if nothing to add (the last base)
  6500. break;
  6501. }
  6502. // mix in properties
  6503. t = bases[i];
  6504. (t._meta ? mixOwn : mix)(proto, t.prototype);
  6505. // chain in new constructor
  6506. ctor = new Function;
  6507. ctor.superclass = superclass;
  6508. ctor.prototype = proto;
  6509. superclass = proto.constructor = ctor;
  6510. }
  6511. }else{
  6512. proto = {};
  6513. }
  6514. // add all properties
  6515. declare.safeMixin(proto, props);
  6516. // add constructor
  6517. t = props.constructor;
  6518. if(t !== op.constructor){
  6519. t.nom = cname;
  6520. proto.constructor = t;
  6521. }
  6522. // collect chains and flags
  6523. for(i = mixins - 1; i; --i){ // intentional assignment
  6524. t = bases[i]._meta;
  6525. if(t && t.chains){
  6526. chains = mix(chains || {}, t.chains);
  6527. }
  6528. }
  6529. if(proto["-chains-"]){
  6530. chains = mix(chains || {}, proto["-chains-"]);
  6531. }
  6532. // build ctor
  6533. t = !chains || !chains.hasOwnProperty(cname);
  6534. bases[0] = ctor = (chains && chains.constructor === "manual") ? simpleConstructor(bases) :
  6535. (bases.length == 1 ? singleConstructor(props.constructor, t) : chainedConstructor(bases, t));
  6536. // add meta information to the constructor
  6537. ctor._meta = {bases: bases, hidden: props, chains: chains,
  6538. parents: parents, ctor: props.constructor};
  6539. ctor.superclass = superclass && superclass.prototype;
  6540. ctor.extend = extend;
  6541. ctor.createSubclass = createSubclass;
  6542. ctor.prototype = proto;
  6543. proto.constructor = ctor;
  6544. // add "standard" methods to the prototype
  6545. proto.getInherited = getInherited;
  6546. proto.isInstanceOf = isInstanceOf;
  6547. proto.inherited = inheritedImpl;
  6548. proto.__inherited = inherited;
  6549. // add name if specified
  6550. if(className){
  6551. proto.declaredClass = className;
  6552. lang.setObject(className, ctor);
  6553. }
  6554. // build chains and add them to the prototype
  6555. if(chains){
  6556. for(name in chains){
  6557. if(proto[name] && typeof chains[name] == "string" && name != cname){
  6558. t = proto[name] = chain(name, bases, chains[name] === "after");
  6559. t.nom = name;
  6560. }
  6561. }
  6562. }
  6563. // chained methods do not return values
  6564. // no need to chain "invisible" functions
  6565. return ctor; // Function
  6566. }
  6567. /*=====
  6568. dojo.declare = function(className, superclass, props){
  6569. // summary:
  6570. // Create a feature-rich constructor from compact notation.
  6571. // className: String?:
  6572. // The optional name of the constructor (loosely, a "class")
  6573. // stored in the "declaredClass" property in the created prototype.
  6574. // It will be used as a global name for a created constructor.
  6575. // superclass: Function|Function[]:
  6576. // May be null, a Function, or an Array of Functions. This argument
  6577. // specifies a list of bases (the left-most one is the most deepest
  6578. // base).
  6579. // props: Object:
  6580. // An object whose properties are copied to the created prototype.
  6581. // Add an instance-initialization function by making it a property
  6582. // named "constructor".
  6583. // returns:
  6584. // New constructor function.
  6585. // description:
  6586. // Create a constructor using a compact notation for inheritance and
  6587. // prototype extension.
  6588. //
  6589. // Mixin ancestors provide a type of multiple inheritance.
  6590. // Prototypes of mixin ancestors are copied to the new class:
  6591. // changes to mixin prototypes will not affect classes to which
  6592. // they have been mixed in.
  6593. //
  6594. // Ancestors can be compound classes created by this version of
  6595. // dojo.declare. In complex cases all base classes are going to be
  6596. // linearized according to C3 MRO algorithm
  6597. // (see http://www.python.org/download/releases/2.3/mro/ for more
  6598. // details).
  6599. //
  6600. // "className" is cached in "declaredClass" property of the new class,
  6601. // if it was supplied. The immediate super class will be cached in
  6602. // "superclass" property of the new class.
  6603. //
  6604. // Methods in "props" will be copied and modified: "nom" property
  6605. // (the declared name of the method) will be added to all copied
  6606. // functions to help identify them for the internal machinery. Be
  6607. // very careful, while reusing methods: if you use the same
  6608. // function under different names, it can produce errors in some
  6609. // cases.
  6610. //
  6611. // It is possible to use constructors created "manually" (without
  6612. // dojo.declare) as bases. They will be called as usual during the
  6613. // creation of an instance, their methods will be chained, and even
  6614. // called by "this.inherited()".
  6615. //
  6616. // Special property "-chains-" governs how to chain methods. It is
  6617. // a dictionary, which uses method names as keys, and hint strings
  6618. // as values. If a hint string is "after", this method will be
  6619. // called after methods of its base classes. If a hint string is
  6620. // "before", this method will be called before methods of its base
  6621. // classes.
  6622. //
  6623. // If "constructor" is not mentioned in "-chains-" property, it will
  6624. // be chained using the legacy mode: using "after" chaining,
  6625. // calling preamble() method before each constructor, if available,
  6626. // and calling postscript() after all constructors were executed.
  6627. // If the hint is "after", it is chained as a regular method, but
  6628. // postscript() will be called after the chain of constructors.
  6629. // "constructor" cannot be chained "before", but it allows
  6630. // a special hint string: "manual", which means that constructors
  6631. // are not going to be chained in any way, and programmer will call
  6632. // them manually using this.inherited(). In the latter case
  6633. // postscript() will be called after the construction.
  6634. //
  6635. // All chaining hints are "inherited" from base classes and
  6636. // potentially can be overridden. Be very careful when overriding
  6637. // hints! Make sure that all chained methods can work in a proposed
  6638. // manner of chaining.
  6639. //
  6640. // Once a method was chained, it is impossible to unchain it. The
  6641. // only exception is "constructor". You don't need to define a
  6642. // method in order to supply a chaining hint.
  6643. //
  6644. // If a method is chained, it cannot use this.inherited() because
  6645. // all other methods in the hierarchy will be called automatically.
  6646. //
  6647. // Usually constructors and initializers of any kind are chained
  6648. // using "after" and destructors of any kind are chained as
  6649. // "before". Note that chaining assumes that chained methods do not
  6650. // return any value: any returned value will be discarded.
  6651. //
  6652. // example:
  6653. // | dojo.declare("my.classes.bar", my.classes.foo, {
  6654. // | // properties to be added to the class prototype
  6655. // | someValue: 2,
  6656. // | // initialization function
  6657. // | constructor: function(){
  6658. // | this.myComplicatedObject = new ReallyComplicatedObject();
  6659. // | },
  6660. // | // other functions
  6661. // | someMethod: function(){
  6662. // | doStuff();
  6663. // | }
  6664. // | });
  6665. //
  6666. // example:
  6667. // | var MyBase = dojo.declare(null, {
  6668. // | // constructor, properties, and methods go here
  6669. // | // ...
  6670. // | });
  6671. // | var MyClass1 = dojo.declare(MyBase, {
  6672. // | // constructor, properties, and methods go here
  6673. // | // ...
  6674. // | });
  6675. // | var MyClass2 = dojo.declare(MyBase, {
  6676. // | // constructor, properties, and methods go here
  6677. // | // ...
  6678. // | });
  6679. // | var MyDiamond = dojo.declare([MyClass1, MyClass2], {
  6680. // | // constructor, properties, and methods go here
  6681. // | // ...
  6682. // | });
  6683. //
  6684. // example:
  6685. // | var F = function(){ console.log("raw constructor"); };
  6686. // | F.prototype.method = function(){
  6687. // | console.log("raw method");
  6688. // | };
  6689. // | var A = dojo.declare(F, {
  6690. // | constructor: function(){
  6691. // | console.log("A.constructor");
  6692. // | },
  6693. // | method: function(){
  6694. // | console.log("before calling F.method...");
  6695. // | this.inherited(arguments);
  6696. // | console.log("...back in A");
  6697. // | }
  6698. // | });
  6699. // | new A().method();
  6700. // | // will print:
  6701. // | // raw constructor
  6702. // | // A.constructor
  6703. // | // before calling F.method...
  6704. // | // raw method
  6705. // | // ...back in A
  6706. //
  6707. // example:
  6708. // | var A = dojo.declare(null, {
  6709. // | "-chains-": {
  6710. // | destroy: "before"
  6711. // | }
  6712. // | });
  6713. // | var B = dojo.declare(A, {
  6714. // | constructor: function(){
  6715. // | console.log("B.constructor");
  6716. // | },
  6717. // | destroy: function(){
  6718. // | console.log("B.destroy");
  6719. // | }
  6720. // | });
  6721. // | var C = dojo.declare(B, {
  6722. // | constructor: function(){
  6723. // | console.log("C.constructor");
  6724. // | },
  6725. // | destroy: function(){
  6726. // | console.log("C.destroy");
  6727. // | }
  6728. // | });
  6729. // | new C().destroy();
  6730. // | // prints:
  6731. // | // B.constructor
  6732. // | // C.constructor
  6733. // | // C.destroy
  6734. // | // B.destroy
  6735. //
  6736. // example:
  6737. // | var A = dojo.declare(null, {
  6738. // | "-chains-": {
  6739. // | constructor: "manual"
  6740. // | }
  6741. // | });
  6742. // | var B = dojo.declare(A, {
  6743. // | constructor: function(){
  6744. // | // ...
  6745. // | // call the base constructor with new parameters
  6746. // | this.inherited(arguments, [1, 2, 3]);
  6747. // | // ...
  6748. // | }
  6749. // | });
  6750. //
  6751. // example:
  6752. // | var A = dojo.declare(null, {
  6753. // | "-chains-": {
  6754. // | m1: "before"
  6755. // | },
  6756. // | m1: function(){
  6757. // | console.log("A.m1");
  6758. // | },
  6759. // | m2: function(){
  6760. // | console.log("A.m2");
  6761. // | }
  6762. // | });
  6763. // | var B = dojo.declare(A, {
  6764. // | "-chains-": {
  6765. // | m2: "after"
  6766. // | },
  6767. // | m1: function(){
  6768. // | console.log("B.m1");
  6769. // | },
  6770. // | m2: function(){
  6771. // | console.log("B.m2");
  6772. // | }
  6773. // | });
  6774. // | var x = new B();
  6775. // | x.m1();
  6776. // | // prints:
  6777. // | // B.m1
  6778. // | // A.m1
  6779. // | x.m2();
  6780. // | // prints:
  6781. // | // A.m2
  6782. // | // B.m2
  6783. return new Function(); // Function
  6784. };
  6785. =====*/
  6786. /*=====
  6787. dojo.safeMixin = function(target, source){
  6788. // summary:
  6789. // Mix in properties skipping a constructor and decorating functions
  6790. // like it is done by dojo.declare.
  6791. // target: Object
  6792. // Target object to accept new properties.
  6793. // source: Object
  6794. // Source object for new properties.
  6795. // description:
  6796. // This function is used to mix in properties like lang.mixin does,
  6797. // but it skips a constructor property and decorates functions like
  6798. // dojo.declare does.
  6799. //
  6800. // It is meant to be used with classes and objects produced with
  6801. // dojo.declare. Functions mixed in with dojo.safeMixin can use
  6802. // this.inherited() like normal methods.
  6803. //
  6804. // This function is used to implement extend() method of a constructor
  6805. // produced with dojo.declare().
  6806. //
  6807. // example:
  6808. // | var A = dojo.declare(null, {
  6809. // | m1: function(){
  6810. // | console.log("A.m1");
  6811. // | },
  6812. // | m2: function(){
  6813. // | console.log("A.m2");
  6814. // | }
  6815. // | });
  6816. // | var B = dojo.declare(A, {
  6817. // | m1: function(){
  6818. // | this.inherited(arguments);
  6819. // | console.log("B.m1");
  6820. // | }
  6821. // | });
  6822. // | B.extend({
  6823. // | m2: function(){
  6824. // | this.inherited(arguments);
  6825. // | console.log("B.m2");
  6826. // | }
  6827. // | });
  6828. // | var x = new B();
  6829. // | dojo.safeMixin(x, {
  6830. // | m1: function(){
  6831. // | this.inherited(arguments);
  6832. // | console.log("X.m1");
  6833. // | },
  6834. // | m2: function(){
  6835. // | this.inherited(arguments);
  6836. // | console.log("X.m2");
  6837. // | }
  6838. // | });
  6839. // | x.m2();
  6840. // | // prints:
  6841. // | // A.m1
  6842. // | // B.m1
  6843. // | // X.m1
  6844. };
  6845. =====*/
  6846. /*=====
  6847. Object.inherited = function(name, args, newArgs){
  6848. // summary:
  6849. // Calls a super method.
  6850. // name: String?
  6851. // The optional method name. Should be the same as the caller's
  6852. // name. Usually "name" is specified in complex dynamic cases, when
  6853. // the calling method was dynamically added, undecorated by
  6854. // dojo.declare, and it cannot be determined.
  6855. // args: Arguments
  6856. // The caller supply this argument, which should be the original
  6857. // "arguments".
  6858. // newArgs: Object?
  6859. // If "true", the found function will be returned without
  6860. // executing it.
  6861. // If Array, it will be used to call a super method. Otherwise
  6862. // "args" will be used.
  6863. // returns:
  6864. // Whatever is returned by a super method, or a super method itself,
  6865. // if "true" was specified as newArgs.
  6866. // description:
  6867. // This method is used inside method of classes produced with
  6868. // dojo.declare to call a super method (next in the chain). It is
  6869. // used for manually controlled chaining. Consider using the regular
  6870. // chaining, because it is faster. Use "this.inherited()" only in
  6871. // complex cases.
  6872. //
  6873. // This method cannot me called from automatically chained
  6874. // constructors including the case of a special (legacy)
  6875. // constructor chaining. It cannot be called from chained methods.
  6876. //
  6877. // If "this.inherited()" cannot find the next-in-chain method, it
  6878. // does nothing and returns "undefined". The last method in chain
  6879. // can be a default method implemented in Object, which will be
  6880. // called last.
  6881. //
  6882. // If "name" is specified, it is assumed that the method that
  6883. // received "args" is the parent method for this call. It is looked
  6884. // up in the chain list and if it is found the next-in-chain method
  6885. // is called. If it is not found, the first-in-chain method is
  6886. // called.
  6887. //
  6888. // If "name" is not specified, it will be derived from the calling
  6889. // method (using a methoid property "nom").
  6890. //
  6891. // example:
  6892. // | var B = dojo.declare(A, {
  6893. // | method1: function(a, b, c){
  6894. // | this.inherited(arguments);
  6895. // | },
  6896. // | method2: function(a, b){
  6897. // | return this.inherited(arguments, [a + b]);
  6898. // | }
  6899. // | });
  6900. // | // next method is not in the chain list because it is added
  6901. // | // manually after the class was created.
  6902. // | B.prototype.method3 = function(){
  6903. // | console.log("This is a dynamically-added method.");
  6904. // | this.inherited("method3", arguments);
  6905. // | };
  6906. // example:
  6907. // | var B = dojo.declare(A, {
  6908. // | method: function(a, b){
  6909. // | var super = this.inherited(arguments, true);
  6910. // | // ...
  6911. // | if(!super){
  6912. // | console.log("there is no super method");
  6913. // | return 0;
  6914. // | }
  6915. // | return super.apply(this, arguments);
  6916. // | }
  6917. // | });
  6918. return {}; // Object
  6919. }
  6920. =====*/
  6921. /*=====
  6922. Object.getInherited = function(name, args){
  6923. // summary:
  6924. // Returns a super method.
  6925. // name: String?
  6926. // The optional method name. Should be the same as the caller's
  6927. // name. Usually "name" is specified in complex dynamic cases, when
  6928. // the calling method was dynamically added, undecorated by
  6929. // dojo.declare, and it cannot be determined.
  6930. // args: Arguments
  6931. // The caller supply this argument, which should be the original
  6932. // "arguments".
  6933. // returns:
  6934. // Returns a super method (Function) or "undefined".
  6935. // description:
  6936. // This method is a convenience method for "this.inherited()".
  6937. // It uses the same algorithm but instead of executing a super
  6938. // method, it returns it, or "undefined" if not found.
  6939. //
  6940. // example:
  6941. // | var B = dojo.declare(A, {
  6942. // | method: function(a, b){
  6943. // | var super = this.getInherited(arguments);
  6944. // | // ...
  6945. // | if(!super){
  6946. // | console.log("there is no super method");
  6947. // | return 0;
  6948. // | }
  6949. // | return super.apply(this, arguments);
  6950. // | }
  6951. // | });
  6952. return {}; // Object
  6953. }
  6954. =====*/
  6955. /*=====
  6956. Object.isInstanceOf = function(cls){
  6957. // summary:
  6958. // Checks the inheritance chain to see if it is inherited from this
  6959. // class.
  6960. // cls: Function
  6961. // Class constructor.
  6962. // returns:
  6963. // "true", if this object is inherited from this class, "false"
  6964. // otherwise.
  6965. // description:
  6966. // This method is used with instances of classes produced with
  6967. // dojo.declare to determine of they support a certain interface or
  6968. // not. It models "instanceof" operator.
  6969. //
  6970. // example:
  6971. // | var A = dojo.declare(null, {
  6972. // | // constructor, properties, and methods go here
  6973. // | // ...
  6974. // | });
  6975. // | var B = dojo.declare(null, {
  6976. // | // constructor, properties, and methods go here
  6977. // | // ...
  6978. // | });
  6979. // | var C = dojo.declare([A, B], {
  6980. // | // constructor, properties, and methods go here
  6981. // | // ...
  6982. // | });
  6983. // | var D = dojo.declare(A, {
  6984. // | // constructor, properties, and methods go here
  6985. // | // ...
  6986. // | });
  6987. // |
  6988. // | var a = new A(), b = new B(), c = new C(), d = new D();
  6989. // |
  6990. // | console.log(a.isInstanceOf(A)); // true
  6991. // | console.log(b.isInstanceOf(A)); // false
  6992. // | console.log(c.isInstanceOf(A)); // true
  6993. // | console.log(d.isInstanceOf(A)); // true
  6994. // |
  6995. // | console.log(a.isInstanceOf(B)); // false
  6996. // | console.log(b.isInstanceOf(B)); // true
  6997. // | console.log(c.isInstanceOf(B)); // true
  6998. // | console.log(d.isInstanceOf(B)); // false
  6999. // |
  7000. // | console.log(a.isInstanceOf(C)); // false
  7001. // | console.log(b.isInstanceOf(C)); // false
  7002. // | console.log(c.isInstanceOf(C)); // true
  7003. // | console.log(d.isInstanceOf(C)); // false
  7004. // |
  7005. // | console.log(a.isInstanceOf(D)); // false
  7006. // | console.log(b.isInstanceOf(D)); // false
  7007. // | console.log(c.isInstanceOf(D)); // false
  7008. // | console.log(d.isInstanceOf(D)); // true
  7009. return {}; // Object
  7010. }
  7011. =====*/
  7012. /*=====
  7013. Object.extend = function(source){
  7014. // summary:
  7015. // Adds all properties and methods of source to constructor's
  7016. // prototype, making them available to all instances created with
  7017. // constructor. This method is specific to constructors created with
  7018. // dojo.declare.
  7019. // source: Object
  7020. // Source object which properties are going to be copied to the
  7021. // constructor's prototype.
  7022. // description:
  7023. // Adds source properties to the constructor's prototype. It can
  7024. // override existing properties.
  7025. //
  7026. // This method is similar to dojo.extend function, but it is specific
  7027. // to constructors produced by dojo.declare. It is implemented
  7028. // using dojo.safeMixin, and it skips a constructor property,
  7029. // and properly decorates copied functions.
  7030. //
  7031. // example:
  7032. // | var A = dojo.declare(null, {
  7033. // | m1: function(){},
  7034. // | s1: "Popokatepetl"
  7035. // | });
  7036. // | A.extend({
  7037. // | m1: function(){},
  7038. // | m2: function(){},
  7039. // | f1: true,
  7040. // | d1: 42
  7041. // | });
  7042. };
  7043. =====*/
  7044. dojo.safeMixin = declare.safeMixin = safeMixin;
  7045. dojo.declare = declare;
  7046. return declare;
  7047. });
  7048. },
  7049. 'dojo/dom':function(){
  7050. define(["./_base/sniff", "./_base/lang", "./_base/window"],
  7051. function(has, lang, win){
  7052. // module:
  7053. // dojo/dom
  7054. // summary:
  7055. // This module defines the core dojo DOM API.
  7056. // FIXME: need to add unit tests for all the semi-public methods
  7057. try{
  7058. document.execCommand("BackgroundImageCache", false, true);
  7059. }catch(e){
  7060. // sane browsers don't have cache "issues"
  7061. }
  7062. // =============================
  7063. // DOM Functions
  7064. // =============================
  7065. /*=====
  7066. dojo.byId = function(id, doc){
  7067. // summary:
  7068. // Returns DOM node with matching `id` attribute or `null`
  7069. // if not found. If `id` is a DomNode, this function is a no-op.
  7070. //
  7071. // id: String|DOMNode
  7072. // A string to match an HTML id attribute or a reference to a DOM Node
  7073. //
  7074. // doc: Document?
  7075. // Document to work in. Defaults to the current value of
  7076. // dojo.doc. Can be used to retrieve
  7077. // node references from other documents.
  7078. //
  7079. // example:
  7080. // Look up a node by ID:
  7081. // | var n = dojo.byId("foo");
  7082. //
  7083. // example:
  7084. // Check if a node exists, and use it.
  7085. // | var n = dojo.byId("bar");
  7086. // | if(n){ doStuff() ... }
  7087. //
  7088. // example:
  7089. // Allow string or DomNode references to be passed to a custom function:
  7090. // | var foo = function(nodeOrId){
  7091. // | nodeOrId = dojo.byId(nodeOrId);
  7092. // | // ... more stuff
  7093. // | }
  7094. =====*/
  7095. /*=====
  7096. dojo.isDescendant = function(node, ancestor){
  7097. // summary:
  7098. // Returns true if node is a descendant of ancestor
  7099. // node: DOMNode|String
  7100. // string id or node reference to test
  7101. // ancestor: DOMNode|String
  7102. // string id or node reference of potential parent to test against
  7103. //
  7104. // example:
  7105. // Test is node id="bar" is a descendant of node id="foo"
  7106. // | if(dojo.isDescendant("bar", "foo")){ ... }
  7107. };
  7108. =====*/
  7109. // TODO: do we need this function in the base?
  7110. /*=====
  7111. dojo.setSelectable = function(node, selectable){
  7112. // summary:
  7113. // Enable or disable selection on a node
  7114. // node: DOMNode|String
  7115. // id or reference to node
  7116. // selectable: Boolean
  7117. // state to put the node in. false indicates unselectable, true
  7118. // allows selection.
  7119. // example:
  7120. // Make the node id="bar" unselectable
  7121. // | dojo.setSelectable("bar");
  7122. // example:
  7123. // Make the node id="bar" selectable
  7124. // | dojo.setSelectable("bar", true);
  7125. };
  7126. =====*/
  7127. var dom = {}; // the result object
  7128. if(has("ie")){
  7129. dom.byId = function(id, doc){
  7130. if(typeof id != "string"){
  7131. return id;
  7132. }
  7133. var _d = doc || win.doc, te = id && _d.getElementById(id);
  7134. // attributes.id.value is better than just id in case the
  7135. // user has a name=id inside a form
  7136. if(te && (te.attributes.id.value == id || te.id == id)){
  7137. return te;
  7138. }else{
  7139. var eles = _d.all[id];
  7140. if(!eles || eles.nodeName){
  7141. eles = [eles];
  7142. }
  7143. // if more than 1, choose first with the correct id
  7144. var i = 0;
  7145. while((te = eles[i++])){
  7146. if((te.attributes && te.attributes.id && te.attributes.id.value == id) || te.id == id){
  7147. return te;
  7148. }
  7149. }
  7150. }
  7151. };
  7152. }else{
  7153. dom.byId = function(id, doc){
  7154. // inline'd type check.
  7155. // be sure to return null per documentation, to match IE branch.
  7156. return ((typeof id == "string") ? (doc || win.doc).getElementById(id) : id) || null; // DOMNode
  7157. };
  7158. }
  7159. /*=====
  7160. };
  7161. =====*/
  7162. dom.isDescendant = function(/*DOMNode|String*/node, /*DOMNode|String*/ancestor){
  7163. try{
  7164. node = dom.byId(node);
  7165. ancestor = dom.byId(ancestor);
  7166. while(node){
  7167. if(node == ancestor){
  7168. return true; // Boolean
  7169. }
  7170. node = node.parentNode;
  7171. }
  7172. }catch(e){ /* squelch, return false */ }
  7173. return false; // Boolean
  7174. };
  7175. // TODO: do we need this function in the base?
  7176. // Add feature test for user-select CSS property
  7177. // (currently known to work in all but IE < 10 and Opera)
  7178. // TODO: The user-select CSS property as of May 2014 is no longer part of
  7179. // any CSS specification. In IE, -ms-user-select does not do the same thing
  7180. // as the unselectable attribute on elements; namely, dijit Editor buttons
  7181. // do not properly prevent the content of the editable content frame from
  7182. // unblurring. As a result, the -ms- prefixed version is omitted here.
  7183. has.add("css-user-select", function(global, doc, element){
  7184. // Avoid exception when dom.js is loaded in non-browser environments
  7185. if(!element){ return false; }
  7186. var style = element.style;
  7187. var prefixes = ["Khtml", "O", "Moz", "Webkit"],
  7188. i = prefixes.length,
  7189. name = "userSelect",
  7190. prefix;
  7191. // Iterate prefixes from most to least likely
  7192. do{
  7193. if(typeof style[name] !== "undefined"){
  7194. // Supported; return property name
  7195. return name;
  7196. }
  7197. }while(i-- && (name = prefixes[i] + "UserSelect"));
  7198. // Not supported if we didn't return before now
  7199. return false;
  7200. });
  7201. var cssUserSelect = has("css-user-select");
  7202. dom.setSelectable = cssUserSelect ? function(node, selectable){
  7203. // css-user-select returns a (possibly vendor-prefixed) CSS property name
  7204. dom.byId(node).style[cssUserSelect] = selectable ? "" : "none";
  7205. } : function(node, selectable){
  7206. node = dom.byId(node);
  7207. // (IE < 10 / Opera) Fall back to setting/removing the
  7208. // unselectable attribute on the element and all its children
  7209. var nodes = node.getElementsByTagName("*"),
  7210. i = nodes.length;
  7211. if(selectable){
  7212. node.removeAttribute("unselectable");
  7213. while(i--){
  7214. nodes[i].removeAttribute("unselectable");
  7215. }
  7216. }else{
  7217. node.setAttribute("unselectable", "on");
  7218. while(i--){
  7219. nodes[i].setAttribute("unselectable", "on");
  7220. }
  7221. }
  7222. };
  7223. /*
  7224. */
  7225. return dom;
  7226. });
  7227. },
  7228. 'dojo/_base/browser':function(){
  7229. if(require.has){
  7230. require.has.add("config-selectorEngine", "acme");
  7231. }
  7232. define([
  7233. "../ready",
  7234. "./kernel",
  7235. "./connect", // until we decide if connect is going back into non-browser environments
  7236. "./unload",
  7237. "./window",
  7238. "./event",
  7239. "./html",
  7240. "./NodeList",
  7241. "../query",
  7242. "./xhr",
  7243. "./fx"], function(dojo) {
  7244. // module:
  7245. // dojo/_base/browser
  7246. // summary:
  7247. // This module causes the browser-only base modules to be loaded.
  7248. return dojo;
  7249. });
  7250. },
  7251. 'dojo/selector/acme':function(){
  7252. define(["../_base/kernel", "../has", "../dom", "../_base/sniff", "../_base/array", "../_base/lang", "../_base/window"], function(dojo, has, dom){
  7253. // module:
  7254. // dojo/selector/acme
  7255. // summary:
  7256. // This module defines the Acme selector engine
  7257. /*
  7258. acme architectural overview:
  7259. acme is a relatively full-featured CSS3 query library. It is
  7260. designed to take any valid CSS3 selector and return the nodes matching
  7261. the selector. To do this quickly, it processes queries in several
  7262. steps, applying caching where profitable.
  7263. The steps (roughly in reverse order of the way they appear in the code):
  7264. 1.) check to see if we already have a "query dispatcher"
  7265. - if so, use that with the given parameterization. Skip to step 4.
  7266. 2.) attempt to determine which branch to dispatch the query to:
  7267. - JS (optimized DOM iteration)
  7268. - native (FF3.1+, Safari 3.1+, IE 8+)
  7269. 3.) tokenize and convert to executable "query dispatcher"
  7270. - this is where the lion's share of the complexity in the
  7271. system lies. In the DOM version, the query dispatcher is
  7272. assembled as a chain of "yes/no" test functions pertaining to
  7273. a section of a simple query statement (".blah:nth-child(odd)"
  7274. but not "div div", which is 2 simple statements). Individual
  7275. statement dispatchers are cached (to prevent re-definition)
  7276. as are entire dispatch chains (to make re-execution of the
  7277. same query fast)
  7278. 4.) the resulting query dispatcher is called in the passed scope
  7279. (by default the top-level document)
  7280. - for DOM queries, this results in a recursive, top-down
  7281. evaluation of nodes based on each simple query section
  7282. - for native implementations, this may mean working around spec
  7283. bugs. So be it.
  7284. 5.) matched nodes are pruned to ensure they are unique (if necessary)
  7285. */
  7286. ////////////////////////////////////////////////////////////////////////
  7287. // Toolkit aliases
  7288. ////////////////////////////////////////////////////////////////////////
  7289. // if you are extracting acme for use in your own system, you will
  7290. // need to provide these methods and properties. No other porting should be
  7291. // necessary, save for configuring the system to use a class other than
  7292. // dojo.NodeList as the return instance instantiator
  7293. var trim = dojo.trim;
  7294. var each = dojo.forEach;
  7295. // d.isIE; // float
  7296. // d.isSafari; // float
  7297. // d.isOpera; // float
  7298. // d.isWebKit; // float
  7299. // d.doc ; // document element
  7300. var getDoc = function(){ return dojo.doc; };
  7301. // NOTE(alex): the spec is idiotic. CSS queries should ALWAYS be case-sensitive, but nooooooo
  7302. var cssCaseBug = (getDoc().compatMode) == "BackCompat";
  7303. ////////////////////////////////////////////////////////////////////////
  7304. // Global utilities
  7305. ////////////////////////////////////////////////////////////////////////
  7306. var specials = ">~+";
  7307. // global thunk to determine whether we should treat the current query as
  7308. // case sensitive or not. This switch is flipped by the query evaluator
  7309. // based on the document passed as the context to search.
  7310. var caseSensitive = false;
  7311. // how high?
  7312. var yesman = function(){ return true; };
  7313. ////////////////////////////////////////////////////////////////////////
  7314. // Tokenizer
  7315. ////////////////////////////////////////////////////////////////////////
  7316. var getQueryParts = function(query){
  7317. // summary:
  7318. // state machine for query tokenization
  7319. // description:
  7320. // instead of using a brittle and slow regex-based CSS parser,
  7321. // acme implements an AST-style query representation. This
  7322. // representation is only generated once per query. For example,
  7323. // the same query run multiple times or under different root nodes
  7324. // does not re-parse the selector expression but instead uses the
  7325. // cached data structure. The state machine implemented here
  7326. // terminates on the last " " (space) character and returns an
  7327. // ordered array of query component structures (or "parts"). Each
  7328. // part represents an operator or a simple CSS filtering
  7329. // expression. The structure for parts is documented in the code
  7330. // below.
  7331. // NOTE:
  7332. // this code is designed to run fast and compress well. Sacrifices
  7333. // to readability and maintainability have been made. Your best
  7334. // bet when hacking the tokenizer is to put The Donnas on *really*
  7335. // loud (may we recommend their "Spend The Night" release?) and
  7336. // just assume you're gonna make mistakes. Keep the unit tests
  7337. // open and run them frequently. Knowing is half the battle ;-)
  7338. if(specials.indexOf(query.slice(-1)) >= 0){
  7339. // if we end with a ">", "+", or "~", that means we're implicitly
  7340. // searching all children, so make it explicit
  7341. query += " * "
  7342. }else{
  7343. // if you have not provided a terminator, one will be provided for
  7344. // you...
  7345. query += " ";
  7346. }
  7347. var ts = function(/*Integer*/ s, /*Integer*/ e){
  7348. // trim and slice.
  7349. // take an index to start a string slice from and an end position
  7350. // and return a trimmed copy of that sub-string
  7351. return trim(query.slice(s, e));
  7352. };
  7353. // the overall data graph of the full query, as represented by queryPart objects
  7354. var queryParts = [];
  7355. // state keeping vars
  7356. var inBrackets = -1, inParens = -1, inMatchFor = -1,
  7357. inPseudo = -1, inClass = -1, inId = -1, inTag = -1, currentQuoteChar,
  7358. lc = "", cc = "", pStart;
  7359. // iteration vars
  7360. var x = 0, // index in the query
  7361. ql = query.length,
  7362. currentPart = null, // data structure representing the entire clause
  7363. _cp = null; // the current pseudo or attr matcher
  7364. // several temporary variables are assigned to this structure during a
  7365. // potential sub-expression match:
  7366. // attr:
  7367. // a string representing the current full attribute match in a
  7368. // bracket expression
  7369. // type:
  7370. // if there's an operator in a bracket expression, this is
  7371. // used to keep track of it
  7372. // value:
  7373. // the internals of parenthetical expression for a pseudo. for
  7374. // :nth-child(2n+1), value might be "2n+1"
  7375. var endTag = function(){
  7376. // called when the tokenizer hits the end of a particular tag name.
  7377. // Re-sets state variables for tag matching and sets up the matcher
  7378. // to handle the next type of token (tag or operator).
  7379. if(inTag >= 0){
  7380. var tv = (inTag == x) ? null : ts(inTag, x); // .toLowerCase();
  7381. currentPart[ (specials.indexOf(tv) < 0) ? "tag" : "oper" ] = tv;
  7382. inTag = -1;
  7383. }
  7384. };
  7385. var endId = function(){
  7386. // called when the tokenizer might be at the end of an ID portion of a match
  7387. if(inId >= 0){
  7388. currentPart.id = ts(inId, x).replace(/\\/g, "");
  7389. inId = -1;
  7390. }
  7391. };
  7392. var endClass = function(){
  7393. // called when the tokenizer might be at the end of a class name
  7394. // match. CSS allows for multiple classes, so we augment the
  7395. // current item with another class in its list
  7396. if(inClass >= 0){
  7397. currentPart.classes.push(ts(inClass + 1, x).replace(/\\/g, ""));
  7398. inClass = -1;
  7399. }
  7400. };
  7401. var endAll = function(){
  7402. // at the end of a simple fragment, so wall off the matches
  7403. endId();
  7404. endTag();
  7405. endClass();
  7406. };
  7407. var endPart = function(){
  7408. endAll();
  7409. if(inPseudo >= 0){
  7410. currentPart.pseudos.push({ name: ts(inPseudo + 1, x) });
  7411. }
  7412. // hint to the selector engine to tell it whether or not it
  7413. // needs to do any iteration. Many simple selectors don't, and
  7414. // we can avoid significant construction-time work by advising
  7415. // the system to skip them
  7416. currentPart.loops = (
  7417. currentPart.pseudos.length ||
  7418. currentPart.attrs.length ||
  7419. currentPart.classes.length );
  7420. currentPart.oquery = currentPart.query = ts(pStart, x); // save the full expression as a string
  7421. // otag/tag are hints to suggest to the system whether or not
  7422. // it's an operator or a tag. We save a copy of otag since the
  7423. // tag name is cast to upper-case in regular HTML matches. The
  7424. // system has a global switch to figure out if the current
  7425. // expression needs to be case sensitive or not and it will use
  7426. // otag or tag accordingly
  7427. currentPart.otag = currentPart.tag = (currentPart["oper"]) ? null : (currentPart.tag || "*");
  7428. if(currentPart.tag){
  7429. // if we're in a case-insensitive HTML doc, we likely want
  7430. // the toUpperCase when matching on element.tagName. If we
  7431. // do it here, we can skip the string op per node
  7432. // comparison
  7433. currentPart.tag = currentPart.tag.toUpperCase();
  7434. }
  7435. // add the part to the list
  7436. if(queryParts.length && (queryParts[queryParts.length-1].oper)){
  7437. // operators are always infix, so we remove them from the
  7438. // list and attach them to the next match. The evaluator is
  7439. // responsible for sorting out how to handle them.
  7440. currentPart.infixOper = queryParts.pop();
  7441. currentPart.query = currentPart.infixOper.query + " " + currentPart.query;
  7442. /*
  7443. console.debug( "swapping out the infix",
  7444. currentPart.infixOper,
  7445. "and attaching it to",
  7446. currentPart);
  7447. */
  7448. }
  7449. queryParts.push(currentPart);
  7450. currentPart = null;
  7451. };
  7452. // iterate over the query, character by character, building up a
  7453. // list of query part objects
  7454. for(; lc=cc, cc=query.charAt(x), x < ql; x++){
  7455. // cc: the current character in the match
  7456. // lc: the last character (if any)
  7457. // someone is trying to escape something, so don't try to match any
  7458. // fragments. We assume we're inside a literal.
  7459. if(lc == "\\"){ continue; }
  7460. if(!currentPart){ // a part was just ended or none has yet been created
  7461. // NOTE: I hate all this alloc, but it's shorter than writing tons of if's
  7462. pStart = x;
  7463. // rules describe full CSS sub-expressions, like:
  7464. // #someId
  7465. // .className:first-child
  7466. // but not:
  7467. // thinger > div.howdy[type=thinger]
  7468. // the indidual components of the previous query would be
  7469. // split into 3 parts that would be represented a structure
  7470. // like:
  7471. // [
  7472. // {
  7473. // query: "thinger",
  7474. // tag: "thinger",
  7475. // },
  7476. // {
  7477. // query: "div.howdy[type=thinger]",
  7478. // classes: ["howdy"],
  7479. // infixOper: {
  7480. // query: ">",
  7481. // oper: ">",
  7482. // }
  7483. // },
  7484. // ]
  7485. currentPart = {
  7486. query: null, // the full text of the part's rule
  7487. pseudos: [], // CSS supports multiple pseud-class matches in a single rule
  7488. attrs: [], // CSS supports multi-attribute match, so we need an array
  7489. classes: [], // class matches may be additive, e.g.: .thinger.blah.howdy
  7490. tag: null, // only one tag...
  7491. oper: null, // ...or operator per component. Note that these wind up being exclusive.
  7492. id: null, // the id component of a rule
  7493. getTag: function(){
  7494. return caseSensitive ? this.otag : this.tag;
  7495. }
  7496. };
  7497. // if we don't have a part, we assume we're going to start at
  7498. // the beginning of a match, which should be a tag name. This
  7499. // might fault a little later on, but we detect that and this
  7500. // iteration will still be fine.
  7501. inTag = x;
  7502. }
  7503. // Skip processing all quoted characters.
  7504. // If we are inside quoted text then currentQuoteChar stores the character that began the quote,
  7505. // thus that character that will end it.
  7506. if(currentQuoteChar){
  7507. if(cc == currentQuoteChar){
  7508. currentQuoteChar = null;
  7509. }
  7510. continue;
  7511. }else if (cc == "'" || cc == '"'){
  7512. currentQuoteChar = cc;
  7513. continue;
  7514. }
  7515. if(inBrackets >= 0){
  7516. // look for a the close first
  7517. if(cc == "]"){ // if we're in a [...] clause and we end, do assignment
  7518. if(!_cp.attr){
  7519. // no attribute match was previously begun, so we
  7520. // assume this is an attribute existence match in the
  7521. // form of [someAttributeName]
  7522. _cp.attr = ts(inBrackets+1, x);
  7523. }else{
  7524. // we had an attribute already, so we know that we're
  7525. // matching some sort of value, as in [attrName=howdy]
  7526. _cp.matchFor = ts((inMatchFor||inBrackets+1), x);
  7527. }
  7528. var cmf = _cp.matchFor;
  7529. if(cmf){
  7530. // try to strip quotes from the matchFor value. We want
  7531. // [attrName=howdy] to match the same
  7532. // as [attrName = 'howdy' ]
  7533. if( (cmf.charAt(0) == '"') || (cmf.charAt(0) == "'") ){
  7534. _cp.matchFor = cmf.slice(1, -1);
  7535. }
  7536. }
  7537. // remove backslash escapes from an attribute match, since DOM
  7538. // querying will get attribute values without backslashes
  7539. if(_cp.matchFor){
  7540. _cp.matchFor = _cp.matchFor.replace(/\\/g, "");
  7541. }
  7542. // end the attribute by adding it to the list of attributes.
  7543. currentPart.attrs.push(_cp);
  7544. _cp = null; // necessary?
  7545. inBrackets = inMatchFor = -1;
  7546. }else if(cc == "="){
  7547. // if the last char was an operator prefix, make sure we
  7548. // record it along with the "=" operator.
  7549. var addToCc = ("|~^$*".indexOf(lc) >=0 ) ? lc : "";
  7550. _cp.type = addToCc+cc;
  7551. _cp.attr = ts(inBrackets+1, x-addToCc.length);
  7552. inMatchFor = x+1;
  7553. }
  7554. // now look for other clause parts
  7555. }else if(inParens >= 0){
  7556. // if we're in a parenthetical expression, we need to figure
  7557. // out if it's attached to a pseudo-selector rule like
  7558. // :nth-child(1)
  7559. if(cc == ")"){
  7560. if(inPseudo >= 0){
  7561. _cp.value = ts(inParens+1, x);
  7562. }
  7563. inPseudo = inParens = -1;
  7564. }
  7565. }else if(cc == "#"){
  7566. // start of an ID match
  7567. endAll();
  7568. inId = x+1;
  7569. }else if(cc == "."){
  7570. // start of a class match
  7571. endAll();
  7572. inClass = x;
  7573. }else if(cc == ":"){
  7574. // start of a pseudo-selector match
  7575. endAll();
  7576. inPseudo = x;
  7577. }else if(cc == "["){
  7578. // start of an attribute match.
  7579. endAll();
  7580. inBrackets = x;
  7581. // provide a new structure for the attribute match to fill-in
  7582. _cp = {
  7583. /*=====
  7584. attr: null, type: null, matchFor: null
  7585. =====*/
  7586. };
  7587. }else if(cc == "("){
  7588. // we really only care if we've entered a parenthetical
  7589. // expression if we're already inside a pseudo-selector match
  7590. if(inPseudo >= 0){
  7591. // provide a new structure for the pseudo match to fill-in
  7592. _cp = {
  7593. name: ts(inPseudo+1, x),
  7594. value: null
  7595. };
  7596. currentPart.pseudos.push(_cp);
  7597. }
  7598. inParens = x;
  7599. }else if(
  7600. (cc == " ") &&
  7601. // if it's a space char and the last char is too, consume the
  7602. // current one without doing more work
  7603. (lc != cc)
  7604. ){
  7605. endPart();
  7606. }
  7607. }
  7608. return queryParts;
  7609. };
  7610. ////////////////////////////////////////////////////////////////////////
  7611. // DOM query infrastructure
  7612. ////////////////////////////////////////////////////////////////////////
  7613. var agree = function(first, second){
  7614. // the basic building block of the yes/no chaining system. agree(f1,
  7615. // f2) generates a new function which returns the boolean results of
  7616. // both of the passed functions to a single logical-anded result. If
  7617. // either are not passed, the other is used exclusively.
  7618. if(!first){ return second; }
  7619. if(!second){ return first; }
  7620. return function(){
  7621. return first.apply(window, arguments) && second.apply(window, arguments);
  7622. }
  7623. };
  7624. var getArr = function(i, arr){
  7625. // helps us avoid array alloc when we don't need it
  7626. var r = arr||[]; // FIXME: should this be 'new d._NodeListCtor()' ?
  7627. if(i){ r.push(i); }
  7628. return r;
  7629. };
  7630. var _isElement = function(n){ return (1 == n.nodeType); };
  7631. // FIXME: need to coalesce _getAttr with defaultGetter
  7632. var blank = "";
  7633. var _getAttr = function(elem, attr){
  7634. if(!elem){ return blank; }
  7635. if(attr == "class"){
  7636. return elem.className || blank;
  7637. }
  7638. if(attr == "for"){
  7639. return elem.htmlFor || blank;
  7640. }
  7641. if(attr == "style"){
  7642. return elem.style.cssText || blank;
  7643. }
  7644. return (caseSensitive ? elem.getAttribute(attr) : elem.getAttribute(attr, 2)) || blank;
  7645. };
  7646. var attrs = {
  7647. "*=": function(attr, value){
  7648. return function(elem){
  7649. // E[foo*="bar"]
  7650. // an E element whose "foo" attribute value contains
  7651. // the substring "bar"
  7652. return (_getAttr(elem, attr).indexOf(value)>=0);
  7653. }
  7654. },
  7655. "^=": function(attr, value){
  7656. // E[foo^="bar"]
  7657. // an E element whose "foo" attribute value begins exactly
  7658. // with the string "bar"
  7659. return function(elem){
  7660. return (_getAttr(elem, attr).indexOf(value)==0);
  7661. }
  7662. },
  7663. "$=": function(attr, value){
  7664. // E[foo$="bar"]
  7665. // an E element whose "foo" attribute value ends exactly
  7666. // with the string "bar"
  7667. return function(elem){
  7668. var ea = " "+_getAttr(elem, attr);
  7669. var lastIndex = ea.lastIndexOf(value);
  7670. return lastIndex > -1 && (lastIndex==(ea.length-value.length));
  7671. }
  7672. },
  7673. "~=": function(attr, value){
  7674. // E[foo~="bar"]
  7675. // an E element whose "foo" attribute value is a list of
  7676. // space-separated values, one of which is exactly equal
  7677. // to "bar"
  7678. // return "[contains(concat(' ',@"+attr+",' '), ' "+ value +" ')]";
  7679. var tval = " "+value+" ";
  7680. return function(elem){
  7681. var ea = " "+_getAttr(elem, attr)+" ";
  7682. return (ea.indexOf(tval)>=0);
  7683. }
  7684. },
  7685. "|=": function(attr, value){
  7686. // E[hreflang|="en"]
  7687. // an E element whose "hreflang" attribute has a
  7688. // hyphen-separated list of values beginning (from the
  7689. // left) with "en"
  7690. var valueDash = value+"-";
  7691. return function(elem){
  7692. var ea = _getAttr(elem, attr);
  7693. return (
  7694. (ea == value) ||
  7695. (ea.indexOf(valueDash)==0)
  7696. );
  7697. }
  7698. },
  7699. "=": function(attr, value){
  7700. return function(elem){
  7701. return (_getAttr(elem, attr) == value);
  7702. }
  7703. }
  7704. };
  7705. // avoid testing for node type if we can. Defining this in the negative
  7706. // here to avoid negation in the fast path.
  7707. var _noNES = (typeof getDoc().firstChild.nextElementSibling == "undefined");
  7708. var _ns = !_noNES ? "nextElementSibling" : "nextSibling";
  7709. var _ps = !_noNES ? "previousElementSibling" : "previousSibling";
  7710. var _simpleNodeTest = (_noNES ? _isElement : yesman);
  7711. var _lookLeft = function(node){
  7712. // look left
  7713. while(node = node[_ps]){
  7714. if(_simpleNodeTest(node)){ return false; }
  7715. }
  7716. return true;
  7717. };
  7718. var _lookRight = function(node){
  7719. // look right
  7720. while(node = node[_ns]){
  7721. if(_simpleNodeTest(node)){ return false; }
  7722. }
  7723. return true;
  7724. };
  7725. var getNodeIndex = function(node){
  7726. var root = node.parentNode;
  7727. var i = 0,
  7728. tret = root.children || root.childNodes,
  7729. ci = (node["_i"]||-1),
  7730. cl = (root["_l"]||-1);
  7731. if(!tret){ return -1; }
  7732. var l = tret.length;
  7733. // we calculate the parent length as a cheap way to invalidate the
  7734. // cache. It's not 100% accurate, but it's much more honest than what
  7735. // other libraries do
  7736. if( cl == l && ci >= 0 && cl >= 0 ){
  7737. // if it's legit, tag and release
  7738. return ci;
  7739. }
  7740. // else re-key things
  7741. root["_l"] = l;
  7742. ci = -1;
  7743. for(var te = root["firstElementChild"]||root["firstChild"]; te; te = te[_ns]){
  7744. if(_simpleNodeTest(te)){
  7745. te["_i"] = ++i;
  7746. if(node === te){
  7747. // NOTE:
  7748. // shortcutting the return at this step in indexing works
  7749. // very well for benchmarking but we avoid it here since
  7750. // it leads to potential O(n^2) behavior in sequential
  7751. // getNodexIndex operations on a previously un-indexed
  7752. // parent. We may revisit this at a later time, but for
  7753. // now we just want to get the right answer more often
  7754. // than not.
  7755. ci = i;
  7756. }
  7757. }
  7758. }
  7759. return ci;
  7760. };
  7761. var isEven = function(elem){
  7762. return !((getNodeIndex(elem)) % 2);
  7763. };
  7764. var isOdd = function(elem){
  7765. return ((getNodeIndex(elem)) % 2);
  7766. };
  7767. var pseudos = {
  7768. "checked": function(name, condition){
  7769. return function(elem){
  7770. return !!("checked" in elem ? elem.checked : elem.selected);
  7771. }
  7772. },
  7773. "first-child": function(){ return _lookLeft; },
  7774. "last-child": function(){ return _lookRight; },
  7775. "only-child": function(name, condition){
  7776. return function(node){
  7777. return _lookLeft(node) && _lookRight(node);
  7778. };
  7779. },
  7780. "empty": function(name, condition){
  7781. return function(elem){
  7782. // DomQuery and jQuery get this wrong, oddly enough.
  7783. // The CSS 3 selectors spec is pretty explicit about it, too.
  7784. var cn = elem.childNodes;
  7785. var cnl = elem.childNodes.length;
  7786. // if(!cnl){ return true; }
  7787. for(var x=cnl-1; x >= 0; x--){
  7788. var nt = cn[x].nodeType;
  7789. if((nt === 1)||(nt == 3)){ return false; }
  7790. }
  7791. return true;
  7792. };
  7793. },
  7794. "disabled": function(name, condition){
  7795. return function(elem){
  7796. return elem.disabled;
  7797. };
  7798. },
  7799. "enabled": function(name, condition){
  7800. return function(elem){
  7801. return !elem.disabled;
  7802. };
  7803. },
  7804. "contains": function(name, condition){
  7805. var cz = condition.charAt(0);
  7806. if( cz == '"' || cz == "'" ){ //remove quote
  7807. condition = condition.slice(1, -1);
  7808. }
  7809. return function(elem){
  7810. return (elem.innerHTML.indexOf(condition) >= 0);
  7811. }
  7812. },
  7813. "not": function(name, condition){
  7814. var p = getQueryParts(condition)[0];
  7815. var ignores = { el: 1 };
  7816. if(p.tag != "*"){
  7817. ignores.tag = 1;
  7818. }
  7819. if(!p.classes.length){
  7820. ignores.classes = 1;
  7821. }
  7822. var ntf = getSimpleFilterFunc(p, ignores);
  7823. return function(elem){
  7824. return (!ntf(elem));
  7825. }
  7826. },
  7827. "nth-child": function(name, condition){
  7828. var pi = parseInt;
  7829. // avoid re-defining function objects if we can
  7830. if(condition == "odd"){
  7831. return isOdd;
  7832. }else if(condition == "even"){
  7833. return isEven;
  7834. }
  7835. // FIXME: can we shorten this?
  7836. if(condition.indexOf("n") != -1){
  7837. var tparts = condition.split("n", 2);
  7838. var pred = tparts[0] ? ((tparts[0] == '-') ? -1 : pi(tparts[0])) : 1;
  7839. var idx = tparts[1] ? pi(tparts[1]) : 0;
  7840. var lb = 0, ub = -1;
  7841. if(pred > 0){
  7842. if(idx < 0){
  7843. idx = (idx % pred) && (pred + (idx % pred));
  7844. }else if(idx>0){
  7845. if(idx >= pred){
  7846. lb = idx - idx % pred;
  7847. }
  7848. idx = idx % pred;
  7849. }
  7850. }else if(pred<0){
  7851. pred *= -1;
  7852. // idx has to be greater than 0 when pred is negative;
  7853. // shall we throw an error here?
  7854. if(idx > 0){
  7855. ub = idx;
  7856. idx = idx % pred;
  7857. }
  7858. }
  7859. if(pred > 0){
  7860. return function(elem){
  7861. var i = getNodeIndex(elem);
  7862. return (i>=lb) && (ub<0 || i<=ub) && ((i % pred) == idx);
  7863. }
  7864. }else{
  7865. condition = idx;
  7866. }
  7867. }
  7868. var ncount = pi(condition);
  7869. return function(elem){
  7870. return (getNodeIndex(elem) == ncount);
  7871. }
  7872. }
  7873. };
  7874. var defaultGetter = (dojo.isIE < 9 || dojo.isIE == 9 && dojo.isQuirks) ? function(cond){
  7875. var clc = cond.toLowerCase();
  7876. if(clc == "class"){ cond = "className"; }
  7877. return function(elem){
  7878. return (caseSensitive ? elem.getAttribute(cond) : elem[cond]||elem[clc]);
  7879. }
  7880. } : function(cond){
  7881. return function(elem){
  7882. return (elem && elem.getAttribute && elem.hasAttribute(cond));
  7883. }
  7884. };
  7885. var getSimpleFilterFunc = function(query, ignores){
  7886. // generates a node tester function based on the passed query part. The
  7887. // query part is one of the structures generated by the query parser
  7888. // when it creates the query AST. The "ignores" object specifies which
  7889. // (if any) tests to skip, allowing the system to avoid duplicating
  7890. // work where it may have already been taken into account by other
  7891. // factors such as how the nodes to test were fetched in the first
  7892. // place
  7893. if(!query){ return yesman; }
  7894. ignores = ignores||{};
  7895. var ff = null;
  7896. if(!("el" in ignores)){
  7897. ff = agree(ff, _isElement);
  7898. }
  7899. if(!("tag" in ignores)){
  7900. if(query.tag != "*"){
  7901. ff = agree(ff, function(elem){
  7902. return (elem && (elem.tagName == query.getTag()));
  7903. });
  7904. }
  7905. }
  7906. if(!("classes" in ignores)){
  7907. each(query.classes, function(cname, idx, arr){
  7908. // get the class name
  7909. /*
  7910. var isWildcard = cname.charAt(cname.length-1) == "*";
  7911. if(isWildcard){
  7912. cname = cname.substr(0, cname.length-1);
  7913. }
  7914. // I dislike the regex thing, even if memoized in a cache, but it's VERY short
  7915. var re = new RegExp("(?:^|\\s)" + cname + (isWildcard ? ".*" : "") + "(?:\\s|$)");
  7916. */
  7917. var re = new RegExp("(?:^|\\s)" + cname + "(?:\\s|$)");
  7918. ff = agree(ff, function(elem){
  7919. return re.test(elem.className);
  7920. });
  7921. ff.count = idx;
  7922. });
  7923. }
  7924. if(!("pseudos" in ignores)){
  7925. each(query.pseudos, function(pseudo){
  7926. var pn = pseudo.name;
  7927. if(pseudos[pn]){
  7928. ff = agree(ff, pseudos[pn](pn, pseudo.value));
  7929. }
  7930. });
  7931. }
  7932. if(!("attrs" in ignores)){
  7933. each(query.attrs, function(attr){
  7934. var matcher;
  7935. var a = attr.attr;
  7936. // type, attr, matchFor
  7937. if(attr.type && attrs[attr.type]){
  7938. matcher = attrs[attr.type](a, attr.matchFor);
  7939. }else if(a.length){
  7940. matcher = defaultGetter(a);
  7941. }
  7942. if(matcher){
  7943. ff = agree(ff, matcher);
  7944. }
  7945. });
  7946. }
  7947. if(!("id" in ignores)){
  7948. if(query.id){
  7949. ff = agree(ff, function(elem){
  7950. return (!!elem && (elem.id == query.id));
  7951. });
  7952. }
  7953. }
  7954. if(!ff){
  7955. if(!("default" in ignores)){
  7956. ff = yesman;
  7957. }
  7958. }
  7959. return ff;
  7960. };
  7961. var _nextSibling = function(filterFunc){
  7962. return function(node, ret, bag){
  7963. while(node = node[_ns]){
  7964. if(_noNES && (!_isElement(node))){ continue; }
  7965. if(
  7966. (!bag || _isUnique(node, bag)) &&
  7967. filterFunc(node)
  7968. ){
  7969. ret.push(node);
  7970. }
  7971. break;
  7972. }
  7973. return ret;
  7974. }
  7975. };
  7976. var _nextSiblings = function(filterFunc){
  7977. return function(root, ret, bag){
  7978. var te = root[_ns];
  7979. while(te){
  7980. if(_simpleNodeTest(te)){
  7981. if(bag && !_isUnique(te, bag)){
  7982. break;
  7983. }
  7984. if(filterFunc(te)){
  7985. ret.push(te);
  7986. }
  7987. }
  7988. te = te[_ns];
  7989. }
  7990. return ret;
  7991. }
  7992. };
  7993. // get an array of child *elements*, skipping text and comment nodes
  7994. var _childElements = function(filterFunc){
  7995. filterFunc = filterFunc||yesman;
  7996. return function(root, ret, bag){
  7997. // get an array of child elements, skipping text and comment nodes
  7998. var te, x = 0, tret = root.children || root.childNodes;
  7999. while(te = tret[x++]){
  8000. if(
  8001. _simpleNodeTest(te) &&
  8002. (!bag || _isUnique(te, bag)) &&
  8003. (filterFunc(te, x))
  8004. ){
  8005. ret.push(te);
  8006. }
  8007. }
  8008. return ret;
  8009. };
  8010. };
  8011. /*
  8012. // thanks, Dean!
  8013. var itemIsAfterRoot = d.isIE ? function(item, root){
  8014. return (item.sourceIndex > root.sourceIndex);
  8015. } : function(item, root){
  8016. return (item.compareDocumentPosition(root) == 2);
  8017. };
  8018. */
  8019. // test to see if node is below root
  8020. var _isDescendant = function(node, root){
  8021. var pn = node.parentNode;
  8022. while(pn){
  8023. if(pn == root){
  8024. break;
  8025. }
  8026. pn = pn.parentNode;
  8027. }
  8028. return !!pn;
  8029. };
  8030. var _getElementsFuncCache = {};
  8031. var getElementsFunc = function(query){
  8032. var retFunc = _getElementsFuncCache[query.query];
  8033. // if we've got a cached dispatcher, just use that
  8034. if(retFunc){ return retFunc; }
  8035. // else, generate a new on
  8036. // NOTE:
  8037. // this function returns a function that searches for nodes and
  8038. // filters them. The search may be specialized by infix operators
  8039. // (">", "~", or "+") else it will default to searching all
  8040. // descendants (the " " selector). Once a group of children is
  8041. // found, a test function is applied to weed out the ones we
  8042. // don't want. Many common cases can be fast-pathed. We spend a
  8043. // lot of cycles to create a dispatcher that doesn't do more work
  8044. // than necessary at any point since, unlike this function, the
  8045. // dispatchers will be called every time. The logic of generating
  8046. // efficient dispatchers looks like this in pseudo code:
  8047. //
  8048. // # if it's a purely descendant query (no ">", "+", or "~" modifiers)
  8049. // if infixOperator == " ":
  8050. // if only(id):
  8051. // return def(root):
  8052. // return d.byId(id, root);
  8053. //
  8054. // elif id:
  8055. // return def(root):
  8056. // return filter(d.byId(id, root));
  8057. //
  8058. // elif cssClass && getElementsByClassName:
  8059. // return def(root):
  8060. // return filter(root.getElementsByClassName(cssClass));
  8061. //
  8062. // elif only(tag):
  8063. // return def(root):
  8064. // return root.getElementsByTagName(tagName);
  8065. //
  8066. // else:
  8067. // # search by tag name, then filter
  8068. // return def(root):
  8069. // return filter(root.getElementsByTagName(tagName||"*"));
  8070. //
  8071. // elif infixOperator == ">":
  8072. // # search direct children
  8073. // return def(root):
  8074. // return filter(root.children);
  8075. //
  8076. // elif infixOperator == "+":
  8077. // # search next sibling
  8078. // return def(root):
  8079. // return filter(root.nextElementSibling);
  8080. //
  8081. // elif infixOperator == "~":
  8082. // # search rightward siblings
  8083. // return def(root):
  8084. // return filter(nextSiblings(root));
  8085. var io = query.infixOper;
  8086. var oper = (io ? io.oper : "");
  8087. // the default filter func which tests for all conditions in the query
  8088. // part. This is potentially inefficient, so some optimized paths may
  8089. // re-define it to test fewer things.
  8090. var filterFunc = getSimpleFilterFunc(query, { el: 1 });
  8091. var qt = query.tag;
  8092. var wildcardTag = ("*" == qt);
  8093. var ecs = getDoc()["getElementsByClassName"];
  8094. if(!oper){
  8095. // if there's no infix operator, then it's a descendant query. ID
  8096. // and "elements by class name" variants can be accelerated so we
  8097. // call them out explicitly:
  8098. if(query.id){
  8099. // testing shows that the overhead of yesman() is acceptable
  8100. // and can save us some bytes vs. re-defining the function
  8101. // everywhere.
  8102. filterFunc = (!query.loops && wildcardTag) ?
  8103. yesman :
  8104. getSimpleFilterFunc(query, { el: 1, id: 1 });
  8105. retFunc = function(root, arr){
  8106. var te = dom.byId(query.id, (root.ownerDocument||root));
  8107. if(!te || !filterFunc(te)){ return; }
  8108. if(9 == root.nodeType){ // if root's a doc, we just return directly
  8109. return getArr(te, arr);
  8110. }else{ // otherwise check ancestry
  8111. if(_isDescendant(te, root)){
  8112. return getArr(te, arr);
  8113. }
  8114. }
  8115. }
  8116. }else if(
  8117. ecs &&
  8118. // isAlien check. Workaround for Prototype.js being totally evil/dumb.
  8119. /\{\s*\[native code\]\s*\}/.test(String(ecs)) &&
  8120. query.classes.length &&
  8121. !cssCaseBug
  8122. ){
  8123. // it's a class-based query and we've got a fast way to run it.
  8124. // ignore class and ID filters since we will have handled both
  8125. filterFunc = getSimpleFilterFunc(query, { el: 1, classes: 1, id: 1 });
  8126. var classesString = query.classes.join(" ");
  8127. retFunc = function(root, arr, bag){
  8128. var ret = getArr(0, arr), te, x=0;
  8129. var tret = root.getElementsByClassName(classesString);
  8130. while((te = tret[x++])){
  8131. if(filterFunc(te, root) && _isUnique(te, bag)){
  8132. ret.push(te);
  8133. }
  8134. }
  8135. return ret;
  8136. };
  8137. }else if(!wildcardTag && !query.loops){
  8138. // it's tag only. Fast-path it.
  8139. retFunc = function(root, arr, bag){
  8140. var ret = getArr(0, arr), te, x=0;
  8141. var tret = root.getElementsByTagName(query.getTag());
  8142. while((te = tret[x++])){
  8143. if(_isUnique(te, bag)){
  8144. ret.push(te);
  8145. }
  8146. }
  8147. return ret;
  8148. };
  8149. }else{
  8150. // the common case:
  8151. // a descendant selector without a fast path. By now it's got
  8152. // to have a tag selector, even if it's just "*" so we query
  8153. // by that and filter
  8154. filterFunc = getSimpleFilterFunc(query, { el: 1, tag: 1, id: 1 });
  8155. retFunc = function(root, arr, bag){
  8156. var ret = getArr(0, arr), te, x=0;
  8157. // we use getTag() to avoid case sensitivity issues
  8158. var tret = root.getElementsByTagName(query.getTag());
  8159. while((te = tret[x++])){
  8160. if(filterFunc(te, root) && _isUnique(te, bag)){
  8161. ret.push(te);
  8162. }
  8163. }
  8164. return ret;
  8165. };
  8166. }
  8167. }else{
  8168. // the query is scoped in some way. Instead of querying by tag we
  8169. // use some other collection to find candidate nodes
  8170. var skipFilters = { el: 1 };
  8171. if(wildcardTag){
  8172. skipFilters.tag = 1;
  8173. }
  8174. filterFunc = getSimpleFilterFunc(query, skipFilters);
  8175. if("+" == oper){
  8176. retFunc = _nextSibling(filterFunc);
  8177. }else if("~" == oper){
  8178. retFunc = _nextSiblings(filterFunc);
  8179. }else if(">" == oper){
  8180. retFunc = _childElements(filterFunc);
  8181. }
  8182. }
  8183. // cache it and return
  8184. return _getElementsFuncCache[query.query] = retFunc;
  8185. };
  8186. var filterDown = function(root, queryParts){
  8187. // NOTE:
  8188. // this is the guts of the DOM query system. It takes a list of
  8189. // parsed query parts and a root and finds children which match
  8190. // the selector represented by the parts
  8191. var candidates = getArr(root), qp, x, te, qpl = queryParts.length, bag, ret;
  8192. for(var i = 0; i < qpl; i++){
  8193. ret = [];
  8194. qp = queryParts[i];
  8195. x = candidates.length - 1;
  8196. if(x > 0){
  8197. // if we have more than one root at this level, provide a new
  8198. // hash to use for checking group membership but tell the
  8199. // system not to post-filter us since we will already have been
  8200. // gauranteed to be unique
  8201. bag = {};
  8202. ret.nozip = true;
  8203. }
  8204. var gef = getElementsFunc(qp);
  8205. for(var j = 0; (te = candidates[j]); j++){
  8206. // for every root, get the elements that match the descendant
  8207. // selector, adding them to the "ret" array and filtering them
  8208. // via membership in this level's bag. If there are more query
  8209. // parts, then this level's return will be used as the next
  8210. // level's candidates
  8211. gef(te, ret, bag);
  8212. }
  8213. if(!ret.length){ break; }
  8214. candidates = ret;
  8215. }
  8216. return ret;
  8217. };
  8218. ////////////////////////////////////////////////////////////////////////
  8219. // the query runner
  8220. ////////////////////////////////////////////////////////////////////////
  8221. // these are the primary caches for full-query results. The query
  8222. // dispatcher functions are generated then stored here for hash lookup in
  8223. // the future
  8224. var _queryFuncCacheDOM = {},
  8225. _queryFuncCacheQSA = {};
  8226. // this is the second level of spliting, from full-length queries (e.g.,
  8227. // "div.foo .bar") into simple query expressions (e.g., ["div.foo",
  8228. // ".bar"])
  8229. var getStepQueryFunc = function(query){
  8230. var qparts = getQueryParts(trim(query));
  8231. // if it's trivial, avoid iteration and zipping costs
  8232. if(qparts.length == 1){
  8233. // we optimize this case here to prevent dispatch further down the
  8234. // chain, potentially slowing things down. We could more elegantly
  8235. // handle this in filterDown(), but it's slower for simple things
  8236. // that need to be fast (e.g., "#someId").
  8237. var tef = getElementsFunc(qparts[0]);
  8238. return function(root){
  8239. var r = tef(root, []);
  8240. if(r){ r.nozip = true; }
  8241. return r;
  8242. }
  8243. }
  8244. // otherwise, break it up and return a runner that iterates over the parts recursively
  8245. return function(root){
  8246. return filterDown(root, qparts);
  8247. }
  8248. };
  8249. // NOTES:
  8250. // * we can't trust QSA for anything but document-rooted queries, so
  8251. // caching is split into DOM query evaluators and QSA query evaluators
  8252. // * caching query results is dirty and leak-prone (or, at a minimum,
  8253. // prone to unbounded growth). Other toolkits may go this route, but
  8254. // they totally destroy their own ability to manage their memory
  8255. // footprint. If we implement it, it should only ever be with a fixed
  8256. // total element reference # limit and an LRU-style algorithm since JS
  8257. // has no weakref support. Caching compiled query evaluators is also
  8258. // potentially problematic, but even on large documents the size of the
  8259. // query evaluators is often < 100 function objects per evaluator (and
  8260. // LRU can be applied if it's ever shown to be an issue).
  8261. // * since IE's QSA support is currently only for HTML documents and even
  8262. // then only in IE 8's "standards mode", we have to detect our dispatch
  8263. // route at query time and keep 2 separate caches. Ugg.
  8264. // we need to determine if we think we can run a given query via
  8265. // querySelectorAll or if we'll need to fall back on DOM queries to get
  8266. // there. We need a lot of information about the environment and the query
  8267. // to make the determiniation (e.g. does it support QSA, does the query in
  8268. // question work in the native QSA impl, etc.).
  8269. var nua = navigator.userAgent;
  8270. // some versions of Safari provided QSA, but it was buggy and crash-prone.
  8271. // We need te detect the right "internal" webkit version to make this work.
  8272. var wk = "WebKit/";
  8273. var is525 = (
  8274. dojo.isWebKit &&
  8275. (nua.indexOf(wk) > 0) &&
  8276. (parseFloat(nua.split(wk)[1]) > 528)
  8277. );
  8278. // IE QSA queries may incorrectly include comment nodes, so we throw the
  8279. // zipping function into "remove" comments mode instead of the normal "skip
  8280. // it" which every other QSA-clued browser enjoys
  8281. var noZip = dojo.isIE ? "commentStrip" : "nozip";
  8282. var qsa = "querySelectorAll";
  8283. var qsaAvail = (
  8284. !!getDoc()[qsa] &&
  8285. // see #5832
  8286. (!dojo.isSafari || (dojo.isSafari > 3.1) || is525 )
  8287. );
  8288. //Don't bother with n+3 type of matches, IE complains if we modify those.
  8289. var infixSpaceRe = /\\[>~+]|n\+\d|([^ \\])?([>~+])([^ =])?/g;
  8290. var infixSpaceFunc = function(match, pre, ch, post){
  8291. return ch ? (pre ? pre + " " : "") + ch + (post ? " " + post : "") : /*n+3*/ match;
  8292. };
  8293. //Don't apply the infixSpaceRe to attribute value selectors
  8294. var attRe = /([^[]*)([^\]]*])?/g;
  8295. var attFunc = function(match, nonAtt, att) {
  8296. return nonAtt.replace(infixSpaceRe, infixSpaceFunc) + (att||"");
  8297. };
  8298. var getQueryFunc = function(query, forceDOM){
  8299. //Normalize query. The CSS3 selectors spec allows for omitting spaces around
  8300. //infix operators, >, ~ and +
  8301. //Do the work here since detection for spaces is used as a simple "not use QSA"
  8302. //test below.
  8303. query = query.replace(attRe, attFunc);
  8304. if(qsaAvail){
  8305. // if we've got a cached variant and we think we can do it, run it!
  8306. var qsaCached = _queryFuncCacheQSA[query];
  8307. if(qsaCached && !forceDOM){ return qsaCached; }
  8308. }
  8309. // else if we've got a DOM cached variant, assume that we already know
  8310. // all we need to and use it
  8311. var domCached = _queryFuncCacheDOM[query];
  8312. if(domCached){ return domCached; }
  8313. // TODO:
  8314. // today we're caching DOM and QSA branches separately so we
  8315. // recalc useQSA every time. If we had a way to tag root+query
  8316. // efficiently, we'd be in good shape to do a global cache.
  8317. var qcz = query.charAt(0);
  8318. var nospace = (-1 == query.indexOf(" "));
  8319. // byId searches are wicked fast compared to QSA, even when filtering
  8320. // is required
  8321. if( (query.indexOf("#") >= 0) && (nospace) ){
  8322. forceDOM = true;
  8323. }
  8324. var useQSA = (
  8325. qsaAvail && (!forceDOM) &&
  8326. // as per CSS 3, we can't currently start w/ combinator:
  8327. // http://www.w3.org/TR/css3-selectors/#w3cselgrammar
  8328. (specials.indexOf(qcz) == -1) &&
  8329. // IE's QSA impl sucks on pseudos
  8330. (!dojo.isIE || (query.indexOf(":") == -1)) &&
  8331. (!(cssCaseBug && (query.indexOf(".") >= 0))) &&
  8332. // FIXME:
  8333. // need to tighten up browser rules on ":contains" and "|=" to
  8334. // figure out which aren't good
  8335. // Latest webkit (around 531.21.8) does not seem to do well with :checked on option
  8336. // elements, even though according to spec, selected options should
  8337. // match :checked. So go nonQSA for it:
  8338. // http://bugs.dojotoolkit.org/ticket/5179
  8339. (query.indexOf(":contains") == -1) && (query.indexOf(":checked") == -1) &&
  8340. (query.indexOf("|=") == -1) // some browsers don't grok it
  8341. );
  8342. // TODO:
  8343. // if we've got a descendant query (e.g., "> .thinger" instead of
  8344. // just ".thinger") in a QSA-able doc, but are passed a child as a
  8345. // root, it should be possible to give the item a synthetic ID and
  8346. // trivially rewrite the query to the form "#synid > .thinger" to
  8347. // use the QSA branch
  8348. if(useQSA){
  8349. var tq = (specials.indexOf(query.charAt(query.length-1)) >= 0) ?
  8350. (query + " *") : query;
  8351. return _queryFuncCacheQSA[query] = function(root){
  8352. try{
  8353. // the QSA system contains an egregious spec bug which
  8354. // limits us, effectively, to only running QSA queries over
  8355. // entire documents. See:
  8356. // http://ejohn.org/blog/thoughts-on-queryselectorall/
  8357. // despite this, we can also handle QSA runs on simple
  8358. // selectors, but we don't want detection to be expensive
  8359. // so we're just checking for the presence of a space char
  8360. // right now. Not elegant, but it's cheaper than running
  8361. // the query parser when we might not need to
  8362. if(!((9 == root.nodeType) || nospace)){ throw ""; }
  8363. var r = root[qsa](tq);
  8364. // skip expensive duplication checks and just wrap in a NodeList
  8365. r[noZip] = true;
  8366. return r;
  8367. }catch(e){
  8368. // else run the DOM branch on this query, ensuring that we
  8369. // default that way in the future
  8370. return getQueryFunc(query, true)(root);
  8371. }
  8372. }
  8373. }else{
  8374. // DOM branch
  8375. var parts = query.match(/([^\s,](?:"(?:\\.|[^"])+"|'(?:\\.|[^'])+'|[^,])*)/g);
  8376. return _queryFuncCacheDOM[query] = ((parts.length < 2) ?
  8377. // if not a compound query (e.g., ".foo, .bar"), cache and return a dispatcher
  8378. getStepQueryFunc(query) :
  8379. // if it *is* a complex query, break it up into its
  8380. // constituent parts and return a dispatcher that will
  8381. // merge the parts when run
  8382. function(root){
  8383. var pindex = 0, // avoid array alloc for every invocation
  8384. ret = [],
  8385. tp;
  8386. while((tp = parts[pindex++])){
  8387. ret = ret.concat(getStepQueryFunc(tp)(root));
  8388. }
  8389. return ret;
  8390. }
  8391. );
  8392. }
  8393. };
  8394. var _zipIdx = 0;
  8395. // NOTE:
  8396. // this function is Moo inspired, but our own impl to deal correctly
  8397. // with XML in IE
  8398. var _nodeUID = dojo.isIE ? function(node){
  8399. if(caseSensitive){
  8400. // XML docs don't have uniqueID on their nodes
  8401. return (node.getAttribute("_uid") || node.setAttribute("_uid", ++_zipIdx) || _zipIdx);
  8402. }else{
  8403. return node.uniqueID;
  8404. }
  8405. } :
  8406. function(node){
  8407. return (node._uid || (node._uid = ++_zipIdx));
  8408. };
  8409. // determine if a node in is unique in a "bag". In this case we don't want
  8410. // to flatten a list of unique items, but rather just tell if the item in
  8411. // question is already in the bag. Normally we'd just use hash lookup to do
  8412. // this for us but IE's DOM is busted so we can't really count on that. On
  8413. // the upside, it gives us a built in unique ID function.
  8414. var _isUnique = function(node, bag){
  8415. if(!bag){ return 1; }
  8416. var id = _nodeUID(node);
  8417. if(!bag[id]){ return bag[id] = 1; }
  8418. return 0;
  8419. };
  8420. // attempt to efficiently determine if an item in a list is a dupe,
  8421. // returning a list of "uniques", hopefully in doucment order
  8422. var _zipIdxName = "_zipIdx";
  8423. var _zip = function(arr){
  8424. if(arr && arr.nozip){
  8425. return arr;
  8426. }
  8427. var ret = [];
  8428. if(!arr || !arr.length){ return ret; }
  8429. if(arr[0]){
  8430. ret.push(arr[0]);
  8431. }
  8432. if(arr.length < 2){ return ret; }
  8433. _zipIdx++;
  8434. // we have to fork here for IE and XML docs because we can't set
  8435. // expandos on their nodes (apparently). *sigh*
  8436. if(dojo.isIE && caseSensitive){
  8437. var szidx = _zipIdx+"";
  8438. arr[0].setAttribute(_zipIdxName, szidx);
  8439. for(var x = 1, te; te = arr[x]; x++){
  8440. if(arr[x].getAttribute(_zipIdxName) != szidx){
  8441. ret.push(te);
  8442. }
  8443. te.setAttribute(_zipIdxName, szidx);
  8444. }
  8445. }else if(dojo.isIE && arr.commentStrip){
  8446. try{
  8447. for(var x = 1, te; te = arr[x]; x++){
  8448. if(_isElement(te)){
  8449. ret.push(te);
  8450. }
  8451. }
  8452. }catch(e){ /* squelch */ }
  8453. }else{
  8454. if(arr[0]){ arr[0][_zipIdxName] = _zipIdx; }
  8455. for(var x = 1, te; te = arr[x]; x++){
  8456. if(arr[x][_zipIdxName] != _zipIdx){
  8457. ret.push(te);
  8458. }
  8459. te[_zipIdxName] = _zipIdx;
  8460. }
  8461. }
  8462. return ret;
  8463. };
  8464. // the main executor
  8465. var query = function(/*String*/ query, /*String|DOMNode?*/ root){
  8466. // summary:
  8467. // Returns nodes which match the given CSS3 selector, searching the
  8468. // entire document by default but optionally taking a node to scope
  8469. // the search by. Returns an array.
  8470. // description:
  8471. // dojo.query() is the swiss army knife of DOM node manipulation in
  8472. // Dojo. Much like Prototype's "$$" (bling-bling) function or JQuery's
  8473. // "$" function, dojo.query provides robust, high-performance
  8474. // CSS-based node selector support with the option of scoping searches
  8475. // to a particular sub-tree of a document.
  8476. //
  8477. // Supported Selectors:
  8478. // --------------------
  8479. //
  8480. // acme supports a rich set of CSS3 selectors, including:
  8481. //
  8482. // * class selectors (e.g., `.foo`)
  8483. // * node type selectors like `span`
  8484. // * ` ` descendant selectors
  8485. // * `>` child element selectors
  8486. // * `#foo` style ID selectors
  8487. // * `*` universal selector
  8488. // * `~`, the preceded-by sibling selector
  8489. // * `+`, the immediately preceded-by sibling selector
  8490. // * attribute queries:
  8491. // | * `[foo]` attribute presence selector
  8492. // | * `[foo='bar']` attribute value exact match
  8493. // | * `[foo~='bar']` attribute value list item match
  8494. // | * `[foo^='bar']` attribute start match
  8495. // | * `[foo$='bar']` attribute end match
  8496. // | * `[foo*='bar']` attribute substring match
  8497. // * `:first-child`, `:last-child`, and `:only-child` positional selectors
  8498. // * `:empty` content emtpy selector
  8499. // * `:checked` pseudo selector
  8500. // * `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations
  8501. // * `:nth-child(even)`, `:nth-child(odd)` positional selectors
  8502. // * `:not(...)` negation pseudo selectors
  8503. //
  8504. // Any legal combination of these selectors will work with
  8505. // `dojo.query()`, including compound selectors ("," delimited).
  8506. // Very complex and useful searches can be constructed with this
  8507. // palette of selectors and when combined with functions for
  8508. // manipulation presented by dojo.NodeList, many types of DOM
  8509. // manipulation operations become very straightforward.
  8510. //
  8511. // Unsupported Selectors:
  8512. // ----------------------
  8513. //
  8514. // While dojo.query handles many CSS3 selectors, some fall outside of
  8515. // what's reasonable for a programmatic node querying engine to
  8516. // handle. Currently unsupported selectors include:
  8517. //
  8518. // * namespace-differentiated selectors of any form
  8519. // * all `::` pseduo-element selectors
  8520. // * certain pseduo-selectors which don't get a lot of day-to-day use:
  8521. // | * `:root`, `:lang()`, `:target`, `:focus`
  8522. // * all visual and state selectors:
  8523. // | * `:root`, `:active`, `:hover`, `:visisted`, `:link`
  8524. // * `:*-of-type` pseudo selectors
  8525. //
  8526. // dojo.query and XML Documents:
  8527. // -----------------------------
  8528. //
  8529. // `dojo.query` (as of dojo 1.2) supports searching XML documents
  8530. // in a case-sensitive manner. If an HTML document is served with
  8531. // a doctype that forces case-sensitivity (e.g., XHTML 1.1
  8532. // Strict), dojo.query() will detect this and "do the right
  8533. // thing". Case sensitivity is dependent upon the document being
  8534. // searched and not the query used. It is therefore possible to
  8535. // use case-sensitive queries on strict sub-documents (iframes,
  8536. // etc.) or XML documents while still assuming case-insensitivity
  8537. // for a host/root document.
  8538. //
  8539. // Non-selector Queries:
  8540. // ---------------------
  8541. //
  8542. // If something other than a String is passed for the query,
  8543. // `dojo.query` will return a new `dojo.NodeList` instance
  8544. // constructed from that parameter alone and all further
  8545. // processing will stop. This means that if you have a reference
  8546. // to a node or NodeList, you can quickly construct a new NodeList
  8547. // from the original by calling `dojo.query(node)` or
  8548. // `dojo.query(list)`.
  8549. //
  8550. // query:
  8551. // The CSS3 expression to match against. For details on the syntax of
  8552. // CSS3 selectors, see <http://www.w3.org/TR/css3-selectors/#selectors>
  8553. // root:
  8554. // A DOMNode (or node id) to scope the search from. Optional.
  8555. // returns: Array
  8556. // example:
  8557. // search the entire document for elements with the class "foo":
  8558. // | dojo.query(".foo");
  8559. // these elements will match:
  8560. // | <span class="foo"></span>
  8561. // | <span class="foo bar"></span>
  8562. // | <p class="thud foo"></p>
  8563. // example:
  8564. // search the entire document for elements with the classes "foo" *and* "bar":
  8565. // | dojo.query(".foo.bar");
  8566. // these elements will match:
  8567. // | <span class="foo bar"></span>
  8568. // while these will not:
  8569. // | <span class="foo"></span>
  8570. // | <p class="thud foo"></p>
  8571. // example:
  8572. // find `<span>` elements which are descendants of paragraphs and
  8573. // which have a "highlighted" class:
  8574. // | dojo.query("p span.highlighted");
  8575. // the innermost span in this fragment matches:
  8576. // | <p class="foo">
  8577. // | <span>...
  8578. // | <span class="highlighted foo bar">...</span>
  8579. // | </span>
  8580. // | </p>
  8581. // example:
  8582. // set an "odd" class on all odd table rows inside of the table
  8583. // `#tabular_data`, using the `>` (direct child) selector to avoid
  8584. // affecting any nested tables:
  8585. // | dojo.query("#tabular_data > tbody > tr:nth-child(odd)").addClass("odd");
  8586. // example:
  8587. // remove all elements with the class "error" from the document
  8588. // and store them in a list:
  8589. // | var errors = dojo.query(".error").orphan();
  8590. // example:
  8591. // add an onclick handler to every submit button in the document
  8592. // which causes the form to be sent via Ajax instead:
  8593. // | dojo.query("input[type='submit']").onclick(function(e){
  8594. // | dojo.stopEvent(e); // prevent sending the form
  8595. // | var btn = e.target;
  8596. // | dojo.xhrPost({
  8597. // | form: btn.form,
  8598. // | load: function(data){
  8599. // | // replace the form with the response
  8600. // | var div = dojo.doc.createElement("div");
  8601. // | dojo.place(div, btn.form, "after");
  8602. // | div.innerHTML = data;
  8603. // | dojo.style(btn.form, "display", "none");
  8604. // | }
  8605. // | });
  8606. // | });
  8607. root = root || getDoc();
  8608. // throw the big case sensitivity switch
  8609. var od = root.ownerDocument || root; // root is either Document or a node inside the document
  8610. caseSensitive = (od.createElement("div").tagName === "div");
  8611. // NOTE:
  8612. // adding "true" as the 2nd argument to getQueryFunc is useful for
  8613. // testing the DOM branch without worrying about the
  8614. // behavior/performance of the QSA branch.
  8615. var r = getQueryFunc(query)(root);
  8616. // FIXME:
  8617. // need to investigate this branch WRT #8074 and #8075
  8618. if(r && r.nozip){
  8619. return r;
  8620. }
  8621. return _zip(r); // dojo.NodeList
  8622. };
  8623. query.filter = function(/*Node[]*/ nodeList, /*String*/ filter, /*String|DOMNode?*/ root){
  8624. // summary:
  8625. // function for filtering a NodeList based on a selector, optimized for simple selectors
  8626. var tmpNodeList = [],
  8627. parts = getQueryParts(filter),
  8628. filterFunc =
  8629. (parts.length == 1 && !/[^\w#\.]/.test(filter)) ?
  8630. getSimpleFilterFunc(parts[0]) :
  8631. function(node){
  8632. return dojo.query(filter, root).indexOf(node) != -1;
  8633. };
  8634. for(var x = 0, te; te = nodeList[x]; x++){
  8635. if(filterFunc(te)){ tmpNodeList.push(te); }
  8636. }
  8637. return tmpNodeList;
  8638. };
  8639. return query;
  8640. });//end defineQuery
  8641. },
  8642. 'dojo/dom-style':function(){
  8643. define("dojo/dom-style", ["./_base/sniff", "./dom"], function(has, dom){
  8644. // module:
  8645. // dojo/dom-style
  8646. // summary:
  8647. // This module defines the core dojo DOM style API.
  8648. // =============================
  8649. // Style Functions
  8650. // =============================
  8651. // getComputedStyle drives most of the style code.
  8652. // Wherever possible, reuse the returned object.
  8653. //
  8654. // API functions below that need to access computed styles accept an
  8655. // optional computedStyle parameter.
  8656. // If this parameter is omitted, the functions will call getComputedStyle themselves.
  8657. // This way, calling code can access computedStyle once, and then pass the reference to
  8658. // multiple API functions.
  8659. /*=====
  8660. dojo.getComputedStyle = function(node){
  8661. // summary:
  8662. // Returns a "computed style" object.
  8663. //
  8664. // description:
  8665. // Gets a "computed style" object which can be used to gather
  8666. // information about the current state of the rendered node.
  8667. //
  8668. // Note that this may behave differently on different browsers.
  8669. // Values may have different formats and value encodings across
  8670. // browsers.
  8671. //
  8672. // Note also that this method is expensive. Wherever possible,
  8673. // reuse the returned object.
  8674. //
  8675. // Use the dojo.style() method for more consistent (pixelized)
  8676. // return values.
  8677. //
  8678. // node: DOMNode
  8679. // A reference to a DOM node. Does NOT support taking an
  8680. // ID string for speed reasons.
  8681. // example:
  8682. // | dojo.getComputedStyle(dojo.byId('foo')).borderWidth;
  8683. //
  8684. // example:
  8685. // Reusing the returned object, avoiding multiple lookups:
  8686. // | var cs = dojo.getComputedStyle(dojo.byId("someNode"));
  8687. // | var w = cs.width, h = cs.height;
  8688. return; // CSS2Properties
  8689. }
  8690. =====*/
  8691. /*=====
  8692. dojo.toPixelValue = function(node, value){
  8693. // summary:
  8694. // converts style value to pixels on IE or return a numeric value.
  8695. // node: DOMNode
  8696. // value: String
  8697. // returns: Number
  8698. };
  8699. =====*/
  8700. /*=====
  8701. dojo._toPixelValue = function(node, value){
  8702. // summary:
  8703. // Existing alias for `dojo._toPixelValue`. Deprecated, will be removed in 2.0.
  8704. };
  8705. =====*/
  8706. /*=====
  8707. dojo.getStyle = function(node, name){
  8708. // summary:
  8709. // Accesses styles on a node.
  8710. // description:
  8711. // Getting the style value uses the computed style for the node, so the value
  8712. // will be a calculated value, not just the immediate node.style value.
  8713. // Also when getting values, use specific style names,
  8714. // like "borderBottomWidth" instead of "border" since compound values like
  8715. // "border" are not necessarily reflected as expected.
  8716. // If you want to get node dimensions, use `dojo.marginBox()`,
  8717. // `dojo.contentBox()` or `dojo.position()`.
  8718. // node: DOMNode|String
  8719. // id or reference to node to get style for
  8720. // name: String?
  8721. // the style property to get
  8722. // example:
  8723. // Passing only an ID or node returns the computed style object of
  8724. // the node:
  8725. // | dojo.getStyle("thinger");
  8726. // example:
  8727. // Passing a node and a style property returns the current
  8728. // normalized, computed value for that property:
  8729. // | dojo.getStyle("thinger", "opacity"); // 1 by default
  8730. };
  8731. =====*/
  8732. /*=====
  8733. dojo.setStyle = function(node, name, value){
  8734. // summary:
  8735. // Sets styles on a node.
  8736. // node: DOMNode|String
  8737. // id or reference to node to set style for
  8738. // name: String|Object
  8739. // the style property to set in DOM-accessor format
  8740. // ("borderWidth", not "border-width") or an object with key/value
  8741. // pairs suitable for setting each property.
  8742. // value: String?
  8743. // If passed, sets value on the node for style, handling
  8744. // cross-browser concerns. When setting a pixel value,
  8745. // be sure to include "px" in the value. For instance, top: "200px".
  8746. // Otherwise, in some cases, some browsers will not apply the style.
  8747. //
  8748. // example:
  8749. // Passing a node, a style property, and a value changes the
  8750. // current display of the node and returns the new computed value
  8751. // | dojo.setStyle("thinger", "opacity", 0.5); // == 0.5
  8752. //
  8753. // example:
  8754. // Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:
  8755. // | dojo.setStyle("thinger", {
  8756. // | "opacity": 0.5,
  8757. // | "border": "3px solid black",
  8758. // | "height": "300px"
  8759. // | });
  8760. //
  8761. // example:
  8762. // When the CSS style property is hyphenated, the JavaScript property is camelCased.
  8763. // font-size becomes fontSize, and so on.
  8764. // | dojo.setStyle("thinger",{
  8765. // | fontSize:"14pt",
  8766. // | letterSpacing:"1.2em"
  8767. // | });
  8768. //
  8769. // example:
  8770. // dojo.NodeList implements .style() using the same syntax, omitting the "node" parameter, calling
  8771. // dojo.style() on every element of the list. See: `dojo.query()` and `dojo.NodeList()`
  8772. // | dojo.query(".someClassName").style("visibility","hidden");
  8773. // | // or
  8774. // | dojo.query("#baz > div").style({
  8775. // | opacity:0.75,
  8776. // | fontSize:"13pt"
  8777. // | });
  8778. };
  8779. =====*/
  8780. // Although we normally eschew argument validation at this
  8781. // level, here we test argument 'node' for (duck)type,
  8782. // by testing nodeType, ecause 'document' is the 'parentNode' of 'body'
  8783. // it is frequently sent to this function even
  8784. // though it is not Element.
  8785. var getComputedStyle, style = {};
  8786. if(has("webkit")){
  8787. getComputedStyle = function(/*DomNode*/node){
  8788. var s;
  8789. if(node.nodeType == 1){
  8790. var dv = node.ownerDocument.defaultView;
  8791. s = dv.getComputedStyle(node, null);
  8792. if(!s && node.style){
  8793. node.style.display = "";
  8794. s = dv.getComputedStyle(node, null);
  8795. }
  8796. }
  8797. return s || {};
  8798. };
  8799. }else if(has("ie") && (has("ie") < 9 || has("quirks"))){
  8800. getComputedStyle = function(node){
  8801. // IE (as of 7) doesn't expose Element like sane browsers
  8802. return node.nodeType == 1 /* ELEMENT_NODE*/ ? node.currentStyle : {};
  8803. };
  8804. }else{
  8805. getComputedStyle = function(node){
  8806. return node.nodeType == 1 ?
  8807. node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
  8808. };
  8809. }
  8810. style.getComputedStyle = getComputedStyle;
  8811. var toPixel;
  8812. if(!has("ie")){
  8813. toPixel = function(element, value){
  8814. // style values can be floats, client code may want
  8815. // to round for integer pixels.
  8816. return parseFloat(value) || 0;
  8817. };
  8818. }else{
  8819. toPixel = function(element, avalue){
  8820. if(!avalue){ return 0; }
  8821. // on IE7, medium is usually 4 pixels
  8822. if(avalue == "medium"){ return 4; }
  8823. // style values can be floats, client code may
  8824. // want to round this value for integer pixels.
  8825. if(avalue.slice && avalue.slice(-2) == 'px'){ return parseFloat(avalue); }
  8826. var s = element.style, rs = element.runtimeStyle, cs = element.currentStyle,
  8827. sLeft = s.left, rsLeft = rs.left;
  8828. rs.left = cs.left;
  8829. try{
  8830. // 'avalue' may be incompatible with style.left, which can cause IE to throw
  8831. // this has been observed for border widths using "thin", "medium", "thick" constants
  8832. // those particular constants could be trapped by a lookup
  8833. // but perhaps there are more
  8834. s.left = avalue;
  8835. avalue = s.pixelLeft;
  8836. }catch(e){
  8837. avalue = 0;
  8838. }
  8839. s.left = sLeft;
  8840. rs.left = rsLeft;
  8841. return avalue;
  8842. }
  8843. }
  8844. style.toPixelValue = toPixel;
  8845. // FIXME: there opacity quirks on FF that we haven't ported over. Hrm.
  8846. var astr = "DXImageTransform.Microsoft.Alpha";
  8847. var af = function(n, f){
  8848. try{
  8849. return n.filters.item(astr);
  8850. }catch(e){
  8851. return f ? {} : null;
  8852. }
  8853. };
  8854. var _getOpacity =
  8855. has("ie") < 9 || (has("ie") < 10 && has("quirks")) ? function(node){
  8856. try{
  8857. return af(node).Opacity / 100; // Number
  8858. }catch(e){
  8859. return 1; // Number
  8860. }
  8861. } :
  8862. function(node){
  8863. return getComputedStyle(node).opacity;
  8864. };
  8865. var _setOpacity =
  8866. has("ie") < 9 || (has("ie") < 10 && has("quirks")) ? function(/*DomNode*/node, /*Number*/opacity){
  8867. var ov = opacity * 100, opaque = opacity == 1;
  8868. node.style.zoom = opaque ? "" : 1;
  8869. if(!af(node)){
  8870. if(opaque){
  8871. return opacity;
  8872. }
  8873. node.style.filter += " progid:" + astr + "(Opacity=" + ov + ")";
  8874. }else{
  8875. af(node, 1).Opacity = ov;
  8876. }
  8877. // on IE7 Alpha(Filter opacity=100) makes text look fuzzy so disable it altogether (bug #2661),
  8878. //but still update the opacity value so we can get a correct reading if it is read later.
  8879. af(node, 1).Enabled = !opaque;
  8880. if(node.tagName.toLowerCase() == "tr"){
  8881. for(var td = node.firstChild; td; td = td.nextSibling){
  8882. if(td.tagName.toLowerCase() == "td"){
  8883. _setOpacity(td, opacity);
  8884. }
  8885. }
  8886. }
  8887. return opacity;
  8888. } :
  8889. function(node, opacity){
  8890. return node.style.opacity = opacity;
  8891. };
  8892. var _pixelNamesCache = {
  8893. left: true, top: true
  8894. };
  8895. var _pixelRegExp = /margin|padding|width|height|max|min|offset/; // |border
  8896. function _toStyleValue(node, type, value){
  8897. //TODO: should we really be doing string case conversion here? Should we cache it? Need to profile!
  8898. type = type.toLowerCase();
  8899. if(has("ie")){
  8900. if(value == "auto"){
  8901. if(type == "height"){ return node.offsetHeight; }
  8902. if(type == "width"){ return node.offsetWidth; }
  8903. }
  8904. if(type == "fontweight"){
  8905. switch(value){
  8906. case 700: return "bold";
  8907. case 400:
  8908. default: return "normal";
  8909. }
  8910. }
  8911. }
  8912. if(!(type in _pixelNamesCache)){
  8913. _pixelNamesCache[type] = _pixelRegExp.test(type);
  8914. }
  8915. return _pixelNamesCache[type] ? toPixel(node, value) : value;
  8916. }
  8917. var _floatAliases = {cssFloat: 1, styleFloat: 1, "float": 1};
  8918. // public API
  8919. style.get = function getStyle(/*DOMNode|String*/ node, /*String?*/ name){
  8920. var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
  8921. if(l == 2 && op){
  8922. return _getOpacity(n);
  8923. }
  8924. name = _floatAliases[name] ? "cssFloat" in n.style ? "cssFloat" : "styleFloat" : name;
  8925. var s = style.getComputedStyle(n);
  8926. return (l == 1) ? s : _toStyleValue(n, name, s[name] || n.style[name]); /* CSS2Properties||String||Number */
  8927. };
  8928. style.set = function setStyle(/*DOMNode|String*/ node, /*String|Object*/ name, /*String?*/ value){
  8929. var n = dom.byId(node), l = arguments.length, op = (name == "opacity");
  8930. name = _floatAliases[name] ? "cssFloat" in n.style ? "cssFloat" : "styleFloat" : name;
  8931. if(l == 3){
  8932. return op ? _setOpacity(n, value) : n.style[name] = value; // Number
  8933. }
  8934. for(var x in name){
  8935. style.set(node, x, name[x]);
  8936. }
  8937. return style.getComputedStyle(n);
  8938. };
  8939. return style;
  8940. });
  8941. },
  8942. 'dojo/dom-geometry':function(){
  8943. define(["./_base/sniff", "./_base/window","./dom", "./dom-style"],
  8944. function(has, win, dom, style){
  8945. // module:
  8946. // dojo/dom-geometry
  8947. // summary:
  8948. // This module defines the core dojo DOM geometry API.
  8949. var geom = {}; // the result object
  8950. // Box functions will assume this model.
  8951. // On IE/Opera, BORDER_BOX will be set if the primary document is in quirks mode.
  8952. // Can be set to change behavior of box setters.
  8953. // can be either:
  8954. // "border-box"
  8955. // "content-box" (default)
  8956. geom.boxModel = "content-box";
  8957. // We punt per-node box mode testing completely.
  8958. // If anybody cares, we can provide an additional (optional) unit
  8959. // that overrides existing code to include per-node box sensitivity.
  8960. // Opera documentation claims that Opera 9 uses border-box in BackCompat mode.
  8961. // but experiments (Opera 9.10.8679 on Windows Vista) indicate that it actually continues to use content-box.
  8962. // IIRC, earlier versions of Opera did in fact use border-box.
  8963. // Opera guys, this is really confusing. Opera being broken in quirks mode is not our fault.
  8964. if(has("ie") /*|| has("opera")*/){
  8965. // client code may have to adjust if compatMode varies across iframes
  8966. geom.boxModel = document.compatMode == "BackCompat" ? "border-box" : "content-box";
  8967. }
  8968. // =============================
  8969. // Box Functions
  8970. // =============================
  8971. /*=====
  8972. dojo.getPadExtents = function(node, computedStyle){
  8973. // summary:
  8974. // Returns object with special values specifically useful for node
  8975. // fitting.
  8976. // description:
  8977. // Returns an object with `w`, `h`, `l`, `t` properties:
  8978. // | l/t/r/b = left/top/right/bottom padding (respectively)
  8979. // | w = the total of the left and right padding
  8980. // | h = the total of the top and bottom padding
  8981. // If 'node' has position, l/t forms the origin for child nodes.
  8982. // The w/h are used for calculating boxes.
  8983. // Normally application code will not need to invoke this
  8984. // directly, and will use the ...box... functions instead.
  8985. // node: DOMNode
  8986. // computedStyle: Object?
  8987. // This parameter accepts computed styles object.
  8988. // If this parameter is omitted, the functions will call
  8989. // dojo.getComputedStyle to get one. It is a better way, calling
  8990. // dojo.computedStyle once, and then pass the reference to this
  8991. // computedStyle parameter. Wherever possible, reuse the returned
  8992. // object of dojo.getComputedStyle.
  8993. };
  8994. =====*/
  8995. /*=====
  8996. dojo._getPadExtents = function(node, computedStyle){
  8997. // summary:
  8998. // Existing alias for `dojo.getPadExtents`. Deprecated, will be removed in 2.0.
  8999. };
  9000. =====*/
  9001. /*=====
  9002. dojo.getBorderExtents = function(node, computedStyle){
  9003. // summary:
  9004. // returns an object with properties useful for noting the border
  9005. // dimensions.
  9006. // description:
  9007. // * l/t/r/b = the sum of left/top/right/bottom border (respectively)
  9008. // * w = the sum of the left and right border
  9009. // * h = the sum of the top and bottom border
  9010. //
  9011. // The w/h are used for calculating boxes.
  9012. // Normally application code will not need to invoke this
  9013. // directly, and will use the ...box... functions instead.
  9014. // node: DOMNode
  9015. // computedStyle: Object?
  9016. // This parameter accepts computed styles object.
  9017. // If this parameter is omitted, the functions will call
  9018. // dojo.getComputedStyle to get one. It is a better way, calling
  9019. // dojo.computedStyle once, and then pass the reference to this
  9020. // computedStyle parameter. Wherever possible, reuse the returned
  9021. // object of dojo.getComputedStyle.
  9022. };
  9023. =====*/
  9024. /*=====
  9025. dojo._getBorderExtents = function(node, computedStyle){
  9026. // summary:
  9027. // Existing alias for `dojo.getBorderExtents`. Deprecated, will be removed in 2.0.
  9028. };
  9029. =====*/
  9030. /*=====
  9031. dojo.getPadBorderExtents = function(node, computedStyle){
  9032. // summary:
  9033. // Returns object with properties useful for box fitting with
  9034. // regards to padding.
  9035. // description:
  9036. // * l/t/r/b = the sum of left/top/right/bottom padding and left/top/right/bottom border (respectively)
  9037. // * w = the sum of the left and right padding and border
  9038. // * h = the sum of the top and bottom padding and border
  9039. //
  9040. // The w/h are used for calculating boxes.
  9041. // Normally application code will not need to invoke this
  9042. // directly, and will use the ...box... functions instead.
  9043. // node: DOMNode
  9044. // computedStyle: Object?
  9045. // This parameter accepts computed styles object.
  9046. // If this parameter is omitted, the functions will call
  9047. // dojo.getComputedStyle to get one. It is a better way, calling
  9048. // dojo.computedStyle once, and then pass the reference to this
  9049. // computedStyle parameter. Wherever possible, reuse the returned
  9050. // object of dojo.getComputedStyle.
  9051. };
  9052. =====*/
  9053. /*=====
  9054. dojo._getPadBorderExtents = function(node, computedStyle){
  9055. // summary:
  9056. // Existing alias for `dojo.getPadBorderExtents`. Deprecated, will be removed in 2.0.
  9057. };
  9058. =====*/
  9059. /*=====
  9060. dojo.getMarginExtents = function(node, computedStyle){
  9061. // summary:
  9062. // returns object with properties useful for box fitting with
  9063. // regards to box margins (i.e., the outer-box).
  9064. //
  9065. // * l/t = marginLeft, marginTop, respectively
  9066. // * w = total width, margin inclusive
  9067. // * h = total height, margin inclusive
  9068. //
  9069. // The w/h are used for calculating boxes.
  9070. // Normally application code will not need to invoke this
  9071. // directly, and will use the ...box... functions instead.
  9072. // node: DOMNode
  9073. // computedStyle: Object?
  9074. // This parameter accepts computed styles object.
  9075. // If this parameter is omitted, the functions will call
  9076. // dojo.getComputedStyle to get one. It is a better way, calling
  9077. // dojo.computedStyle once, and then pass the reference to this
  9078. // computedStyle parameter. Wherever possible, reuse the returned
  9079. // object of dojo.getComputedStyle.
  9080. };
  9081. =====*/
  9082. /*=====
  9083. dojo._getMarginExtents = function(node, computedStyle){
  9084. // summary:
  9085. // Existing alias for `dojo.getMarginExtents`. Deprecated, will be removed in 2.0.
  9086. };
  9087. =====*/
  9088. /*=====
  9089. dojo.getMarginSize = function(node, computedStyle){
  9090. // summary:
  9091. // returns an object that encodes the width and height of
  9092. // the node's margin box
  9093. // node: DOMNode|String
  9094. // computedStyle: Object?
  9095. // This parameter accepts computed styles object.
  9096. // If this parameter is omitted, the functions will call
  9097. // dojo.getComputedStyle to get one. It is a better way, calling
  9098. // dojo.computedStyle once, and then pass the reference to this
  9099. // computedStyle parameter. Wherever possible, reuse the returned
  9100. // object of dojo.getComputedStyle.
  9101. };
  9102. =====*/
  9103. /*=====
  9104. dojo._getMarginSize = function(node, computedStyle){
  9105. // summary:
  9106. // Existing alias for `dojo.getMarginSize`. Deprecated, will be removed in 2.0.
  9107. };
  9108. =====*/
  9109. /*=====
  9110. dojo.getMarginBox = function(node, computedStyle){
  9111. // summary:
  9112. // returns an object that encodes the width, height, left and top
  9113. // positions of the node's margin box.
  9114. // node: DOMNode
  9115. // computedStyle: Object?
  9116. // This parameter accepts computed styles object.
  9117. // If this parameter is omitted, the functions will call
  9118. // dojo.getComputedStyle to get one. It is a better way, calling
  9119. // dojo.computedStyle once, and then pass the reference to this
  9120. // computedStyle parameter. Wherever possible, reuse the returned
  9121. // object of dojo.getComputedStyle.
  9122. };
  9123. =====*/
  9124. /*=====
  9125. dojo._getMarginBox = function(node, computedStyle){
  9126. // summary:
  9127. // Existing alias for `dojo.getMarginBox`. Deprecated, will be removed in 2.0.
  9128. };
  9129. =====*/
  9130. /*=====
  9131. dojo.setMarginBox = function(node, box, computedStyle){
  9132. // summary:
  9133. // sets the size of the node's margin box and placement
  9134. // (left/top), irrespective of box model. Think of it as a
  9135. // passthrough to setBox that handles box-model vagaries for
  9136. // you.
  9137. // node: DOMNode
  9138. // box: Object
  9139. // hash with optional "l", "t", "w", and "h" properties for "left", "right", "width", and "height"
  9140. // respectively. All specified properties should have numeric values in whole pixels.
  9141. // computedStyle: Object?
  9142. // This parameter accepts computed styles object.
  9143. // If this parameter is omitted, the functions will call
  9144. // dojo.getComputedStyle to get one. It is a better way, calling
  9145. // dojo.computedStyle once, and then pass the reference to this
  9146. // computedStyle parameter. Wherever possible, reuse the returned
  9147. // object of dojo.getComputedStyle.
  9148. };
  9149. =====*/
  9150. /*=====
  9151. dojo.getContentBox = function(node, computedStyle){
  9152. // summary:
  9153. // Returns an object that encodes the width, height, left and top
  9154. // positions of the node's content box, irrespective of the
  9155. // current box model.
  9156. // node: DOMNode
  9157. // computedStyle: Object?
  9158. // This parameter accepts computed styles object.
  9159. // If this parameter is omitted, the functions will call
  9160. // dojo.getComputedStyle to get one. It is a better way, calling
  9161. // dojo.computedStyle once, and then pass the reference to this
  9162. // computedStyle parameter. Wherever possible, reuse the returned
  9163. // object of dojo.getComputedStyle.
  9164. };
  9165. =====*/
  9166. /*=====
  9167. dojo._getContentBox = function(node, computedStyle){
  9168. // summary:
  9169. // Existing alias for `dojo.getContentBox`. Deprecated, will be removed in 2.0.
  9170. };
  9171. =====*/
  9172. /*=====
  9173. dojo.setContentSize = function(node, box, computedStyle){
  9174. // summary:
  9175. // Sets the size of the node's contents, irrespective of margins,
  9176. // padding, or borders.
  9177. // node: DOMNode
  9178. // box: Object
  9179. // hash with optional "w", and "h" properties for "width", and "height"
  9180. // respectively. All specified properties should have numeric values in whole pixels.
  9181. // computedStyle: Object?
  9182. // This parameter accepts computed styles object.
  9183. // If this parameter is omitted, the functions will call
  9184. // dojo.getComputedStyle to get one. It is a better way, calling
  9185. // dojo.computedStyle once, and then pass the reference to this
  9186. // computedStyle parameter. Wherever possible, reuse the returned
  9187. // object of dojo.getComputedStyle.
  9188. };
  9189. =====*/
  9190. /*=====
  9191. dojo.isBodyLtr = function(){
  9192. // summary:
  9193. // Returns true if the current language is left-to-right, and false otherwise.
  9194. // returns: Boolean
  9195. };
  9196. =====*/
  9197. /*=====
  9198. dojo._isBodyLtr = function(){
  9199. // summary:
  9200. // Existing alias for `dojo.isBodyLtr`. Deprecated, will be removed in 2.0.
  9201. };
  9202. =====*/
  9203. /*=====
  9204. dojo.docScroll = function(){
  9205. // summary:
  9206. // Returns an object with {node, x, y} with corresponding offsets.
  9207. // returns: Object
  9208. };
  9209. =====*/
  9210. /*=====
  9211. dojo._docScroll = function(){
  9212. // summary:
  9213. // Existing alias for `dojo.docScroll`. Deprecated, will be removed in 2.0.
  9214. };
  9215. =====*/
  9216. /*=====
  9217. dojo.getIeDocumentElementOffset = function(){
  9218. // summary:
  9219. // returns the offset in x and y from the document body to the
  9220. // visual edge of the page for IE
  9221. // description:
  9222. // The following values in IE contain an offset:
  9223. // | event.clientX
  9224. // | event.clientY
  9225. // | node.getBoundingClientRect().left
  9226. // | node.getBoundingClientRect().top
  9227. // But other position related values do not contain this offset,
  9228. // such as node.offsetLeft, node.offsetTop, node.style.left and
  9229. // node.style.top. The offset is always (2, 2) in LTR direction.
  9230. // When the body is in RTL direction, the offset counts the width
  9231. // of left scroll bar's width. This function computes the actual
  9232. // offset.
  9233. };
  9234. =====*/
  9235. /*=====
  9236. dojo._getIeDocumentElementOffset = function(){
  9237. // summary:
  9238. // Existing alias for `dojo.getIeDocumentElementOffset`. Deprecated, will be removed in 2.0.
  9239. };
  9240. =====*/
  9241. /*=====
  9242. dojo.fixIeBiDiScrollLeft = function(scrollLeft){
  9243. // summary:
  9244. // In RTL direction, scrollLeft should be a negative value, but IE
  9245. // returns a positive one. All codes using documentElement.scrollLeft
  9246. // must call this function to fix this error, otherwise the position
  9247. // will offset to right when there is a horizontal scrollbar.
  9248. // scrollLeft: NUmber
  9249. // returns: Number
  9250. };
  9251. =====*/
  9252. /*=====
  9253. dojo._fixIeBiDiScrollLeft = function(scrollLeft){
  9254. // summary:
  9255. // Existing alias for `dojo.fixIeBiDiScrollLeft`. Deprecated, will be removed in 2.0.
  9256. };
  9257. =====*/
  9258. /*=====
  9259. dojo.position = function(node, includeScroll){
  9260. // summary:
  9261. // Gets the position and size of the passed element relative to
  9262. // the viewport (if includeScroll==false), or relative to the
  9263. // document root (if includeScroll==true).
  9264. //
  9265. // description:
  9266. // Returns an object of the form:
  9267. // { x: 100, y: 300, w: 20, h: 15 }
  9268. // If includeScroll==true, the x and y values will include any
  9269. // document offsets that may affect the position relative to the
  9270. // viewport.
  9271. // Uses the border-box model (inclusive of border and padding but
  9272. // not margin). Does not act as a setter.
  9273. // node: DOMNode|String
  9274. // includeScroll: Boolean?
  9275. // returns: Object
  9276. };
  9277. =====*/
  9278. geom.getPadExtents = function getPadExtents(/*DomNode*/node, /*Object*/computedStyle){
  9279. node = dom.byId(node);
  9280. var s = computedStyle || style.getComputedStyle(node), px = style.toPixelValue,
  9281. l = px(node, s.paddingLeft), t = px(node, s.paddingTop), r = px(node, s.paddingRight), b = px(node, s.paddingBottom);
  9282. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9283. };
  9284. var none = "none";
  9285. geom.getBorderExtents = function getBorderExtents(/*DomNode*/node, /*Object*/computedStyle){
  9286. node = dom.byId(node);
  9287. var px = style.toPixelValue, s = computedStyle || style.getComputedStyle(node),
  9288. l = s.borderLeftStyle != none ? px(node, s.borderLeftWidth) : 0,
  9289. t = s.borderTopStyle != none ? px(node, s.borderTopWidth) : 0,
  9290. r = s.borderRightStyle != none ? px(node, s.borderRightWidth) : 0,
  9291. b = s.borderBottomStyle != none ? px(node, s.borderBottomWidth) : 0;
  9292. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9293. };
  9294. geom.getPadBorderExtents = function getPadBorderExtents(/*DomNode*/node, /*Object*/computedStyle){
  9295. node = dom.byId(node);
  9296. var s = computedStyle || style.getComputedStyle(node),
  9297. p = geom.getPadExtents(node, s),
  9298. b = geom.getBorderExtents(node, s);
  9299. return {
  9300. l: p.l + b.l,
  9301. t: p.t + b.t,
  9302. r: p.r + b.r,
  9303. b: p.b + b.b,
  9304. w: p.w + b.w,
  9305. h: p.h + b.h
  9306. };
  9307. };
  9308. geom.getMarginExtents = function getMarginExtents(node, computedStyle){
  9309. node = dom.byId(node);
  9310. var s = computedStyle || style.getComputedStyle(node), px = style.toPixelValue,
  9311. l = px(node, s.marginLeft), t = px(node, s.marginTop), r = px(node, s.marginRight), b = px(node, s.marginBottom);
  9312. if(has("webkit") && (s.position != "absolute")){
  9313. // FIXME: Safari's version of the computed right margin
  9314. // is the space between our right edge and the right edge
  9315. // of our offsetParent.
  9316. // What we are looking for is the actual margin value as
  9317. // determined by CSS.
  9318. // Hack solution is to assume left/right margins are the same.
  9319. r = l;
  9320. }
  9321. return {l: l, t: t, r: r, b: b, w: l + r, h: t + b};
  9322. };
  9323. // Box getters work in any box context because offsetWidth/clientWidth
  9324. // are invariant wrt box context
  9325. //
  9326. // They do *not* work for display: inline objects that have padding styles
  9327. // because the user agent ignores padding (it's bogus styling in any case)
  9328. //
  9329. // Be careful with IMGs because they are inline or block depending on
  9330. // browser and browser mode.
  9331. // Although it would be easier to read, there are not separate versions of
  9332. // _getMarginBox for each browser because:
  9333. // 1. the branching is not expensive
  9334. // 2. factoring the shared code wastes cycles (function call overhead)
  9335. // 3. duplicating the shared code wastes bytes
  9336. geom.getMarginBox = function getMarginBox(/*DomNode*/node, /*Object*/computedStyle){
  9337. // summary:
  9338. // returns an object that encodes the width, height, left and top
  9339. // positions of the node's margin box.
  9340. node = dom.byId(node);
  9341. var s = computedStyle || style.getComputedStyle(node), me = geom.getMarginExtents(node, s),
  9342. l = node.offsetLeft - me.l, t = node.offsetTop - me.t, p = node.parentNode, px = style.toPixelValue, pcs;
  9343. if(has("mozilla")){
  9344. // Mozilla:
  9345. // If offsetParent has a computed overflow != visible, the offsetLeft is decreased
  9346. // by the parent's border.
  9347. // We don't want to compute the parent's style, so instead we examine node's
  9348. // computed left/top which is more stable.
  9349. var sl = parseFloat(s.left), st = parseFloat(s.top);
  9350. if(!isNaN(sl) && !isNaN(st)){
  9351. l = sl, t = st;
  9352. }else{
  9353. // If child's computed left/top are not parseable as a number (e.g. "auto"), we
  9354. // have no choice but to examine the parent's computed style.
  9355. if(p && p.style){
  9356. pcs = style.getComputedStyle(p);
  9357. if(pcs.overflow != "visible"){
  9358. l += pcs.borderLeftStyle != none ? px(node, pcs.borderLeftWidth) : 0;
  9359. t += pcs.borderTopStyle != none ? px(node, pcs.borderTopWidth) : 0;
  9360. }
  9361. }
  9362. }
  9363. }else if(has("opera") || (has("ie") == 8 && !has("quirks"))){
  9364. // On Opera and IE 8, offsetLeft/Top includes the parent's border
  9365. if(p){
  9366. pcs = style.getComputedStyle(p);
  9367. l -= pcs.borderLeftStyle != none ? px(node, pcs.borderLeftWidth) : 0;
  9368. t -= pcs.borderTopStyle != none ? px(node, pcs.borderTopWidth) : 0;
  9369. }
  9370. }
  9371. return {l: l, t: t, w: node.offsetWidth + me.w, h: node.offsetHeight + me.h};
  9372. };
  9373. geom.getContentBox = function getContentBox(node, computedStyle){
  9374. // clientWidth/Height are important since the automatically account for scrollbars
  9375. // fallback to offsetWidth/Height for special cases (see #3378)
  9376. node = dom.byId(node);
  9377. var s = computedStyle || style.getComputedStyle(node), w = node.clientWidth, h,
  9378. pe = geom.getPadExtents(node, s), be = geom.getBorderExtents(node, s);
  9379. if(!w){
  9380. w = node.offsetWidth;
  9381. h = node.offsetHeight;
  9382. }else{
  9383. h = node.clientHeight;
  9384. be.w = be.h = 0;
  9385. }
  9386. // On Opera, offsetLeft includes the parent's border
  9387. if(has("opera")){
  9388. pe.l += be.l;
  9389. pe.t += be.t;
  9390. }
  9391. return {l: pe.l, t: pe.t, w: w - pe.w - be.w, h: h - pe.h - be.h};
  9392. };
  9393. // Box setters depend on box context because interpretation of width/height styles
  9394. // vary wrt box context.
  9395. //
  9396. // The value of dojo.boxModel is used to determine box context.
  9397. // dojo.boxModel can be set directly to change behavior.
  9398. //
  9399. // Beware of display: inline objects that have padding styles
  9400. // because the user agent ignores padding (it's a bogus setup anyway)
  9401. //
  9402. // Be careful with IMGs because they are inline or block depending on
  9403. // browser and browser mode.
  9404. //
  9405. // Elements other than DIV may have special quirks, like built-in
  9406. // margins or padding, or values not detectable via computedStyle.
  9407. // In particular, margins on TABLE do not seems to appear
  9408. // at all in computedStyle on Mozilla.
  9409. function setBox(/*DomNode*/node, /*Number?*/l, /*Number?*/t, /*Number?*/w, /*Number?*/h, /*String?*/u){
  9410. // summary:
  9411. // sets width/height/left/top in the current (native) box-model
  9412. // dimensions. Uses the unit passed in u.
  9413. // node:
  9414. // DOM Node reference. Id string not supported for performance
  9415. // reasons.
  9416. // l:
  9417. // left offset from parent.
  9418. // t:
  9419. // top offset from parent.
  9420. // w:
  9421. // width in current box model.
  9422. // h:
  9423. // width in current box model.
  9424. // u:
  9425. // unit measure to use for other measures. Defaults to "px".
  9426. u = u || "px";
  9427. var s = node.style;
  9428. if(!isNaN(l)){
  9429. s.left = l + u;
  9430. }
  9431. if(!isNaN(t)){
  9432. s.top = t + u;
  9433. }
  9434. if(w >= 0){
  9435. s.width = w + u;
  9436. }
  9437. if(h >= 0){
  9438. s.height = h + u;
  9439. }
  9440. }
  9441. function isButtonTag(/*DomNode*/node){
  9442. // summary:
  9443. // True if the node is BUTTON or INPUT.type="button".
  9444. return node.tagName.toLowerCase() == "button" ||
  9445. node.tagName.toLowerCase() == "input" && (node.getAttribute("type") || "").toLowerCase() == "button"; // boolean
  9446. }
  9447. function usesBorderBox(/*DomNode*/node){
  9448. // summary:
  9449. // True if the node uses border-box layout.
  9450. // We could test the computed style of node to see if a particular box
  9451. // has been specified, but there are details and we choose not to bother.
  9452. // TABLE and BUTTON (and INPUT type=button) are always border-box by default.
  9453. // If you have assigned a different box to either one via CSS then
  9454. // box functions will break.
  9455. return geom.boxModel == "border-box" || node.tagName.toLowerCase() == "table" || isButtonTag(node); // boolean
  9456. }
  9457. geom.setContentSize = function setContentSize(/*DomNode*/node, /*Object*/box, /*Object*/computedStyle){
  9458. // summary:
  9459. // Sets the size of the node's contents, irrespective of margins,
  9460. // padding, or borders.
  9461. node = dom.byId(node);
  9462. var w = box.w, h = box.h;
  9463. if(usesBorderBox(node)){
  9464. var pb = geom.getPadBorderExtents(node, computedStyle);
  9465. if(w >= 0){
  9466. w += pb.w;
  9467. }
  9468. if(h >= 0){
  9469. h += pb.h;
  9470. }
  9471. }
  9472. setBox(node, NaN, NaN, w, h);
  9473. };
  9474. var nilExtents = {l: 0, t: 0, w: 0, h: 0};
  9475. geom.setMarginBox = function setMarginBox(/*DomNode*/node, /*Object*/box, /*Object*/computedStyle){
  9476. node = dom.byId(node);
  9477. var s = computedStyle || style.getComputedStyle(node), w = box.w, h = box.h,
  9478. // Some elements have special padding, margin, and box-model settings.
  9479. // To use box functions you may need to set padding, margin explicitly.
  9480. // Controlling box-model is harder, in a pinch you might set dojo.boxModel.
  9481. pb = usesBorderBox(node) ? nilExtents : geom.getPadBorderExtents(node, s),
  9482. mb = geom.getMarginExtents(node, s);
  9483. if(has("webkit")){
  9484. // on Safari (3.1.2), button nodes with no explicit size have a default margin
  9485. // setting an explicit size eliminates the margin.
  9486. // We have to swizzle the width to get correct margin reading.
  9487. if(isButtonTag(node)){
  9488. var ns = node.style;
  9489. if(w >= 0 && !ns.width){
  9490. ns.width = "4px";
  9491. }
  9492. if(h >= 0 && !ns.height){
  9493. ns.height = "4px";
  9494. }
  9495. }
  9496. }
  9497. if(w >= 0){
  9498. w = Math.max(w - pb.w - mb.w, 0);
  9499. }
  9500. if(h >= 0){
  9501. h = Math.max(h - pb.h - mb.h, 0);
  9502. }
  9503. setBox(node, box.l, box.t, w, h);
  9504. };
  9505. // =============================
  9506. // Positioning
  9507. // =============================
  9508. geom.isBodyLtr = function isBodyLtr(){
  9509. return (win.body().dir || win.doc.documentElement.dir || "ltr").toLowerCase() == "ltr"; // Boolean
  9510. };
  9511. geom.docScroll = function docScroll(){
  9512. var node = win.doc.parentWindow || win.doc.defaultView; // use UI window, not dojo.global window
  9513. return "pageXOffset" in node ? {x: node.pageXOffset, y: node.pageYOffset } :
  9514. (node = has("quirks") ? win.body() : win.doc.documentElement,
  9515. {x: geom.fixIeBiDiScrollLeft(node.scrollLeft || 0), y: node.scrollTop || 0 });
  9516. };
  9517. geom.getIeDocumentElementOffset = function getIeDocumentElementOffset(){
  9518. //NOTE: assumes we're being called in an IE browser
  9519. var de = win.doc.documentElement; // only deal with HTML element here, position() handles body/quirks
  9520. if(has("ie") < 8){
  9521. var r = de.getBoundingClientRect(), // works well for IE6+
  9522. l = r.left, t = r.top;
  9523. if(has("ie") < 7){
  9524. l += de.clientLeft; // scrollbar size in strict/RTL, or,
  9525. t += de.clientTop; // HTML border size in strict
  9526. }
  9527. return {
  9528. x: l < 0 ? 0 : l, // FRAME element border size can lead to inaccurate negative values
  9529. y: t < 0 ? 0 : t
  9530. };
  9531. }else{
  9532. return {
  9533. x: 0,
  9534. y: 0
  9535. };
  9536. }
  9537. };
  9538. geom.fixIeBiDiScrollLeft = function fixIeBiDiScrollLeft(/*Integer*/ scrollLeft){
  9539. // In RTL direction, scrollLeft should be a negative value, but IE
  9540. // returns a positive one. All codes using documentElement.scrollLeft
  9541. // must call this function to fix this error, otherwise the position
  9542. // will offset to right when there is a horizontal scrollbar.
  9543. var ie = has("ie");
  9544. if(ie && !geom.isBodyLtr()){
  9545. var qk = has("quirks"),
  9546. de = qk ? win.body() : win.doc.documentElement;
  9547. if(ie == 6 && !qk && win.global.frameElement && de.scrollHeight > de.clientHeight){
  9548. scrollLeft += de.clientLeft; // workaround ie6+strict+rtl+iframe+vertical-scrollbar bug where clientWidth is too small by clientLeft pixels
  9549. }
  9550. return (ie < 8 || qk) ? (scrollLeft + de.clientWidth - de.scrollWidth) : -scrollLeft; // Integer
  9551. }
  9552. return scrollLeft; // Integer
  9553. };
  9554. geom.position = function(/*DomNode*/node, /*Boolean?*/includeScroll){
  9555. node = dom.byId(node);
  9556. var db = win.body(),
  9557. dh = db.parentNode,
  9558. ret = node.getBoundingClientRect();
  9559. ret = {x: ret.left, y: ret.top, w: ret.right - ret.left, h: ret.bottom - ret.top};
  9560. if(has("ie") < 9){
  9561. // On IE<9 there's a 2px offset that we need to adjust for, see dojo.getIeDocumentElementOffset()
  9562. var offset = geom.getIeDocumentElementOffset();
  9563. // fixes the position in IE, quirks mode
  9564. ret.x -= offset.x + (has("quirks") ? db.clientLeft + db.offsetLeft : 0);
  9565. ret.y -= offset.y + (has("quirks") ? db.clientTop + db.offsetTop : 0);
  9566. }else if(has("ff") == 3){
  9567. // In FF3 you have to subtract the document element margins.
  9568. // Fixed in FF3.5 though.
  9569. var cs = style.getComputedStyle(dh), px = style.toPixelValue;
  9570. ret.x -= px(dh, cs.marginLeft) + px(dh, cs.borderLeftWidth);
  9571. ret.y -= px(dh, cs.marginTop) + px(dh, cs.borderTopWidth);
  9572. }
  9573. // account for document scrolling
  9574. // if offsetParent is used, ret value already includes scroll position
  9575. // so we may have to actually remove that value if !includeScroll
  9576. if(includeScroll){
  9577. var scroll = geom.docScroll();
  9578. ret.x += scroll.x;
  9579. ret.y += scroll.y;
  9580. }
  9581. return ret; // Object
  9582. };
  9583. // random "private" functions wildly used throughout the toolkit
  9584. geom.getMarginSize = function getMarginSize(/*DomNode*/node, /*Object*/computedStyle){
  9585. node = dom.byId(node);
  9586. var me = geom.getMarginExtents(node, computedStyle || style.getComputedStyle(node));
  9587. var size = node.getBoundingClientRect();
  9588. return {
  9589. w: (size.right - size.left) + me.w,
  9590. h: (size.bottom - size.top) + me.h
  9591. }
  9592. };
  9593. geom.normalizeEvent = function(event){
  9594. // summary:
  9595. // Normalizes the geometry of a DOM event, normalizing the pageX, pageY,
  9596. // offsetX, offsetY, layerX, and layerX properties
  9597. // event: Object
  9598. if(!("layerX" in event)){
  9599. event.layerX = event.offsetX;
  9600. event.layerY = event.offsetY;
  9601. }
  9602. if(!has("dom-addeventlistener")){
  9603. // old IE version
  9604. // FIXME: scroll position query is duped from dojo.html to
  9605. // avoid dependency on that entire module. Now that HTML is in
  9606. // Base, we should convert back to something similar there.
  9607. var se = event.target;
  9608. var doc = (se && se.ownerDocument) || document;
  9609. // DO NOT replace the following to use dojo.body(), in IE, document.documentElement should be used
  9610. // here rather than document.body
  9611. var docBody = has("quirks") ? doc.body : doc.documentElement;
  9612. var offset = geom.getIeDocumentElementOffset();
  9613. event.pageX = event.clientX + geom.fixIeBiDiScrollLeft(docBody.scrollLeft || 0) - offset.x;
  9614. event.pageY = event.clientY + (docBody.scrollTop || 0) - offset.y;
  9615. }
  9616. };
  9617. // TODO: evaluate separate getters/setters for position and sizes?
  9618. return geom;
  9619. });
  9620. },
  9621. 'dojo/dom-prop':function(){
  9622. define(["exports", "./_base/kernel", "./_base/sniff", "./_base/lang", "./dom", "./dom-style", "./dom-construct", "./_base/connect"],
  9623. function(exports, dojo, has, lang, dom, style, ctr, conn){
  9624. // module:
  9625. // dojo/dom-prop
  9626. // summary:
  9627. // This module defines the core dojo DOM properties API.
  9628. // Indirectly depends on dojo.empty() and dojo.toDom().
  9629. // =============================
  9630. // Element properties Functions
  9631. // =============================
  9632. /*=====
  9633. prop.get = function(node, name){
  9634. // summary:
  9635. // Gets a property on an HTML element.
  9636. // description:
  9637. // Handles normalized getting of properties on DOM nodes.
  9638. //
  9639. // node: DOMNode|String
  9640. // id or reference to the element to get the property on
  9641. // name: String
  9642. // the name of the property to get.
  9643. // returns:
  9644. // the value of the requested property or its default value
  9645. //
  9646. // example:
  9647. // | // get the current value of the "foo" property on a node
  9648. // | dojo.getProp(dojo.byId("nodeId"), "foo");
  9649. // | // or we can just pass the id:
  9650. // | dojo.getProp("nodeId", "foo");
  9651. };
  9652. =====*/
  9653. /*=====
  9654. prop.set = function(node, name, value){
  9655. // summary:
  9656. // Sets a property on an HTML element.
  9657. // description:
  9658. // Handles normalized setting of properties on DOM nodes.
  9659. //
  9660. // When passing functions as values, note that they will not be
  9661. // directly assigned to slots on the node, but rather the default
  9662. // behavior will be removed and the new behavior will be added
  9663. // using `dojo.connect()`, meaning that event handler properties
  9664. // will be normalized and that some caveats with regards to
  9665. // non-standard behaviors for onsubmit apply. Namely that you
  9666. // should cancel form submission using `dojo.stopEvent()` on the
  9667. // passed event object instead of returning a boolean value from
  9668. // the handler itself.
  9669. // node: DOMNode|String
  9670. // id or reference to the element to set the property on
  9671. // name: String|Object
  9672. // the name of the property to set, or a hash object to set
  9673. // multiple properties at once.
  9674. // value: String?
  9675. // The value to set for the property
  9676. // returns:
  9677. // the DOM node
  9678. //
  9679. // example:
  9680. // | // use prop() to set the tab index
  9681. // | dojo.setProp("nodeId", "tabIndex", 3);
  9682. // |
  9683. //
  9684. // example:
  9685. // Set multiple values at once, including event handlers:
  9686. // | dojo.setProp("formId", {
  9687. // | "foo": "bar",
  9688. // | "tabIndex": -1,
  9689. // | "method": "POST",
  9690. // | "onsubmit": function(e){
  9691. // | // stop submitting the form. Note that the IE behavior
  9692. // | // of returning true or false will have no effect here
  9693. // | // since our handler is connect()ed to the built-in
  9694. // | // onsubmit behavior and so we need to use
  9695. // | // dojo.stopEvent() to ensure that the submission
  9696. // | // doesn't proceed.
  9697. // | dojo.stopEvent(e);
  9698. // |
  9699. // | // submit the form with Ajax
  9700. // | dojo.xhrPost({ form: "formId" });
  9701. // | }
  9702. // | });
  9703. //
  9704. // example:
  9705. // Style is s special case: Only set with an object hash of styles
  9706. // | dojo.setProp("someNode",{
  9707. // | id:"bar",
  9708. // | style:{
  9709. // | width:"200px", height:"100px", color:"#000"
  9710. // | }
  9711. // | });
  9712. //
  9713. // example:
  9714. // Again, only set style as an object hash of styles:
  9715. // | var obj = { color:"#fff", backgroundColor:"#000" };
  9716. // | dojo.setProp("someNode", "style", obj);
  9717. // |
  9718. // | // though shorter to use `dojo.style()` in this case:
  9719. // | dojo.style("someNode", obj);
  9720. };
  9721. =====*/
  9722. // helper to connect events
  9723. var _evtHdlrMap = {}, _ctr = 0, _attrId = dojo._scopeName + "attrid";
  9724. // the next dictionary lists elements with read-only innerHTML on IE
  9725. var _roInnerHtml = {col: 1, colgroup: 1,
  9726. // frameset: 1, head: 1, html: 1, style: 1,
  9727. table: 1, tbody: 1, tfoot: 1, thead: 1, tr: 1, title: 1};
  9728. exports.names = {
  9729. // properties renamed to avoid clashes with reserved words
  9730. "class": "className",
  9731. "for": "htmlFor",
  9732. // properties written as camelCase
  9733. tabindex: "tabIndex",
  9734. readonly: "readOnly",
  9735. colspan: "colSpan",
  9736. frameborder: "frameBorder",
  9737. rowspan: "rowSpan",
  9738. valuetype: "valueType"
  9739. };
  9740. exports.get = function getProp(/*DOMNode|String*/node, /*String*/name){
  9741. node = dom.byId(node);
  9742. var lc = name.toLowerCase(), propName = exports.names[lc] || name;
  9743. return node[propName]; // Anything
  9744. };
  9745. exports.set = function setProp(/*DOMNode|String*/node, /*String|Object*/name, /*String?*/value){
  9746. node = dom.byId(node);
  9747. var l = arguments.length;
  9748. if(l == 2 && typeof name != "string"){ // inline'd type check
  9749. // the object form of setter: the 2nd argument is a dictionary
  9750. for(var x in name){
  9751. exports.set(node, x, name[x]);
  9752. }
  9753. return node; // DomNode
  9754. }
  9755. var lc = name.toLowerCase(), propName = exports.names[lc] || name;
  9756. if(propName == "style" && typeof value != "string"){ // inline'd type check
  9757. // special case: setting a style
  9758. style.style(node, value);
  9759. return node; // DomNode
  9760. }
  9761. if(propName == "innerHTML"){
  9762. // special case: assigning HTML
  9763. if(has("ie") && node.tagName.toLowerCase() in _roInnerHtml){
  9764. ctr.empty(node);
  9765. node.appendChild(ctr.toDom(value, node.ownerDocument));
  9766. }else{
  9767. node[propName] = value;
  9768. }
  9769. return node; // DomNode
  9770. }
  9771. if(lang.isFunction(value)){
  9772. // special case: assigning an event handler
  9773. // clobber if we can
  9774. var attrId = node[_attrId];
  9775. if(!attrId){
  9776. attrId = _ctr++;
  9777. node[_attrId] = attrId;
  9778. }
  9779. if(!_evtHdlrMap[attrId]){
  9780. _evtHdlrMap[attrId] = {};
  9781. }
  9782. var h = _evtHdlrMap[attrId][propName];
  9783. if(h){
  9784. //h.remove();
  9785. conn.disconnect(h);
  9786. }else{
  9787. try{
  9788. delete node[propName];
  9789. }catch(e){}
  9790. }
  9791. // ensure that event objects are normalized, etc.
  9792. if(value){
  9793. //_evtHdlrMap[attrId][propName] = on(node, propName, value);
  9794. _evtHdlrMap[attrId][propName] = conn.connect(node, propName, value);
  9795. }else{
  9796. node[propName] = null;
  9797. }
  9798. return node; // DomNode
  9799. }
  9800. node[propName] = value;
  9801. return node; // DomNode
  9802. };
  9803. });
  9804. },
  9805. 'dojo/dom-attr':function(){
  9806. define(["exports", "./_base/sniff", "./_base/lang", "./dom", "./dom-style", "./dom-prop"],
  9807. function(exports, has, lang, dom, style, prop){
  9808. // module:
  9809. // dojo/dom-attr
  9810. // summary:
  9811. // This module defines the core dojo DOM attributes API.
  9812. // =============================
  9813. // Element attribute Functions
  9814. // =============================
  9815. // This module will be obsolete soon. Use dojo.prop instead.
  9816. // dojo.attr() should conform to http://www.w3.org/TR/DOM-Level-2-Core/
  9817. // attribute-related functions (to be obsolete soon)
  9818. /*=====
  9819. dojo.hasAttr = function(node, name){
  9820. // summary:
  9821. // Returns true if the requested attribute is specified on the
  9822. // given element, and false otherwise.
  9823. // node: DOMNode|String
  9824. // id or reference to the element to check
  9825. // name: String
  9826. // the name of the attribute
  9827. // returns: Boolean
  9828. // true if the requested attribute is specified on the
  9829. // given element, and false otherwise
  9830. };
  9831. =====*/
  9832. /*=====
  9833. dojo.getAttr = function(node, name){
  9834. // summary:
  9835. // Gets an attribute on an HTML element.
  9836. // description:
  9837. // Handles normalized getting of attributes on DOM Nodes.
  9838. // node: DOMNode|String
  9839. // id or reference to the element to get the attribute on
  9840. // name: String
  9841. // the name of the attribute to get.
  9842. // returns:
  9843. // the value of the requested attribute or null if that attribute does not have a specified or
  9844. // default value;
  9845. //
  9846. // example:
  9847. // | // get the current value of the "foo" attribute on a node
  9848. // | dojo.getAttr(dojo.byId("nodeId"), "foo");
  9849. // | // or we can just pass the id:
  9850. // | dojo.getAttr("nodeId", "foo");
  9851. };
  9852. =====*/
  9853. /*=====
  9854. dojo.setAttr = function(node, name, value){
  9855. // summary:
  9856. // Sets an attribute on an HTML element.
  9857. // description:
  9858. // Handles normalized setting of attributes on DOM Nodes.
  9859. //
  9860. // When passing functions as values, note that they will not be
  9861. // directly assigned to slots on the node, but rather the default
  9862. // behavior will be removed and the new behavior will be added
  9863. // using `dojo.connect()`, meaning that event handler properties
  9864. // will be normalized and that some caveats with regards to
  9865. // non-standard behaviors for onsubmit apply. Namely that you
  9866. // should cancel form submission using `dojo.stopEvent()` on the
  9867. // passed event object instead of returning a boolean value from
  9868. // the handler itself.
  9869. // node: DOMNode|String
  9870. // id or reference to the element to set the attribute on
  9871. // name: String|Object
  9872. // the name of the attribute to set, or a hash of key-value pairs to set.
  9873. // value: String?
  9874. // the value to set for the attribute, if the name is a string.
  9875. // returns:
  9876. // the DOM node
  9877. //
  9878. // example:
  9879. // | // use attr() to set the tab index
  9880. // | dojo.setAttr("nodeId", "tabIndex", 3);
  9881. //
  9882. // example:
  9883. // Set multiple values at once, including event handlers:
  9884. // | dojo.setAttr("formId", {
  9885. // | "foo": "bar",
  9886. // | "tabIndex": -1,
  9887. // | "method": "POST",
  9888. // | "onsubmit": function(e){
  9889. // | // stop submitting the form. Note that the IE behavior
  9890. // | // of returning true or false will have no effect here
  9891. // | // since our handler is connect()ed to the built-in
  9892. // | // onsubmit behavior and so we need to use
  9893. // | // dojo.stopEvent() to ensure that the submission
  9894. // | // doesn't proceed.
  9895. // | dojo.stopEvent(e);
  9896. // |
  9897. // | // submit the form with Ajax
  9898. // | dojo.xhrPost({ form: "formId" });
  9899. // | }
  9900. // | });
  9901. //
  9902. // example:
  9903. // Style is s special case: Only set with an object hash of styles
  9904. // | dojo.setAttr("someNode",{
  9905. // | id:"bar",
  9906. // | style:{
  9907. // | width:"200px", height:"100px", color:"#000"
  9908. // | }
  9909. // | });
  9910. //
  9911. // example:
  9912. // Again, only set style as an object hash of styles:
  9913. // | var obj = { color:"#fff", backgroundColor:"#000" };
  9914. // | dojo.setAttr("someNode", "style", obj);
  9915. // |
  9916. // | // though shorter to use `dojo.style()` in this case:
  9917. // | dojo.setStyle("someNode", obj);
  9918. };
  9919. =====*/
  9920. /*=====
  9921. dojo.removeAttr = function(node, name){
  9922. // summary:
  9923. // Removes an attribute from an HTML element.
  9924. // node: DOMNode|String
  9925. // id or reference to the element to remove the attribute from
  9926. // name: String
  9927. // the name of the attribute to remove
  9928. };
  9929. =====*/
  9930. /*=====
  9931. dojo.getNodeProp = function(node, name){
  9932. // summary:
  9933. // Returns an effective value of a property or an attribute.
  9934. // node: DOMNode|String
  9935. // id or reference to the element to remove the attribute from
  9936. // name: String
  9937. // the name of the attribute
  9938. // returns:
  9939. // the value of the attribute
  9940. };
  9941. =====*/
  9942. var forcePropNames = {
  9943. innerHTML: 1,
  9944. className: 1,
  9945. htmlFor: has("ie"),
  9946. value: 1
  9947. },
  9948. attrNames = {
  9949. // original attribute names
  9950. classname: "class",
  9951. htmlfor: "for",
  9952. // for IE
  9953. tabindex: "tabIndex",
  9954. readonly: "readOnly"
  9955. };
  9956. function _hasAttr(node, name){
  9957. var attr = node.getAttributeNode && node.getAttributeNode(name);
  9958. return attr && attr.specified; // Boolean
  9959. }
  9960. // There is a difference in the presence of certain properties and their default values
  9961. // between browsers. For example, on IE "disabled" is present on all elements,
  9962. // but it is value is "false"; "tabIndex" of <div> returns 0 by default on IE, yet other browsers
  9963. // can return -1.
  9964. exports.has = function hasAttr(/*DOMNode|String*/node, /*String*/name){
  9965. var lc = name.toLowerCase();
  9966. return forcePropNames[prop.names[lc] || name] || _hasAttr(dom.byId(node), attrNames[lc] || name); // Boolean
  9967. };
  9968. exports.get = function getAttr(/*DOMNode|String*/node, /*String*/name){
  9969. node = dom.byId(node);
  9970. var lc = name.toLowerCase(),
  9971. propName = prop.names[lc] || name,
  9972. forceProp = forcePropNames[propName];
  9973. // should we access this attribute via a property or via getAttribute()?
  9974. value = node[propName];
  9975. if(forceProp && typeof value != "undefined"){
  9976. // node's property
  9977. return value; // Anything
  9978. }
  9979. if(propName != "href" && (typeof value == "boolean" || lang.isFunction(value))){
  9980. // node's property
  9981. return value; // Anything
  9982. }
  9983. // node's attribute
  9984. // we need _hasAttr() here to guard against IE returning a default value
  9985. var attrName = attrNames[lc] || name;
  9986. return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
  9987. };
  9988. exports.set = function setAttr(/*DOMNode|String*/node, /*String|Object*/name, /*String?*/value){
  9989. node = dom.byId(node);
  9990. if(arguments.length == 2){ // inline'd type check
  9991. // the object form of setter: the 2nd argument is a dictionary
  9992. for(var x in name){
  9993. exports.set(node, x, name[x]);
  9994. }
  9995. return node; // DomNode
  9996. }
  9997. var lc = name.toLowerCase(),
  9998. propName = prop.names[lc] || name,
  9999. forceProp = forcePropNames[propName];
  10000. if(propName == "style" && typeof value != "string"){ // inline'd type check
  10001. // special case: setting a style
  10002. style.set(node, value);
  10003. return node; // DomNode
  10004. }
  10005. if(forceProp || typeof value == "boolean" || lang.isFunction(value)){
  10006. return prop.set(node, name, value)
  10007. }
  10008. // node's attribute
  10009. node.setAttribute(attrNames[lc] || name, value);
  10010. return node; // DomNode
  10011. };
  10012. exports.remove = function removeAttr(/*DOMNode|String*/ node, /*String*/ name){
  10013. dom.byId(node).removeAttribute(attrNames[name.toLowerCase()] || name);
  10014. };
  10015. exports.getNodeProp = function getNodeProp(/*DomNode|String*/ node, /*String*/ name){
  10016. node = dom.byId(node);
  10017. var lc = name.toLowerCase(), propName = prop.names[lc] || name;
  10018. if((propName in node) && propName != "href"){
  10019. // node's property
  10020. return node[propName]; // Anything
  10021. }
  10022. // node's attribute
  10023. var attrName = attrNames[lc] || name;
  10024. return _hasAttr(node, attrName) ? node.getAttribute(attrName) : null; // Anything
  10025. };
  10026. });
  10027. },
  10028. 'dojo/dom-construct':function(){
  10029. define(["exports", "./_base/kernel", "./_base/sniff", "./_base/window", "./dom", "./dom-attr", "./on"],
  10030. function(exports, dojo, has, win, dom, attr, on){
  10031. // module:
  10032. // dojo/dom-construct
  10033. // summary:
  10034. // This module defines the core dojo DOM construction API.
  10035. /*=====
  10036. dojo.toDom = function(frag, doc){
  10037. // summary:
  10038. // instantiates an HTML fragment returning the corresponding DOM.
  10039. // frag: String
  10040. // the HTML fragment
  10041. // doc: DocumentNode?
  10042. // optional document to use when creating DOM nodes, defaults to
  10043. // dojo.doc if not specified.
  10044. // returns: DocumentFragment
  10045. //
  10046. // example:
  10047. // Create a table row:
  10048. // | var tr = dojo.toDom("<tr><td>First!</td></tr>");
  10049. };
  10050. =====*/
  10051. /*=====
  10052. dojo._toDom = function(frag, doc){
  10053. // summary:
  10054. // Existing alias for `dojo.toDom`. Deprecated, will be removed in 2.0.
  10055. };
  10056. =====*/
  10057. /*=====
  10058. dojo.place = function(node, refNode, position){
  10059. // summary:
  10060. // Attempt to insert node into the DOM, choosing from various positioning options.
  10061. // Returns the first argument resolved to a DOM node.
  10062. //
  10063. // node: DOMNode|String
  10064. // id or node reference, or HTML fragment starting with "<" to place relative to refNode
  10065. //
  10066. // refNode: DOMNode|String
  10067. // id or node reference to use as basis for placement
  10068. //
  10069. // position: String|Number?
  10070. // string noting the position of node relative to refNode or a
  10071. // number indicating the location in the childNodes collection of refNode.
  10072. // Accepted string values are:
  10073. // | * before
  10074. // | * after
  10075. // | * replace
  10076. // | * only
  10077. // | * first
  10078. // | * last
  10079. // "first" and "last" indicate positions as children of refNode, "replace" replaces refNode,
  10080. // "only" replaces all children. position defaults to "last" if not specified
  10081. //
  10082. // returns: DOMNode
  10083. // Returned values is the first argument resolved to a DOM node.
  10084. //
  10085. // .place() is also a method of `dojo.NodeList`, allowing `dojo.query` node lookups.
  10086. //
  10087. // example:
  10088. // Place a node by string id as the last child of another node by string id:
  10089. // | dojo.place("someNode", "anotherNode");
  10090. //
  10091. // example:
  10092. // Place a node by string id before another node by string id
  10093. // | dojo.place("someNode", "anotherNode", "before");
  10094. //
  10095. // example:
  10096. // Create a Node, and place it in the body element (last child):
  10097. // | dojo.place("<div></div>", dojo.body());
  10098. //
  10099. // example:
  10100. // Put a new LI as the first child of a list by id:
  10101. // | dojo.place("<li></li>", "someUl", "first");
  10102. };
  10103. =====*/
  10104. /*=====
  10105. dojo.create = function(tag, attrs, refNode, pos){
  10106. // summary:
  10107. // Create an element, allowing for optional attribute decoration
  10108. // and placement.
  10109. //
  10110. // description:
  10111. // A DOM Element creation function. A shorthand method for creating a node or
  10112. // a fragment, and allowing for a convenient optional attribute setting step,
  10113. // as well as an optional DOM placement reference.
  10114. //|
  10115. // Attributes are set by passing the optional object through `dojo.setAttr`.
  10116. // See `dojo.setAttr` for noted caveats and nuances, and API if applicable.
  10117. //|
  10118. // Placement is done via `dojo.place`, assuming the new node to be the action
  10119. // node, passing along the optional reference node and position.
  10120. //
  10121. // tag: DOMNode|String
  10122. // A string of the element to create (eg: "div", "a", "p", "li", "script", "br"),
  10123. // or an existing DOM node to process.
  10124. //
  10125. // attrs: Object
  10126. // An object-hash of attributes to set on the newly created node.
  10127. // Can be null, if you don't want to set any attributes/styles.
  10128. // See: `dojo.setAttr` for a description of available attributes.
  10129. //
  10130. // refNode: DOMNode?|String?
  10131. // Optional reference node. Used by `dojo.place` to place the newly created
  10132. // node somewhere in the dom relative to refNode. Can be a DomNode reference
  10133. // or String ID of a node.
  10134. //
  10135. // pos: String?
  10136. // Optional positional reference. Defaults to "last" by way of `dojo.place`,
  10137. // though can be set to "first","after","before","last", "replace" or "only"
  10138. // to further control the placement of the new node relative to the refNode.
  10139. // 'refNode' is required if a 'pos' is specified.
  10140. //
  10141. // returns: DOMNode
  10142. //
  10143. // example:
  10144. // Create a DIV:
  10145. // | var n = dojo.create("div");
  10146. //
  10147. // example:
  10148. // Create a DIV with content:
  10149. // | var n = dojo.create("div", { innerHTML:"<p>hi</p>" });
  10150. //
  10151. // example:
  10152. // Place a new DIV in the BODY, with no attributes set
  10153. // | var n = dojo.create("div", null, dojo.body());
  10154. //
  10155. // example:
  10156. // Create an UL, and populate it with LI's. Place the list as the first-child of a
  10157. // node with id="someId":
  10158. // | var ul = dojo.create("ul", null, "someId", "first");
  10159. // | var items = ["one", "two", "three", "four"];
  10160. // | dojo.forEach(items, function(data){
  10161. // | dojo.create("li", { innerHTML: data }, ul);
  10162. // | });
  10163. //
  10164. // example:
  10165. // Create an anchor, with an href. Place in BODY:
  10166. // | dojo.create("a", { href:"foo.html", title:"Goto FOO!" }, dojo.body());
  10167. //
  10168. // example:
  10169. // Create a `dojo.NodeList()` from a new element (for syntatic sugar):
  10170. // | dojo.query(dojo.create('div'))
  10171. // | .addClass("newDiv")
  10172. // | .onclick(function(e){ console.log('clicked', e.target) })
  10173. // | .place("#someNode"); // redundant, but cleaner.
  10174. };
  10175. =====*/
  10176. /*=====
  10177. dojo.empty = function(node){
  10178. // summary:
  10179. // safely removes all children of the node.
  10180. // node: DOMNode|String
  10181. // a reference to a DOM node or an id.
  10182. // example:
  10183. // Destroy node's children byId:
  10184. // | dojo.empty("someId");
  10185. //
  10186. // example:
  10187. // Destroy all nodes' children in a list by reference:
  10188. // | dojo.query(".someNode").forEach(dojo.empty);
  10189. }
  10190. =====*/
  10191. /*=====
  10192. dojo.destroy = function(node){
  10193. // summary:
  10194. // Removes a node from its parent, clobbering it and all of its
  10195. // children.
  10196. //
  10197. // description:
  10198. // Removes a node from its parent, clobbering it and all of its
  10199. // children. Function only works with DomNodes, and returns nothing.
  10200. //
  10201. // node: DOMNode|String
  10202. // A String ID or DomNode reference of the element to be destroyed
  10203. //
  10204. // example:
  10205. // Destroy a node byId:
  10206. // | dojo.destroy("someId");
  10207. //
  10208. // example:
  10209. // Destroy all nodes in a list by reference:
  10210. // | dojo.query(".someNode").forEach(dojo.destroy);
  10211. };
  10212. =====*/
  10213. /*=====
  10214. dojo._destroyElement = function(node){
  10215. // summary:
  10216. // Existing alias for `dojo.destroy`. Deprecated, will be removed in 2.0.
  10217. };
  10218. =====*/
  10219. // support stuff for dojo.toDom
  10220. var tagWrap = {
  10221. option: ["select"],
  10222. tbody: ["table"],
  10223. thead: ["table"],
  10224. tfoot: ["table"],
  10225. tr: ["table", "tbody"],
  10226. td: ["table", "tbody", "tr"],
  10227. th: ["table", "thead", "tr"],
  10228. legend: ["fieldset"],
  10229. caption: ["table"],
  10230. colgroup: ["table"],
  10231. col: ["table", "colgroup"],
  10232. li: ["ul"]
  10233. },
  10234. reTag = /<\s*([\w\:]+)/,
  10235. masterNode = {}, masterNum = 0,
  10236. masterName = "__" + dojo._scopeName + "ToDomId";
  10237. // generate start/end tag strings to use
  10238. // for the injection for each special tag wrap case.
  10239. for(var param in tagWrap){
  10240. if(tagWrap.hasOwnProperty(param)){
  10241. var tw = tagWrap[param];
  10242. tw.pre = param == "option" ? '<select multiple="multiple">' : "<" + tw.join("><") + ">";
  10243. tw.post = "</" + tw.reverse().join("></") + ">";
  10244. // the last line is destructive: it reverses the array,
  10245. // but we don't care at this point
  10246. }
  10247. }
  10248. function _insertBefore(/*DomNode*/node, /*DomNode*/ref){
  10249. var parent = ref.parentNode;
  10250. if(parent){
  10251. parent.insertBefore(node, ref);
  10252. }
  10253. }
  10254. function _insertAfter(/*DomNode*/node, /*DomNode*/ref){
  10255. // summary:
  10256. // Try to insert node after ref
  10257. var parent = ref.parentNode;
  10258. if(parent){
  10259. if(parent.lastChild == ref){
  10260. parent.appendChild(node);
  10261. }else{
  10262. parent.insertBefore(node, ref.nextSibling);
  10263. }
  10264. }
  10265. }
  10266. exports.toDom = function toDom(frag, doc){
  10267. doc = doc || win.doc;
  10268. var masterId = doc[masterName];
  10269. if(!masterId){
  10270. doc[masterName] = masterId = ++masterNum + "";
  10271. masterNode[masterId] = doc.createElement("div");
  10272. }
  10273. // make sure the frag is a string.
  10274. frag += "";
  10275. // find the starting tag, and get node wrapper
  10276. var match = frag.match(reTag),
  10277. tag = match ? match[1].toLowerCase() : "",
  10278. master = masterNode[masterId],
  10279. wrap, i, fc, df;
  10280. if(match && tagWrap[tag]){
  10281. wrap = tagWrap[tag];
  10282. master.innerHTML = wrap.pre + frag + wrap.post;
  10283. for(i = wrap.length; i; --i){
  10284. master = master.firstChild;
  10285. }
  10286. }else{
  10287. master.innerHTML = frag;
  10288. }
  10289. // one node shortcut => return the node itself
  10290. if(master.childNodes.length == 1){
  10291. return master.removeChild(master.firstChild); // DOMNode
  10292. }
  10293. // return multiple nodes as a document fragment
  10294. df = doc.createDocumentFragment();
  10295. while((fc = master.firstChild)){ // intentional assignment
  10296. df.appendChild(fc);
  10297. }
  10298. return df; // DOMNode
  10299. };
  10300. exports.place = function place(/*DOMNode|String*/node, /*DOMNode|String*/refNode, /*String|Number?*/position){
  10301. refNode = dom.byId(refNode);
  10302. if(typeof node == "string"){ // inline'd type check
  10303. node = /^\s*</.test(node) ? exports.toDom(node, refNode.ownerDocument) : dom.byId(node);
  10304. }
  10305. if(typeof position == "number"){ // inline'd type check
  10306. var cn = refNode.childNodes;
  10307. if(!cn.length || cn.length <= position){
  10308. refNode.appendChild(node);
  10309. }else{
  10310. _insertBefore(node, cn[position < 0 ? 0 : position]);
  10311. }
  10312. }else{
  10313. switch(position){
  10314. case "before":
  10315. _insertBefore(node, refNode);
  10316. break;
  10317. case "after":
  10318. _insertAfter(node, refNode);
  10319. break;
  10320. case "replace":
  10321. refNode.parentNode.replaceChild(node, refNode);
  10322. break;
  10323. case "only":
  10324. exports.empty(refNode);
  10325. refNode.appendChild(node);
  10326. break;
  10327. case "first":
  10328. if(refNode.firstChild){
  10329. _insertBefore(node, refNode.firstChild);
  10330. break;
  10331. }
  10332. // else fallthrough...
  10333. default: // aka: last
  10334. refNode.appendChild(node);
  10335. }
  10336. }
  10337. return node; // DomNode
  10338. };
  10339. exports.create = function create(/*DOMNode|String*/tag, /*Object*/attrs, /*DOMNode?|String?*/refNode, /*String?*/pos){
  10340. var doc = win.doc;
  10341. if(refNode){
  10342. refNode = dom.byId(refNode);
  10343. doc = refNode.ownerDocument;
  10344. }
  10345. if(typeof tag == "string"){ // inline'd type check
  10346. tag = doc.createElement(tag);
  10347. }
  10348. if(attrs){ attr.set(tag, attrs); }
  10349. if(refNode){ exports.place(tag, refNode, pos); }
  10350. return tag; // DomNode
  10351. };
  10352. function _empty(/*DomNode*/ node){
  10353. if(node.canHaveChildren){
  10354. try{
  10355. // fast path
  10356. node.innerHTML = "";
  10357. return;
  10358. }catch(e){
  10359. // innerHTML is readOnly (e.g. TABLE (sub)elements in quirks mode)
  10360. // Fall through (saves bytes)
  10361. }
  10362. }
  10363. // SVG/strict elements don't support innerHTML/canHaveChildren, and OBJECT/APPLET elements in quirks node have canHaveChildren=false
  10364. for(var c; c = node.lastChild;){ // intentional assignment
  10365. _destroy(c, node); // destroy is better than removeChild so TABLE subelements are removed in proper order
  10366. }
  10367. }
  10368. exports.empty = function empty(/*DOMNode|String*/ node){
  10369. _empty(dom.byId(node));
  10370. };
  10371. function _destroy(/*DomNode*/ node, /*DomNode*/ parent){
  10372. if(node.firstChild){
  10373. _empty(node);
  10374. }
  10375. if(parent){
  10376. // removeNode(false) doesn't leak in IE 6+, but removeChild() and removeNode(true) are known to leak under IE 8- while 9+ is TBD
  10377. has("ie") && parent.canHaveChildren && 'removeNode' in node ? node.removeNode(false) :
  10378. parent.removeChild(node);
  10379. }
  10380. }
  10381. exports.destroy = function destroy(/*DOMNode|String*/ node){
  10382. node = dom.byId(node);
  10383. if(!node){ return; }
  10384. _destroy(node, node.parentNode);
  10385. };
  10386. });
  10387. },
  10388. 'dojo/text':function(){
  10389. define(["./_base/kernel", "require", "./has", "./_base/xhr"], function(dojo, require, has, xhr){
  10390. // module:
  10391. // dojo/text
  10392. // summary:
  10393. // This module implements the !dojo/text plugin and the dojo.cache API.
  10394. // description:
  10395. // We choose to include our own plugin to leverage functionality already contained in dojo
  10396. // and thereby reduce the size of the plugin compared to various foreign loader implementations.
  10397. // Also, this allows foreign AMD loaders to be used without their plugins.
  10398. //
  10399. // CAUTION: this module is designed to optionally function synchronously to support the dojo v1.x synchronous
  10400. // loader. This feature is outside the scope of the CommonJS plugins specification.
  10401. var getText;
  10402. if(1){
  10403. getText= function(url, sync, load){
  10404. xhr("GET", {url:url, sync:!!sync, load:load});
  10405. };
  10406. }else{
  10407. // TODOC: only works for dojo AMD loader
  10408. if(require.getText){
  10409. getText= require.getText;
  10410. }else{
  10411. console.error("dojo/text plugin failed to load because loader does not support getText");
  10412. }
  10413. }
  10414. var
  10415. theCache= {},
  10416. strip= function(text){
  10417. //Strips <?xml ...?> declarations so that external SVG and XML
  10418. //documents can be added to a document without worry. Also, if the string
  10419. //is an HTML document, only the part inside the body tag is returned.
  10420. if(text){
  10421. text= text.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, "");
  10422. var matches= text.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
  10423. if(matches){
  10424. text= matches[1];
  10425. }
  10426. }else{
  10427. text = "";
  10428. }
  10429. return text;
  10430. },
  10431. notFound = {},
  10432. pending = {},
  10433. result= {
  10434. dynamic:
  10435. // the dojo/text caches it's own resources because of dojo.cache
  10436. true,
  10437. normalize:function(id, toAbsMid){
  10438. // id is something like (path may be relative):
  10439. //
  10440. // "path/to/text.html"
  10441. // "path/to/text.html!strip"
  10442. var parts= id.split("!"),
  10443. url= parts[0];
  10444. return (/^\./.test(url) ? toAbsMid(url) : url) + (parts[1] ? "!" + parts[1] : "");
  10445. },
  10446. load:function(id, require, load){
  10447. // id is something like (path is always absolute):
  10448. //
  10449. // "path/to/text.html"
  10450. // "path/to/text.html!strip"
  10451. var
  10452. parts= id.split("!"),
  10453. stripFlag= parts.length>1,
  10454. absMid= parts[0],
  10455. url = require.toUrl(parts[0]),
  10456. text = notFound,
  10457. finish = function(text){
  10458. load(stripFlag ? strip(text) : text);
  10459. };
  10460. if(absMid in theCache){
  10461. text = theCache[absMid];
  10462. }else if(url in require.cache){
  10463. text = require.cache[url];
  10464. }else if(url in theCache){
  10465. text = theCache[url];
  10466. }
  10467. if(text===notFound){
  10468. if(pending[url]){
  10469. pending[url].push(finish);
  10470. }else{
  10471. var pendingList = pending[url] = [finish];
  10472. getText(url, !require.async, function(text){
  10473. theCache[absMid]= theCache[url]= text;
  10474. for(var i = 0; i<pendingList.length;){
  10475. pendingList[i++](text);
  10476. }
  10477. delete pending[url];
  10478. });
  10479. }
  10480. }else{
  10481. finish(text);
  10482. }
  10483. }
  10484. };
  10485. dojo.cache= function(/*String||Object*/module, /*String*/url, /*String||Object?*/value){
  10486. // * (string string [value]) => (module, url, value)
  10487. // * (object [value]) => (module, value), url defaults to ""
  10488. //
  10489. // * if module is an object, then it must be convertable to a string
  10490. // * (module, url) module + (url ? ("/" + url) : "") must be a legal argument to require.toUrl
  10491. // * value may be a string or an object; if an object then may have the properties "value" and/or "sanitize"
  10492. var key;
  10493. if(typeof module=="string"){
  10494. if(/\//.test(module)){
  10495. // module is a version 1.7+ resolved path
  10496. key = module;
  10497. value = url;
  10498. }else{
  10499. // module is a version 1.6- argument to dojo.moduleUrl
  10500. key = require.toUrl(module.replace(/\./g, "/") + (url ? ("/" + url) : ""));
  10501. }
  10502. }else{
  10503. key = module + "";
  10504. value = url;
  10505. }
  10506. var
  10507. val = (value != undefined && typeof value != "string") ? value.value : value,
  10508. sanitize = value && value.sanitize;
  10509. if(typeof val == "string"){
  10510. //We have a string, set cache value
  10511. theCache[key] = val;
  10512. return sanitize ? strip(val) : val;
  10513. }else if(val === null){
  10514. //Remove cached value
  10515. delete theCache[key];
  10516. return null;
  10517. }else{
  10518. //Allow cache values to be empty strings. If key property does
  10519. //not exist, fetch it.
  10520. if(!(key in theCache)){
  10521. getText(key, true, function(text){
  10522. theCache[key]= text;
  10523. });
  10524. }
  10525. return sanitize ? strip(theCache[key]) : theCache[key];
  10526. }
  10527. };
  10528. return result;
  10529. /*=====
  10530. dojo.cache = function(module, url, value){
  10531. // summary:
  10532. // A getter and setter for storing the string content associated with the
  10533. // module and url arguments.
  10534. // description:
  10535. // If module is a string that contains slashes, then it is interpretted as a fully
  10536. // resolved path (typically a result returned by require.toUrl), and url should not be
  10537. // provided. This is the preferred signature. If module is a string that does not
  10538. // contain slashes, then url must also be provided and module and url are used to
  10539. // call `dojo.moduleUrl()` to generate a module URL. This signature is deprecated.
  10540. // If value is specified, the cache value for the moduleUrl will be set to
  10541. // that value. Otherwise, dojo.cache will fetch the moduleUrl and store it
  10542. // in its internal cache and return that cached value for the URL. To clear
  10543. // a cache value pass null for value. Since XMLHttpRequest (XHR) is used to fetch the
  10544. // the URL contents, only modules on the same domain of the page can use this capability.
  10545. // The build system can inline the cache values though, to allow for xdomain hosting.
  10546. // module: String||Object
  10547. // If a String with slashes, a fully resolved path; if a String without slashes, the
  10548. // module name to use for the base part of the URL, similar to module argument
  10549. // to `dojo.moduleUrl`. If an Object, something that has a .toString() method that
  10550. // generates a valid path for the cache item. For example, a dojo._Url object.
  10551. // url: String
  10552. // The rest of the path to append to the path derived from the module argument. If
  10553. // module is an object, then this second argument should be the "value" argument instead.
  10554. // value: String||Object?
  10555. // If a String, the value to use in the cache for the module/url combination.
  10556. // If an Object, it can have two properties: value and sanitize. The value property
  10557. // should be the value to use in the cache, and sanitize can be set to true or false,
  10558. // to indicate if XML declarations should be removed from the value and if the HTML
  10559. // inside a body tag in the value should be extracted as the real value. The value argument
  10560. // or the value property on the value argument are usually only used by the build system
  10561. // as it inlines cache content.
  10562. // example:
  10563. // To ask dojo.cache to fetch content and store it in the cache (the dojo["cache"] style
  10564. // of call is used to avoid an issue with the build system erroneously trying to intern
  10565. // this example. To get the build system to intern your dojo.cache calls, use the
  10566. // "dojo.cache" style of call):
  10567. // | //If template.html contains "<h1>Hello</h1>" that will be
  10568. // | //the value for the text variable.
  10569. // | var text = dojo["cache"]("my.module", "template.html");
  10570. // example:
  10571. // To ask dojo.cache to fetch content and store it in the cache, and sanitize the input
  10572. // (the dojo["cache"] style of call is used to avoid an issue with the build system
  10573. // erroneously trying to intern this example. To get the build system to intern your
  10574. // dojo.cache calls, use the "dojo.cache" style of call):
  10575. // | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
  10576. // | //text variable will contain just "<h1>Hello</h1>".
  10577. // | var text = dojo["cache"]("my.module", "template.html", {sanitize: true});
  10578. // example:
  10579. // Same example as previous, but demostrates how an object can be passed in as
  10580. // the first argument, then the value argument can then be the second argument.
  10581. // | //If template.html contains "<html><body><h1>Hello</h1></body></html>", the
  10582. // | //text variable will contain just "<h1>Hello</h1>".
  10583. // | var text = dojo["cache"](new dojo._Url("my/module/template.html"), {sanitize: true});
  10584. return val; //String
  10585. };
  10586. =====*/
  10587. });
  10588. },
  10589. 'dojo/keys':function(){
  10590. define("dojo/keys", ["./_base/kernel", "./_base/sniff"], function(dojo, has) {
  10591. // module:
  10592. // dojo/keys
  10593. // summary:
  10594. // key constants
  10595. // Constants
  10596. // Public: client code should test
  10597. // keyCode against these named constants, as the
  10598. // actual codes can vary by browser.
  10599. return dojo.keys = {
  10600. // summary:
  10601. // Definitions for common key values
  10602. BACKSPACE: 8,
  10603. TAB: 9,
  10604. CLEAR: 12,
  10605. ENTER: 13,
  10606. SHIFT: 16,
  10607. CTRL: 17,
  10608. ALT: 18,
  10609. META: has("safari") ? 91 : 224, // the apple key on macs
  10610. PAUSE: 19,
  10611. CAPS_LOCK: 20,
  10612. ESCAPE: 27,
  10613. SPACE: 32,
  10614. PAGE_UP: 33,
  10615. PAGE_DOWN: 34,
  10616. END: 35,
  10617. HOME: 36,
  10618. LEFT_ARROW: 37,
  10619. UP_ARROW: 38,
  10620. RIGHT_ARROW: 39,
  10621. DOWN_ARROW: 40,
  10622. INSERT: 45,
  10623. DELETE: 46,
  10624. HELP: 47,
  10625. LEFT_WINDOW: 91,
  10626. RIGHT_WINDOW: 92,
  10627. SELECT: 93,
  10628. NUMPAD_0: 96,
  10629. NUMPAD_1: 97,
  10630. NUMPAD_2: 98,
  10631. NUMPAD_3: 99,
  10632. NUMPAD_4: 100,
  10633. NUMPAD_5: 101,
  10634. NUMPAD_6: 102,
  10635. NUMPAD_7: 103,
  10636. NUMPAD_8: 104,
  10637. NUMPAD_9: 105,
  10638. NUMPAD_MULTIPLY: 106,
  10639. NUMPAD_PLUS: 107,
  10640. NUMPAD_ENTER: 108,
  10641. NUMPAD_MINUS: 109,
  10642. NUMPAD_PERIOD: 110,
  10643. NUMPAD_DIVIDE: 111,
  10644. F1: 112,
  10645. F2: 113,
  10646. F3: 114,
  10647. F4: 115,
  10648. F5: 116,
  10649. F6: 117,
  10650. F7: 118,
  10651. F8: 119,
  10652. F9: 120,
  10653. F10: 121,
  10654. F11: 122,
  10655. F12: 123,
  10656. F13: 124,
  10657. F14: 125,
  10658. F15: 126,
  10659. NUM_LOCK: 144,
  10660. SCROLL_LOCK: 145,
  10661. UP_DPAD: 175,
  10662. DOWN_DPAD: 176,
  10663. LEFT_DPAD: 177,
  10664. RIGHT_DPAD: 178,
  10665. // virtual key mapping
  10666. copyKey: has("mac") && !has("air") ? (has("safari") ? 91 : 224 ) : 17
  10667. };
  10668. });
  10669. },
  10670. 'dojo/domReady':function(){
  10671. define(['./has'], function(has){
  10672. var global = (function () { return this; })(),
  10673. doc = document,
  10674. readyStates = { 'loaded': 1, 'complete': 1 },
  10675. fixReadyState = typeof doc.readyState != "string",
  10676. ready = !!readyStates[doc.readyState],
  10677. readyQ = [],
  10678. recursiveGuard;
  10679. function domReady(callback){
  10680. // summary:
  10681. // Plugin to delay require()/define() callback from firing until the DOM has finished loading.
  10682. readyQ.push(callback);
  10683. if(ready){ processQ(); }
  10684. }
  10685. domReady.load = function(id, req, load){
  10686. domReady(load);
  10687. };
  10688. // Export queue so that ready() can check if it's empty or not.
  10689. domReady._Q = readyQ;
  10690. domReady._onQEmpty = function(){
  10691. // summary:
  10692. // Private method overridden by dojo/ready, to notify when everything in the
  10693. // domReady queue has been processed. Do not use directly.
  10694. // Will be removed in 2.0, along with domReady._Q.
  10695. };
  10696. // For FF <= 3.5
  10697. if(fixReadyState){ doc.readyState = "loading"; }
  10698. function processQ(){
  10699. // Calls all functions in the queue in order, unless processQ() is already running, in which case just return
  10700. if(recursiveGuard){ return; }
  10701. recursiveGuard = true;
  10702. while(readyQ.length){
  10703. try{
  10704. (readyQ.shift())(doc);
  10705. }catch(err){
  10706. console.log("Error on domReady callback: " + err);
  10707. }
  10708. }
  10709. recursiveGuard = false;
  10710. // Notification for dojo/ready. Remove for 2.0.
  10711. // Note that this could add more tasks to the ready queue.
  10712. domReady._onQEmpty();
  10713. }
  10714. if(!ready){
  10715. var tests = [],
  10716. detectReady = function(evt){
  10717. evt = evt || global.event;
  10718. if(ready || (evt.type == "readystatechange" && !readyStates[doc.readyState])){ return; }
  10719. // For FF <= 3.5
  10720. if(fixReadyState){ doc.readyState = "complete"; }
  10721. ready = 1;
  10722. processQ();
  10723. },
  10724. on = function(node, event){
  10725. node.addEventListener(event, detectReady, false);
  10726. readyQ.push(function(){ node.removeEventListener(event, detectReady, false); });
  10727. };
  10728. if(!has("dom-addeventlistener")){
  10729. on = function(node, event){
  10730. event = "on" + event;
  10731. node.attachEvent(event, detectReady);
  10732. readyQ.push(function(){ node.detachEvent(event, detectReady); });
  10733. };
  10734. var div = doc.createElement("div");
  10735. try{
  10736. if(div.doScroll && global.frameElement === null){
  10737. // the doScroll test is only useful if we're in the top-most frame
  10738. tests.push(function(){
  10739. // Derived with permission from Diego Perini's IEContentLoaded
  10740. // http://javascript.nwbox.com/IEContentLoaded/
  10741. try{
  10742. div.doScroll("left");
  10743. return 1;
  10744. }catch(e){}
  10745. });
  10746. }
  10747. }catch(e){}
  10748. }
  10749. on(doc, "DOMContentLoaded");
  10750. on(global, "load");
  10751. if("onreadystatechange" in doc){
  10752. on(doc, "readystatechange");
  10753. }else if(!fixReadyState){
  10754. // if the ready state property exists and there's
  10755. // no readystatechange event, poll for the state
  10756. // to change
  10757. tests.push(function(){
  10758. return readyStates[doc.readyState];
  10759. });
  10760. }
  10761. if(tests.length){
  10762. var poller = function(){
  10763. if(ready){ return; }
  10764. var i = tests.length;
  10765. while(i--){
  10766. if(tests[i]()){
  10767. detectReady("poller");
  10768. return;
  10769. }
  10770. }
  10771. setTimeout(poller, 30);
  10772. };
  10773. poller();
  10774. }
  10775. }
  10776. return domReady;
  10777. });
  10778. },
  10779. 'dojo/_base/lang':function(){
  10780. define("dojo/_base/lang", ["./kernel", "../has", "./sniff"], function(dojo, has){
  10781. // module:
  10782. // dojo/_base/lang
  10783. // summary:
  10784. // This module defines Javascript language extensions.
  10785. has.add("bug-for-in-skips-shadowed", function(){
  10786. // if true, the for-in interator skips object properties that exist in Object's prototype (IE 6 - ?)
  10787. for(var i in {toString: 1}){
  10788. return 0;
  10789. }
  10790. return 1;
  10791. });
  10792. var _extraNames =
  10793. has("bug-for-in-skips-shadowed") ?
  10794. "hasOwnProperty.valueOf.isPrototypeOf.propertyIsEnumerable.toLocaleString.toString.constructor".split(".") : [],
  10795. _extraLen = _extraNames.length,
  10796. _mixin = function(dest, source, copyFunc){
  10797. var name, s, i, empty = {};
  10798. for(name in source){
  10799. // the (!(name in empty) || empty[name] !== s) condition avoids copying properties in "source"
  10800. // inherited from Object.prototype. For example, if dest has a custom toString() method,
  10801. // don't overwrite it with the toString() method that source inherited from Object.prototype
  10802. s = source[name];
  10803. if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
  10804. dest[name] = copyFunc ? copyFunc(s) : s;
  10805. }
  10806. }
  10807. if(has("bug-for-in-skips-shadowed")){
  10808. if(source){
  10809. for(i = 0; i < _extraLen; ++i){
  10810. name = _extraNames[i];
  10811. s = source[name];
  10812. if(!(name in dest) || (dest[name] !== s && (!(name in empty) || empty[name] !== s))){
  10813. dest[name] = copyFunc ? copyFunc(s) : s;
  10814. }
  10815. }
  10816. }
  10817. }
  10818. return dest; // Object
  10819. },
  10820. mixin = function(dest, sources){
  10821. if(!dest){ dest = {}; }
  10822. for(var i = 1, l = arguments.length; i < l; i++){
  10823. lang._mixin(dest, arguments[i]);
  10824. }
  10825. return dest; // Object
  10826. },
  10827. getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){
  10828. if(!context){
  10829. if(parts[0] && dojo.scopeMap[parts[0]]) {
  10830. // Voodoo code from the old days where "dojo" or "dijit" maps to some special object
  10831. // rather than just window.dojo
  10832. context = dojo.scopeMap[parts.shift()][1];
  10833. }else{
  10834. context = dojo.global;
  10835. }
  10836. }
  10837. try{
  10838. for(var i = 0; i < parts.length; i++){
  10839. var p = parts[i];
  10840. // Fix for prototype pollution CVE-2021-23450
  10841. if (p === '__proto__' || p === 'constructor') {
  10842. return;
  10843. }
  10844. if(!(p in context)){
  10845. if(create){
  10846. context[p] = {};
  10847. }else{
  10848. return; // return undefined
  10849. }
  10850. }
  10851. context = context[p];
  10852. }
  10853. return context; // mixed
  10854. }catch(e){
  10855. // "p in context" throws an exception when context is a number, boolean, etc. rather than an object,
  10856. // so in that corner case just return undefined (by having no return statement)
  10857. }
  10858. },
  10859. setObject = function(name, value, context){
  10860. var parts = name.split("."), p = parts.pop(), obj = getProp(parts, true, context);
  10861. return obj && p ? (obj[p] = value) : undefined; // Object
  10862. },
  10863. getObject = function(name, create, context){
  10864. return !name ? context : getProp(name.split("."), create, context); // Object
  10865. },
  10866. exists = function(name, obj){
  10867. return lang.getObject(name, false, obj) !== undefined; // Boolean
  10868. },
  10869. opts = Object.prototype.toString,
  10870. // Crockford (ish) functions
  10871. isString = function(it){
  10872. return (typeof it == "string" || it instanceof String); // Boolean
  10873. },
  10874. isArray = function(it){
  10875. return it && (it instanceof Array || typeof it == "array"); // Boolean
  10876. },
  10877. isFunction = function(it){
  10878. return opts.call(it) === "[object Function]";
  10879. },
  10880. isObject = function(it){
  10881. return it !== undefined &&
  10882. (it === null || typeof it == "object" || lang.isArray(it) || lang.isFunction(it)); // Boolean
  10883. },
  10884. isArrayLike = function(it){
  10885. return it && it !== undefined && // Boolean
  10886. // keep out built-in constructors (Number, String, ...) which have length
  10887. // properties
  10888. !lang.isString(it) && !lang.isFunction(it) &&
  10889. !(it.tagName && it.tagName.toLowerCase() == 'form') &&
  10890. (lang.isArray(it) || isFinite(it.length));
  10891. },
  10892. isAlien = function(it){
  10893. return it && !lang.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
  10894. },
  10895. extend = function(constructor, props){
  10896. for(var i=1, l=arguments.length; i<l; i++){
  10897. lang._mixin(constructor.prototype, arguments[i]);
  10898. }
  10899. return constructor; // Object
  10900. },
  10901. _hitchArgs = function(scope, method){
  10902. var pre = _toArray(arguments, 2);
  10903. var named = lang.isString(method);
  10904. return function(){
  10905. // arrayify arguments
  10906. var args = _toArray(arguments);
  10907. // locate our method
  10908. var f = named ? (scope||dojo.global)[method] : method;
  10909. // invoke with collected args
  10910. return f && f.apply(scope || this, pre.concat(args)); // mixed
  10911. }; // Function
  10912. },
  10913. hitch = function(scope, method){
  10914. if(arguments.length > 2){
  10915. return lang._hitchArgs.apply(dojo, arguments); // Function
  10916. }
  10917. if(!method){
  10918. method = scope;
  10919. scope = null;
  10920. }
  10921. if(lang.isString(method)){
  10922. scope = scope || dojo.global;
  10923. if(!scope[method]){ throw(['dojo.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); }
  10924. return function(){ return scope[method].apply(scope, arguments || []); }; // Function
  10925. }
  10926. return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
  10927. },
  10928. delegate = (function(){
  10929. // boodman/crockford delegation w/ cornford optimization
  10930. function TMP(){}
  10931. return function(obj, props){
  10932. TMP.prototype = obj;
  10933. var tmp = new TMP();
  10934. TMP.prototype = null;
  10935. if(props){
  10936. lang._mixin(tmp, props);
  10937. }
  10938. return tmp; // Object
  10939. };
  10940. })(),
  10941. efficient = function(obj, offset, startWith){
  10942. return (startWith||[]).concat(Array.prototype.slice.call(obj, offset||0));
  10943. },
  10944. _toArray =
  10945. has("ie") ?
  10946. (function(){
  10947. function slow(obj, offset, startWith){
  10948. var arr = startWith||[];
  10949. for(var x = offset || 0; x < obj.length; x++){
  10950. arr.push(obj[x]);
  10951. }
  10952. return arr;
  10953. }
  10954. return function(obj){
  10955. return ((obj.item) ? slow : efficient).apply(this, arguments);
  10956. };
  10957. })() : efficient,
  10958. partial = function(/*Function|String*/method /*, ...*/){
  10959. var arr = [ null ];
  10960. return lang.hitch.apply(dojo, arr.concat(lang._toArray(arguments))); // Function
  10961. },
  10962. clone = function(/*anything*/ src){
  10963. if(!src || typeof src != "object" || lang.isFunction(src)){
  10964. // null, undefined, any non-object, or function
  10965. return src; // anything
  10966. }
  10967. if(src.nodeType && "cloneNode" in src){
  10968. // DOM Node
  10969. return src.cloneNode(true); // Node
  10970. }
  10971. if(src instanceof Date){
  10972. // Date
  10973. return new Date(src.getTime()); // Date
  10974. }
  10975. if(src instanceof RegExp){
  10976. // RegExp
  10977. return new RegExp(src); // RegExp
  10978. }
  10979. var r, i, l;
  10980. if(lang.isArray(src)){
  10981. // array
  10982. r = [];
  10983. for(i = 0, l = src.length; i < l; ++i){
  10984. if(i in src){
  10985. r.push(clone(src[i]));
  10986. }
  10987. }
  10988. // we don't clone functions for performance reasons
  10989. // }else if(d.isFunction(src)){
  10990. // // function
  10991. // r = function(){ return src.apply(this, arguments); };
  10992. }else{
  10993. // generic objects
  10994. r = src.constructor ? new src.constructor() : {};
  10995. }
  10996. return lang._mixin(r, src, clone);
  10997. },
  10998. trim = String.prototype.trim ?
  10999. function(str){ return str.trim(); } :
  11000. function(str){ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); },
  11001. _pattern = /\{([^\}]+)\}/g,
  11002. replace = function(tmpl, map, pattern){
  11003. return tmpl.replace(pattern || _pattern, lang.isFunction(map) ?
  11004. map : function(_, k){ return getObject(k, false, map); });
  11005. },
  11006. lang = {
  11007. _extraNames:_extraNames,
  11008. _mixin:_mixin,
  11009. mixin:mixin,
  11010. setObject:setObject,
  11011. getObject:getObject,
  11012. exists:exists,
  11013. isString:isString,
  11014. isArray:isArray,
  11015. isFunction:isFunction,
  11016. isObject:isObject,
  11017. isArrayLike:isArrayLike,
  11018. isAlien:isAlien,
  11019. extend:extend,
  11020. _hitchArgs:_hitchArgs,
  11021. hitch:hitch,
  11022. delegate:delegate,
  11023. _toArray:_toArray,
  11024. partial:partial,
  11025. clone:clone,
  11026. trim:trim,
  11027. replace:replace
  11028. };
  11029. 1 && mixin(dojo, lang);
  11030. return lang;
  11031. /*=====
  11032. dojo._extraNames
  11033. // summary:
  11034. // Array of strings. Lists property names that must be explicitly processed during for-in interation
  11035. // in environments that have has("bug-for-in-skips-shadowed") true.
  11036. =====*/
  11037. /*=====
  11038. dojo._mixin = function(dest, source, copyFunc){
  11039. // summary:
  11040. // Copies/adds all properties of source to dest; returns dest.
  11041. // dest: Object:
  11042. // The object to which to copy/add all properties contained in source.
  11043. // source: Object:
  11044. // The object from which to draw all properties to copy into dest.
  11045. // copyFunc: Function?:
  11046. // The process used to copy/add a property in source; defaults to the Javascript assignment operator.
  11047. // returns:
  11048. // dest, as modified
  11049. // description:
  11050. // All properties, including functions (sometimes termed "methods"), excluding any non-standard extensions
  11051. // found in Object.prototype, are copied/added to dest. Copying/adding each particular property is
  11052. // delegated to copyFunc (if any); copyFunc defaults to the Javascript assignment operator if not provided.
  11053. // Notice that by default, _mixin executes a so-called "shallow copy" and aggregate types are copied/added by reference.
  11054. }
  11055. =====*/
  11056. /*=====
  11057. dojo.mixin = function(dest, sources){
  11058. // summary:
  11059. // Copies/adds all properties of one or more sources to dest; returns dest.
  11060. // dest: Object
  11061. // The object to which to copy/add all properties contained in source. If dest is falsy, then
  11062. // a new object is manufactured before copying/adding properties begins.
  11063. // sources: Object...
  11064. // One of more objects from which to draw all properties to copy into dest. sources are processed
  11065. // left-to-right and if more than one of these objects contain the same property name, the right-most
  11066. // value "wins".
  11067. // returns: Object
  11068. // dest, as modified
  11069. // description:
  11070. // All properties, including functions (sometimes termed "methods"), excluding any non-standard extensions
  11071. // found in Object.prototype, are copied/added from sources to dest. sources are processed left to right.
  11072. // The Javascript assignment operator is used to copy/add each property; therefore, by default, mixin
  11073. // executes a so-called "shallow copy" and aggregate types are copied/added by reference.
  11074. // example:
  11075. // make a shallow copy of an object
  11076. // | var copy = lang.mixin({}, source);
  11077. // example:
  11078. // many class constructors often take an object which specifies
  11079. // values to be configured on the object. In this case, it is
  11080. // often simplest to call `lang.mixin` on the `this` object:
  11081. // | dojo.declare("acme.Base", null, {
  11082. // | constructor: function(properties){
  11083. // | // property configuration:
  11084. // | lang.mixin(this, properties);
  11085. // |
  11086. // | console.log(this.quip);
  11087. // | // ...
  11088. // | },
  11089. // | quip: "I wasn't born yesterday, you know - I've seen movies.",
  11090. // | // ...
  11091. // | });
  11092. // |
  11093. // | // create an instance of the class and configure it
  11094. // | var b = new acme.Base({quip: "That's what it does!" });
  11095. // example:
  11096. // copy in properties from multiple objects
  11097. // | var flattened = lang.mixin(
  11098. // | {
  11099. // | name: "Frylock",
  11100. // | braces: true
  11101. // | },
  11102. // | {
  11103. // | name: "Carl Brutanananadilewski"
  11104. // | }
  11105. // | );
  11106. // |
  11107. // | // will print "Carl Brutanananadilewski"
  11108. // | console.log(flattened.name);
  11109. // | // will print "true"
  11110. // | console.log(flattened.braces);
  11111. }
  11112. =====*/
  11113. /*=====
  11114. dojo.setObject = function(name, value, context){
  11115. // summary:
  11116. // Set a property from a dot-separated string, such as "A.B.C"
  11117. // description:
  11118. // Useful for longer api chains where you have to test each object in
  11119. // the chain, or when you have an object reference in string format.
  11120. // Objects are created as needed along `path`. Returns the passed
  11121. // value if setting is successful or `undefined` if not.
  11122. // name: String
  11123. // Path to a property, in the form "A.B.C".
  11124. // value: anything
  11125. // value or object to place at location given by name
  11126. // context: Object?
  11127. // Optional. Object to use as root of path. Defaults to
  11128. // `dojo.global`.
  11129. // example:
  11130. // set the value of `foo.bar.baz`, regardless of whether
  11131. // intermediate objects already exist:
  11132. // | lang.setObject("foo.bar.baz", value);
  11133. // example:
  11134. // without `lang.setObject`, we often see code like this:
  11135. // | // ensure that intermediate objects are available
  11136. // | if(!obj["parent"]){ obj.parent = {}; }
  11137. // | if(!obj.parent["child"]){ obj.parent.child = {}; }
  11138. // | // now we can safely set the property
  11139. // | obj.parent.child.prop = "some value";
  11140. // whereas with `lang.setObject`, we can shorten that to:
  11141. // | lang.setObject("parent.child.prop", "some value", obj);
  11142. }
  11143. =====*/
  11144. /*=====
  11145. dojo.getObject = function(name, create, context){
  11146. // summary:
  11147. // Get a property from a dot-separated string, such as "A.B.C"
  11148. // description:
  11149. // Useful for longer api chains where you have to test each object in
  11150. // the chain, or when you have an object reference in string format.
  11151. // name: String
  11152. // Path to an property, in the form "A.B.C".
  11153. // create: Boolean?
  11154. // Optional. Defaults to `false`. If `true`, Objects will be
  11155. // created at any point along the 'path' that is undefined.
  11156. // context: Object?
  11157. // Optional. Object to use as root of path. Defaults to
  11158. // 'dojo.global'. Null may be passed.
  11159. }
  11160. =====*/
  11161. /*=====
  11162. dojo.exists = function(name, obj){
  11163. // summary:
  11164. // determine if an object supports a given method
  11165. // description:
  11166. // useful for longer api chains where you have to test each object in
  11167. // the chain. Useful for object and method detection.
  11168. // name: String
  11169. // Path to an object, in the form "A.B.C".
  11170. // obj: Object?
  11171. // Object to use as root of path. Defaults to
  11172. // 'dojo.global'. Null may be passed.
  11173. // example:
  11174. // | // define an object
  11175. // | var foo = {
  11176. // | bar: { }
  11177. // | };
  11178. // |
  11179. // | // search the global scope
  11180. // | lang.exists("foo.bar"); // true
  11181. // | lang.exists("foo.bar.baz"); // false
  11182. // |
  11183. // | // search from a particular scope
  11184. // | lang.exists("bar", foo); // true
  11185. // | lang.exists("bar.baz", foo); // false
  11186. }
  11187. =====*/
  11188. /*=====
  11189. dojo.isString = function(it){
  11190. // summary:
  11191. // Return true if it is a String
  11192. // it: anything
  11193. // Item to test.
  11194. }
  11195. =====*/
  11196. /*=====
  11197. dojo.isArray = function(it){
  11198. // summary:
  11199. // Return true if it is an Array.
  11200. // Does not work on Arrays created in other windows.
  11201. // it: anything
  11202. // Item to test.
  11203. }
  11204. =====*/
  11205. /*=====
  11206. dojo.isFunction = function(it){
  11207. // summary:
  11208. // Return true if it is a Function
  11209. // it: anything
  11210. // Item to test.
  11211. }
  11212. =====*/
  11213. /*=====
  11214. dojo.isObject = function(it){
  11215. // summary:
  11216. // Returns true if it is a JavaScript object (or an Array, a Function
  11217. // or null)
  11218. // it: anything
  11219. // Item to test.
  11220. }
  11221. =====*/
  11222. /*=====
  11223. dojo.isArrayLike = function(it){
  11224. // summary:
  11225. // similar to dojo.isArray() but more permissive
  11226. // it: anything
  11227. // Item to test.
  11228. // returns:
  11229. // If it walks like a duck and quacks like a duck, return `true`
  11230. // description:
  11231. // Doesn't strongly test for "arrayness". Instead, settles for "isn't
  11232. // a string or number and has a length property". Arguments objects
  11233. // and DOM collections will return true when passed to
  11234. // dojo.isArrayLike(), but will return false when passed to
  11235. // dojo.isArray().
  11236. }
  11237. =====*/
  11238. /*=====
  11239. dojo.isAlien = function(it){
  11240. // summary:
  11241. // Returns true if it is a built-in function or some other kind of
  11242. // oddball that *should* report as a function but doesn't
  11243. }
  11244. =====*/
  11245. /*=====
  11246. dojo.extend = function(constructor, props){
  11247. // summary:
  11248. // Adds all properties and methods of props to constructor's
  11249. // prototype, making them available to all instances created with
  11250. // constructor.
  11251. // constructor: Object
  11252. // Target constructor to extend.
  11253. // props: Object...
  11254. // One or more objects to mix into constructor.prototype
  11255. }
  11256. =====*/
  11257. /*=====
  11258. dojo.hitch = function(scope, method){
  11259. // summary:
  11260. // Returns a function that will only ever execute in the a given scope.
  11261. // This allows for easy use of object member functions
  11262. // in callbacks and other places in which the "this" keyword may
  11263. // otherwise not reference the expected scope.
  11264. // Any number of default positional arguments may be passed as parameters
  11265. // beyond "method".
  11266. // Each of these values will be used to "placehold" (similar to curry)
  11267. // for the hitched function.
  11268. // scope: Object
  11269. // The scope to use when method executes. If method is a string,
  11270. // scope is also the object containing method.
  11271. // method: Function|String...
  11272. // A function to be hitched to scope, or the name of the method in
  11273. // scope to be hitched.
  11274. // example:
  11275. // | dojo.hitch(foo, "bar")();
  11276. // runs foo.bar() in the scope of foo
  11277. // example:
  11278. // | dojo.hitch(foo, myFunction);
  11279. // returns a function that runs myFunction in the scope of foo
  11280. // example:
  11281. // Expansion on the default positional arguments passed along from
  11282. // hitch. Passed args are mixed first, additional args after.
  11283. // | var foo = { bar: function(a, b, c){ console.log(a, b, c); } };
  11284. // | var fn = dojo.hitch(foo, "bar", 1, 2);
  11285. // | fn(3); // logs "1, 2, 3"
  11286. // example:
  11287. // | var foo = { bar: 2 };
  11288. // | dojo.hitch(foo, function(){ this.bar = 10; })();
  11289. // execute an anonymous function in scope of foo
  11290. }
  11291. =====*/
  11292. /*=====
  11293. dojo.delegate = function(obj, props){
  11294. // summary:
  11295. // Returns a new object which "looks" to obj for properties which it
  11296. // does not have a value for. Optionally takes a bag of properties to
  11297. // seed the returned object with initially.
  11298. // description:
  11299. // This is a small implementaton of the Boodman/Crockford delegation
  11300. // pattern in JavaScript. An intermediate object constructor mediates
  11301. // the prototype chain for the returned object, using it to delegate
  11302. // down to obj for property lookup when object-local lookup fails.
  11303. // This can be thought of similarly to ES4's "wrap", save that it does
  11304. // not act on types but rather on pure objects.
  11305. // obj: Object
  11306. // The object to delegate to for properties not found directly on the
  11307. // return object or in props.
  11308. // props: Object...
  11309. // an object containing properties to assign to the returned object
  11310. // returns:
  11311. // an Object of anonymous type
  11312. // example:
  11313. // | var foo = { bar: "baz" };
  11314. // | var thinger = dojo.delegate(foo, { thud: "xyzzy"});
  11315. // | thinger.bar == "baz"; // delegated to foo
  11316. // | foo.thud == undefined; // by definition
  11317. // | thinger.thud == "xyzzy"; // mixed in from props
  11318. // | foo.bar = "thonk";
  11319. // | thinger.bar == "thonk"; // still delegated to foo's bar
  11320. }
  11321. =====*/
  11322. /*=====
  11323. dojo.partial = function(method){
  11324. // summary:
  11325. // similar to hitch() except that the scope object is left to be
  11326. // whatever the execution context eventually becomes.
  11327. // method: Function|String
  11328. // description:
  11329. // Calling dojo.partial is the functional equivalent of calling:
  11330. // | dojo.hitch(null, funcName, ...);
  11331. }
  11332. =====*/
  11333. /*=====
  11334. dojo.trim = function(str){
  11335. // summary:
  11336. // Trims whitespace from both sides of the string
  11337. // str: String
  11338. // String to be trimmed
  11339. // returns: String
  11340. // Returns the trimmed string
  11341. // description:
  11342. // This version of trim() was selected for inclusion into the base due
  11343. // to its compact size and relatively good performance
  11344. // (see [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript)
  11345. // Uses String.prototype.trim instead, if available.
  11346. // The fastest but longest version of this function is located at
  11347. // dojo.string.trim()
  11348. }
  11349. =====*/
  11350. /*=====
  11351. dojo.clone = function(src){
  11352. // summary:
  11353. // Clones objects (including DOM nodes) and all children.
  11354. // Warning: do not clone cyclic structures.
  11355. // src:
  11356. // The object to clone
  11357. }
  11358. =====*/
  11359. /*=====
  11360. dojo._toArray = function(obj, offset, startWith){
  11361. // summary:
  11362. // Converts an array-like object (i.e. arguments, DOMCollection) to an
  11363. // array. Returns a new Array with the elements of obj.
  11364. // obj: Object
  11365. // the object to "arrayify". We expect the object to have, at a
  11366. // minimum, a length property which corresponds to integer-indexed
  11367. // properties.
  11368. // offset: Number?
  11369. // the location in obj to start iterating from. Defaults to 0.
  11370. // Optional.
  11371. // startWith: Array?
  11372. // An array to pack with the properties of obj. If provided,
  11373. // properties in obj are appended at the end of startWith and
  11374. // startWith is the returned array.
  11375. }
  11376. =====*/
  11377. /*=====
  11378. dojo.replace = function(tmpl, map, pattern){
  11379. // summary:
  11380. // Performs parameterized substitutions on a string. Throws an
  11381. // exception if any parameter is unmatched.
  11382. // tmpl: String
  11383. // String to be used as a template.
  11384. // map: Object|Function
  11385. // If an object, it is used as a dictionary to look up substitutions.
  11386. // If a function, it is called for every substitution with following
  11387. // parameters: a whole match, a name, an offset, and the whole template
  11388. // string (see https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/replace
  11389. // for more details).
  11390. // pattern: RegEx?
  11391. // Optional regular expression objects that overrides the default pattern.
  11392. // Must be global and match one item. The default is: /\{([^\}]+)\}/g,
  11393. // which matches patterns like that: "{xxx}", where "xxx" is any sequence
  11394. // of characters, which doesn't include "}".
  11395. // returns: String
  11396. // Returns the substituted string.
  11397. // example:
  11398. // | // uses a dictionary for substitutions:
  11399. // | dojo.replace("Hello, {name.first} {name.last} AKA {nick}!",
  11400. // | {
  11401. // | nick: "Bob",
  11402. // | name: {
  11403. // | first: "Robert",
  11404. // | middle: "X",
  11405. // | last: "Cringely"
  11406. // | }
  11407. // | });
  11408. // | // returns: Hello, Robert Cringely AKA Bob!
  11409. // example:
  11410. // | // uses an array for substitutions:
  11411. // | dojo.replace("Hello, {0} {2}!",
  11412. // | ["Robert", "X", "Cringely"]);
  11413. // | // returns: Hello, Robert Cringely!
  11414. // example:
  11415. // | // uses a function for substitutions:
  11416. // | function sum(a){
  11417. // | var t = 0;
  11418. // | dojo.forEach(a, function(x){ t += x; });
  11419. // | return t;
  11420. // | }
  11421. // | dojo.replace(
  11422. // | "{count} payments averaging {avg} USD per payment.",
  11423. // | dojo.hitch(
  11424. // | { payments: [11, 16, 12] },
  11425. // | function(_, key){
  11426. // | switch(key){
  11427. // | case "count": return this.payments.length;
  11428. // | case "min": return Math.min.apply(Math, this.payments);
  11429. // | case "max": return Math.max.apply(Math, this.payments);
  11430. // | case "sum": return sum(this.payments);
  11431. // | case "avg": return sum(this.payments) / this.payments.length;
  11432. // | }
  11433. // | }
  11434. // | )
  11435. // | );
  11436. // | // prints: 3 payments averaging 13 USD per payment.
  11437. // example:
  11438. // | // uses an alternative PHP-like pattern for substitutions:
  11439. // | dojo.replace("Hello, ${0} ${2}!",
  11440. // | ["Robert", "X", "Cringely"], /\$\{([^\}]+)\}/g);
  11441. // | // returns: Hello, Robert Cringely!
  11442. return ""; // String
  11443. }
  11444. =====*/
  11445. });
  11446. },
  11447. 'dojo/Evented':function(){
  11448. define("dojo/Evented", ["./aspect", "./on"], function(aspect, on){
  11449. // summary:
  11450. // The export of this module is a class that can be used as a mixin or base class,
  11451. // to add on() and emit() methods to a class
  11452. // for listening for events and emiting events:
  11453. // |define(["dojo/Evented"], function(Evented){
  11454. // | var EventedWidget = dojo.declare([Evented, dijit._Widget], {...});
  11455. // | widget = new EventedWidget();
  11456. // | widget.on("open", function(event){
  11457. // | ... do something with event
  11458. // | });
  11459. // |
  11460. // | widget.emit("open", {name:"some event", ...});
  11461. "use strict";
  11462. var after = aspect.after;
  11463. function Evented(){
  11464. }
  11465. Evented.prototype = {
  11466. on: function(type, listener){
  11467. return on.parse(this, type, listener, function(target, type){
  11468. return after(target, 'on' + type, listener, true);
  11469. });
  11470. },
  11471. emit: function(type, event){
  11472. var args = [this];
  11473. args.push.apply(args, arguments);
  11474. return on.emit.apply(on, args);
  11475. }
  11476. };
  11477. return Evented;
  11478. });
  11479. },
  11480. 'dojo/mouse':function(){
  11481. define("dojo/mouse", ["./_base/kernel", "./on", "./has", "./dom", "./_base/window"], function(dojo, on, has, dom, win){
  11482. // module:
  11483. // dojo/mouse
  11484. // summary:
  11485. // This module provide mouse event handling utility functions and exports
  11486. // mouseenter and mouseleave event emulation.
  11487. // example:
  11488. // To use these events, you register a mouseenter like this:
  11489. // | define(["dojo/on", dojo/mouse"], function(on, mouse){
  11490. // | on(targetNode, mouse.enter, function(event){
  11491. // | dojo.addClass(targetNode, "highlighted");
  11492. // | });
  11493. // | on(targetNode, mouse.leave, function(event){
  11494. // | dojo.removeClass(targetNode, "highlighted");
  11495. // | });
  11496. has.add("dom-quirks", win.doc && win.doc.compatMode == "BackCompat");
  11497. has.add("events-mouseenter", win.doc && "onmouseenter" in win.doc.createElement("div"));
  11498. var mouseButtons;
  11499. if((has("dom-quirks") && has("ie")) || !has("dom-addeventlistener")){
  11500. mouseButtons = {
  11501. LEFT: 1,
  11502. MIDDLE: 4,
  11503. RIGHT: 2,
  11504. // helper functions
  11505. isButton: function(e, button){ return e.button & button; },
  11506. isLeft: function(e){ return e.button & 1; },
  11507. isMiddle: function(e){ return e.button & 4; },
  11508. isRight: function(e){ return e.button & 2; }
  11509. };
  11510. }else{
  11511. mouseButtons = {
  11512. LEFT: 0,
  11513. MIDDLE: 1,
  11514. RIGHT: 2,
  11515. // helper functions
  11516. isButton: function(e, button){ return e.button == button; },
  11517. isLeft: function(e){ return e.button == 0; },
  11518. isMiddle: function(e){ return e.button == 1; },
  11519. isRight: function(e){ return e.button == 2; }
  11520. };
  11521. }
  11522. dojo.mouseButtons = mouseButtons;
  11523. /*=====
  11524. dojo.mouseButtons = {
  11525. // LEFT: Number
  11526. // Numeric value of the left mouse button for the platform.
  11527. LEFT: 0,
  11528. // MIDDLE: Number
  11529. // Numeric value of the middle mouse button for the platform.
  11530. MIDDLE: 1,
  11531. // RIGHT: Number
  11532. // Numeric value of the right mouse button for the platform.
  11533. RIGHT: 2,
  11534. isButton: function(e, button){
  11535. // summary:
  11536. // Checks an event object for a pressed button
  11537. // e: Event
  11538. // Event object to examine
  11539. // button: Number
  11540. // The button value (example: dojo.mouseButton.LEFT)
  11541. return e.button == button; // Boolean
  11542. },
  11543. isLeft: function(e){
  11544. // summary:
  11545. // Checks an event object for the pressed left button
  11546. // e: Event
  11547. // Event object to examine
  11548. return e.button == 0; // Boolean
  11549. },
  11550. isMiddle: function(e){
  11551. // summary:
  11552. // Checks an event object for the pressed middle button
  11553. // e: Event
  11554. // Event object to examine
  11555. return e.button == 1; // Boolean
  11556. },
  11557. isRight: function(e){
  11558. // summary:
  11559. // Checks an event object for the pressed right button
  11560. // e: Event
  11561. // Event object to examine
  11562. return e.button == 2; // Boolean
  11563. }
  11564. };
  11565. =====*/
  11566. function eventHandler(type, mustBubble){
  11567. // emulation of mouseenter/leave with mouseover/out using descendant checking
  11568. var handler = function(node, listener){
  11569. return on(node, type, function(evt){
  11570. if(!dom.isDescendant(evt.relatedTarget, mustBubble ? evt.target : node)){
  11571. return listener.call(this, evt);
  11572. }
  11573. });
  11574. };
  11575. if(!mustBubble){
  11576. handler.bubble = eventHandler(type, true);
  11577. }
  11578. return handler;
  11579. }
  11580. return {
  11581. _eventHandler: eventHandler, // for dojo/touch
  11582. // enter: Synthetic Event
  11583. // This is an extension event for the mouseenter that IE provides, emulating the
  11584. // behavior on other browsers.
  11585. enter: eventHandler("mouseover"),
  11586. // leave: Synthetic Event
  11587. // This is an extension event for the mouseleave that IE provides, emulating the
  11588. // behavior on other browsers.
  11589. leave: eventHandler("mouseout"),
  11590. isLeft: mouseButtons.isLeft,
  11591. /*=====
  11592. isLeft: function(){
  11593. // summary:
  11594. // Test an event object (from a mousedown event) to see if the left button was pressed.
  11595. },
  11596. =====*/
  11597. isMiddle: mouseButtons.isMiddle,
  11598. /*=====
  11599. isMiddle: function(){
  11600. // summary:
  11601. // Test an event object (from a mousedown event) to see if the middle button was pressed.
  11602. },
  11603. =====*/
  11604. isRight: mouseButtons.isRight
  11605. /*=====
  11606. , isRight: function(){
  11607. // summary:
  11608. // Test an event object (from a mousedown event) to see if the right button was pressed.
  11609. }
  11610. =====*/
  11611. };
  11612. });
  11613. },
  11614. 'dojo/topic':function(){
  11615. define("dojo/topic", ["./Evented"], function(Evented){
  11616. // summary:
  11617. // The export of this module is a pubsub hub
  11618. // You can also use listen function itself as a pub/sub hub:
  11619. // | topic.subscribe("some/topic", function(event){
  11620. // | ... do something with event
  11621. // | });
  11622. // | topic.publish("some/topic", {name:"some event", ...});
  11623. var hub = new Evented;
  11624. return {
  11625. publish: function(topic, event){
  11626. // summary:
  11627. // Publishes a message to a topic on the pub/sub hub. All arguments after
  11628. // the first will be passed to the subscribers, so any number of arguments
  11629. // can be provided (not just event).
  11630. // topic: String
  11631. // The name of the topic to publish to
  11632. // event: Object
  11633. // An event to distribute to the topic listeners
  11634. return hub.emit.apply(hub, arguments);
  11635. },
  11636. subscribe: function(topic, listener){
  11637. // summary:
  11638. // Subcribes to a topic on the pub/sub hub
  11639. // topic: String
  11640. // The topic to subscribe to
  11641. // listener: Function
  11642. // A function to call when a message is published to the given topic
  11643. return hub.on.apply(hub, arguments);
  11644. }
  11645. }
  11646. });
  11647. },
  11648. 'dojo/_base/xhr':function(){
  11649. define("dojo/_base/xhr", [
  11650. "./kernel", "./sniff", "require", "../io-query", "../dom", "../dom-form", "./Deferred", "./json", "./lang", "./array", "../on"
  11651. ], function(dojo, has, require, ioq, dom, domForm, deferred, json, lang, array, on){
  11652. // module:
  11653. // dojo/_base.xhr
  11654. // summary:
  11655. // This modules defines the dojo.xhr* API.
  11656. has.add("native-xhr", function() {
  11657. // if true, the environment has a native XHR implementation
  11658. return typeof XMLHttpRequest !== 'undefined';
  11659. });
  11660. if(1 && require.getXhr){
  11661. dojo._xhrObj = require.getXhr;
  11662. }else if (has("native-xhr")){
  11663. dojo._xhrObj = function(){
  11664. // summary:
  11665. // does the work of portably generating a new XMLHTTPRequest object.
  11666. try{
  11667. return new XMLHttpRequest();
  11668. }catch(e){
  11669. throw new Error("XMLHTTP not available: "+e);
  11670. }
  11671. };
  11672. }else{
  11673. // PROGIDs are in order of decreasing likelihood; this will change in time.
  11674. for(var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], progid, i = 0; i < 3;){
  11675. try{
  11676. progid = XMLHTTP_PROGIDS[i++];
  11677. if (new ActiveXObject(progid)) {
  11678. // this progid works; therefore, use it from now on
  11679. break;
  11680. }
  11681. }catch(e){
  11682. // squelch; we're just trying to find a good ActiveX PROGID
  11683. // if they all fail, then progid ends up as the last attempt and that will signal the error
  11684. // the first time the client actually tries to exec an xhr
  11685. }
  11686. }
  11687. dojo._xhrObj= function() {
  11688. return new ActiveXObject(progid);
  11689. };
  11690. }
  11691. var cfg = dojo.config;
  11692. // mix in io-query and dom-form
  11693. dojo.objectToQuery = ioq.objectToQuery;
  11694. dojo.queryToObject = ioq.queryToObject;
  11695. dojo.fieldToObject = domForm.fieldToObject;
  11696. dojo.formToObject = domForm.toObject;
  11697. dojo.formToQuery = domForm.toQuery;
  11698. dojo.formToJson = domForm.toJson;
  11699. // need to block async callbacks from snatching this thread as the result
  11700. // of an async callback might call another sync XHR, this hangs khtml forever
  11701. // must checked by watchInFlight()
  11702. dojo._blockAsync = false;
  11703. // MOW: remove dojo._contentHandlers alias in 2.0
  11704. var handlers = dojo._contentHandlers = dojo.contentHandlers = {
  11705. // summary:
  11706. // A map of availble XHR transport handle types. Name matches the
  11707. // `handleAs` attribute passed to XHR calls.
  11708. //
  11709. // description:
  11710. // A map of availble XHR transport handle types. Name matches the
  11711. // `handleAs` attribute passed to XHR calls. Each contentHandler is
  11712. // called, passing the xhr object for manipulation. The return value
  11713. // from the contentHandler will be passed to the `load` or `handle`
  11714. // functions defined in the original xhr call.
  11715. //
  11716. // example:
  11717. // Creating a custom content-handler:
  11718. // | dojo.contentHandlers.makeCaps = function(xhr){
  11719. // | return xhr.responseText.toUpperCase();
  11720. // | }
  11721. // | // and later:
  11722. // | dojo.xhrGet({
  11723. // | url:"foo.txt",
  11724. // | handleAs:"makeCaps",
  11725. // | load: function(data){ /* data is a toUpper version of foo.txt */ }
  11726. // | });
  11727. "text": function(xhr){
  11728. // summary: A contentHandler which simply returns the plaintext response data
  11729. return xhr.responseText;
  11730. },
  11731. "json": function(xhr){
  11732. // summary: A contentHandler which returns a JavaScript object created from the response data
  11733. return json.fromJson(xhr.responseText || null);
  11734. },
  11735. "json-comment-filtered": function(xhr){
  11736. // summary: A contentHandler which expects comment-filtered JSON.
  11737. // description:
  11738. // A contentHandler which expects comment-filtered JSON.
  11739. // the json-comment-filtered option was implemented to prevent
  11740. // "JavaScript Hijacking", but it is less secure than standard JSON. Use
  11741. // standard JSON instead. JSON prefixing can be used to subvert hijacking.
  11742. //
  11743. // Will throw a notice suggesting to use application/json mimetype, as
  11744. // json-commenting can introduce security issues. To decrease the chances of hijacking,
  11745. // use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
  11746. //
  11747. // use djConfig.useCommentedJson = true to turn off the notice
  11748. if(!dojo.config.useCommentedJson){
  11749. console.warn("Consider using the standard mimetype:application/json."
  11750. + " json-commenting can introduce security issues. To"
  11751. + " decrease the chances of hijacking, use the standard the 'json' handler and"
  11752. + " prefix your json with: {}&&\n"
  11753. + "Use djConfig.useCommentedJson=true to turn off this message.");
  11754. }
  11755. var value = xhr.responseText;
  11756. var cStartIdx = value.indexOf("\/*");
  11757. var cEndIdx = value.lastIndexOf("*\/");
  11758. if(cStartIdx == -1 || cEndIdx == -1){
  11759. throw new Error("JSON was not comment filtered");
  11760. }
  11761. return json.fromJson(value.substring(cStartIdx+2, cEndIdx));
  11762. },
  11763. "javascript": function(xhr){
  11764. // summary: A contentHandler which evaluates the response data, expecting it to be valid JavaScript
  11765. // FIXME: try Moz and IE specific eval variants?
  11766. return dojo.eval(xhr.responseText);
  11767. },
  11768. "xml": function(xhr){
  11769. // summary: A contentHandler returning an XML Document parsed from the response data
  11770. var result = xhr.responseXML;
  11771. if(has("ie")){
  11772. if((!result || !result.documentElement)){
  11773. //WARNING: this branch used by the xml handling in dojo.io.iframe,
  11774. //so be sure to test dojo.io.iframe if making changes below.
  11775. var ms = function(n){ return "MSXML" + n + ".DOMDocument"; };
  11776. var dp = ["Microsoft.XMLDOM", ms(6), ms(4), ms(3), ms(2)];
  11777. array.some(dp, function(p){
  11778. try{
  11779. var dom = new ActiveXObject(p);
  11780. dom.async = false;
  11781. dom.loadXML(xhr.responseText);
  11782. result = dom;
  11783. }catch(e){ return false; }
  11784. return true;
  11785. });
  11786. }
  11787. }
  11788. return result; // DOMDocument
  11789. },
  11790. "json-comment-optional": function(xhr){
  11791. // summary: A contentHandler which checks the presence of comment-filtered JSON and
  11792. // alternates between the `json` and `json-comment-filtered` contentHandlers.
  11793. if(xhr.responseText && /^[^{\[]*\/\*/.test(xhr.responseText)){
  11794. return handlers["json-comment-filtered"](xhr);
  11795. }else{
  11796. return handlers["json"](xhr);
  11797. }
  11798. }
  11799. };
  11800. /*=====
  11801. dojo.__IoArgs = function(){
  11802. // url: String
  11803. // URL to server endpoint.
  11804. // content: Object?
  11805. // Contains properties with string values. These
  11806. // properties will be serialized as name1=value2 and
  11807. // passed in the request.
  11808. // timeout: Integer?
  11809. // Milliseconds to wait for the response. If this time
  11810. // passes, the then error callbacks are called.
  11811. // form: DOMNode?
  11812. // DOM node for a form. Used to extract the form values
  11813. // and send to the server.
  11814. // preventCache: Boolean?
  11815. // Default is false. If true, then a
  11816. // "dojo.preventCache" parameter is sent in the request
  11817. // with a value that changes with each request
  11818. // (timestamp). Useful only with GET-type requests.
  11819. // handleAs: String?
  11820. // Acceptable values depend on the type of IO
  11821. // transport (see specific IO calls for more information).
  11822. // rawBody: String?
  11823. // Sets the raw body for an HTTP request. If this is used, then the content
  11824. // property is ignored. This is mostly useful for HTTP methods that have
  11825. // a body to their requests, like PUT or POST. This property can be used instead
  11826. // of postData and putData for dojo.rawXhrPost and dojo.rawXhrPut respectively.
  11827. // ioPublish: Boolean?
  11828. // Set this explicitly to false to prevent publishing of topics related to
  11829. // IO operations. Otherwise, if djConfig.ioPublish is set to true, topics
  11830. // will be published via dojo.publish for different phases of an IO operation.
  11831. // See dojo.__IoPublish for a list of topics that are published.
  11832. // load: Function?
  11833. // This function will be
  11834. // called on a successful HTTP response code.
  11835. // error: Function?
  11836. // This function will
  11837. // be called when the request fails due to a network or server error, the url
  11838. // is invalid, etc. It will also be called if the load or handle callback throws an
  11839. // exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications
  11840. // to continue to run even when a logic error happens in the callback, while making
  11841. // it easier to troubleshoot while in debug mode.
  11842. // handle: Function?
  11843. // This function will
  11844. // be called at the end of every request, whether or not an error occurs.
  11845. this.url = url;
  11846. this.content = content;
  11847. this.timeout = timeout;
  11848. this.form = form;
  11849. this.preventCache = preventCache;
  11850. this.handleAs = handleAs;
  11851. this.ioPublish = ioPublish;
  11852. this.load = function(response, ioArgs){
  11853. // ioArgs: dojo.__IoCallbackArgs
  11854. // Provides additional information about the request.
  11855. // response: Object
  11856. // The response in the format as defined with handleAs.
  11857. }
  11858. this.error = function(response, ioArgs){
  11859. // ioArgs: dojo.__IoCallbackArgs
  11860. // Provides additional information about the request.
  11861. // response: Object
  11862. // The response in the format as defined with handleAs.
  11863. }
  11864. this.handle = function(loadOrError, response, ioArgs){
  11865. // loadOrError: String
  11866. // Provides a string that tells you whether this function
  11867. // was called because of success (load) or failure (error).
  11868. // response: Object
  11869. // The response in the format as defined with handleAs.
  11870. // ioArgs: dojo.__IoCallbackArgs
  11871. // Provides additional information about the request.
  11872. }
  11873. }
  11874. =====*/
  11875. /*=====
  11876. dojo.__IoCallbackArgs = function(args, xhr, url, query, handleAs, id, canDelete, json){
  11877. // args: Object
  11878. // the original object argument to the IO call.
  11879. // xhr: XMLHttpRequest
  11880. // For XMLHttpRequest calls only, the
  11881. // XMLHttpRequest object that was used for the
  11882. // request.
  11883. // url: String
  11884. // The final URL used for the call. Many times it
  11885. // will be different than the original args.url
  11886. // value.
  11887. // query: String
  11888. // For non-GET requests, the
  11889. // name1=value1&name2=value2 parameters sent up in
  11890. // the request.
  11891. // handleAs: String
  11892. // The final indicator on how the response will be
  11893. // handled.
  11894. // id: String
  11895. // For dojo.io.script calls only, the internal
  11896. // script ID used for the request.
  11897. // canDelete: Boolean
  11898. // For dojo.io.script calls only, indicates
  11899. // whether the script tag that represents the
  11900. // request can be deleted after callbacks have
  11901. // been called. Used internally to know when
  11902. // cleanup can happen on JSONP-type requests.
  11903. // json: Object
  11904. // For dojo.io.script calls only: holds the JSON
  11905. // response for JSONP-type requests. Used
  11906. // internally to hold on to the JSON responses.
  11907. // You should not need to access it directly --
  11908. // the same object should be passed to the success
  11909. // callbacks directly.
  11910. this.args = args;
  11911. this.xhr = xhr;
  11912. this.url = url;
  11913. this.query = query;
  11914. this.handleAs = handleAs;
  11915. this.id = id;
  11916. this.canDelete = canDelete;
  11917. this.json = json;
  11918. }
  11919. =====*/
  11920. /*=====
  11921. dojo.__IoPublish = function(){
  11922. // summary:
  11923. // This is a list of IO topics that can be published
  11924. // if djConfig.ioPublish is set to true. IO topics can be
  11925. // published for any Input/Output, network operation. So,
  11926. // dojo.xhr, dojo.io.script and dojo.io.iframe can all
  11927. // trigger these topics to be published.
  11928. // start: String
  11929. // "/dojo/io/start" is sent when there are no outstanding IO
  11930. // requests, and a new IO request is started. No arguments
  11931. // are passed with this topic.
  11932. // send: String
  11933. // "/dojo/io/send" is sent whenever a new IO request is started.
  11934. // It passes the dojo.Deferred for the request with the topic.
  11935. // load: String
  11936. // "/dojo/io/load" is sent whenever an IO request has loaded
  11937. // successfully. It passes the response and the dojo.Deferred
  11938. // for the request with the topic.
  11939. // error: String
  11940. // "/dojo/io/error" is sent whenever an IO request has errored.
  11941. // It passes the error and the dojo.Deferred
  11942. // for the request with the topic.
  11943. // done: String
  11944. // "/dojo/io/done" is sent whenever an IO request has completed,
  11945. // either by loading or by erroring. It passes the error and
  11946. // the dojo.Deferred for the request with the topic.
  11947. // stop: String
  11948. // "/dojo/io/stop" is sent when all outstanding IO requests have
  11949. // finished. No arguments are passed with this topic.
  11950. this.start = "/dojo/io/start";
  11951. this.send = "/dojo/io/send";
  11952. this.load = "/dojo/io/load";
  11953. this.error = "/dojo/io/error";
  11954. this.done = "/dojo/io/done";
  11955. this.stop = "/dojo/io/stop";
  11956. }
  11957. =====*/
  11958. dojo._ioSetArgs = function(/*dojo.__IoArgs*/args,
  11959. /*Function*/canceller,
  11960. /*Function*/okHandler,
  11961. /*Function*/errHandler){
  11962. // summary:
  11963. // sets up the Deferred and ioArgs property on the Deferred so it
  11964. // can be used in an io call.
  11965. // args:
  11966. // The args object passed into the public io call. Recognized properties on
  11967. // the args object are:
  11968. // canceller:
  11969. // The canceller function used for the Deferred object. The function
  11970. // will receive one argument, the Deferred object that is related to the
  11971. // canceller.
  11972. // okHandler:
  11973. // The first OK callback to be registered with Deferred. It has the opportunity
  11974. // to transform the OK response. It will receive one argument -- the Deferred
  11975. // object returned from this function.
  11976. // errHandler:
  11977. // The first error callback to be registered with Deferred. It has the opportunity
  11978. // to do cleanup on an error. It will receive two arguments: error (the
  11979. // Error object) and dfd, the Deferred object returned from this function.
  11980. var ioArgs = {args: args, url: args.url};
  11981. //Get values from form if requestd.
  11982. var formObject = null;
  11983. if(args.form){
  11984. var form = dom.byId(args.form);
  11985. //IE requires going through getAttributeNode instead of just getAttribute in some form cases,
  11986. //so use it for all. See #2844
  11987. var actnNode = form.getAttributeNode("action");
  11988. ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : null);
  11989. formObject = domForm.toObject(form);
  11990. }
  11991. // set up the query params
  11992. var miArgs = [{}];
  11993. if(formObject){
  11994. // potentially over-ride url-provided params w/ form values
  11995. miArgs.push(formObject);
  11996. }
  11997. if(args.content){
  11998. // stuff in content over-rides what's set by form
  11999. miArgs.push(args.content);
  12000. }
  12001. if(args.preventCache){
  12002. miArgs.push({"dojo.preventCache": new Date().valueOf()});
  12003. }
  12004. ioArgs.query = ioq.objectToQuery(lang.mixin.apply(null, miArgs));
  12005. // .. and the real work of getting the deferred in order, etc.
  12006. ioArgs.handleAs = args.handleAs || "text";
  12007. var d = new deferred(canceller);
  12008. d.addCallbacks(okHandler, function(error){
  12009. return errHandler(error, d);
  12010. });
  12011. //Support specifying load, error and handle callback functions from the args.
  12012. //For those callbacks, the "this" object will be the args object.
  12013. //The callbacks will get the deferred result value as the
  12014. //first argument and the ioArgs object as the second argument.
  12015. var ld = args.load;
  12016. if(ld && lang.isFunction(ld)){
  12017. d.addCallback(function(value){
  12018. return ld.call(args, value, ioArgs);
  12019. });
  12020. }
  12021. var err = args.error;
  12022. if(err && lang.isFunction(err)){
  12023. d.addErrback(function(value){
  12024. return err.call(args, value, ioArgs);
  12025. });
  12026. }
  12027. var handle = args.handle;
  12028. if(handle && lang.isFunction(handle)){
  12029. d.addBoth(function(value){
  12030. return handle.call(args, value, ioArgs);
  12031. });
  12032. }
  12033. //Plug in topic publishing, if dojo.publish is loaded.
  12034. if(cfg.ioPublish && dojo.publish && ioArgs.args.ioPublish !== false){
  12035. d.addCallbacks(
  12036. function(res){
  12037. dojo.publish("/dojo/io/load", [d, res]);
  12038. return res;
  12039. },
  12040. function(res){
  12041. dojo.publish("/dojo/io/error", [d, res]);
  12042. return res;
  12043. }
  12044. );
  12045. d.addBoth(function(res){
  12046. dojo.publish("/dojo/io/done", [d, res]);
  12047. return res;
  12048. });
  12049. }
  12050. d.ioArgs = ioArgs;
  12051. // FIXME: need to wire up the xhr object's abort method to something
  12052. // analagous in the Deferred
  12053. return d;
  12054. };
  12055. var _deferredCancel = function(/*Deferred*/dfd){
  12056. // summary: canceller function for dojo._ioSetArgs call.
  12057. dfd.canceled = true;
  12058. var xhr = dfd.ioArgs.xhr;
  12059. var _at = typeof xhr.abort;
  12060. if(_at == "function" || _at == "object" || _at == "unknown"){
  12061. xhr.abort();
  12062. }
  12063. var err = dfd.ioArgs.error;
  12064. if(!err){
  12065. err = new Error("xhr cancelled");
  12066. err.dojoType="cancel";
  12067. }
  12068. return err;
  12069. };
  12070. var _deferredOk = function(/*Deferred*/dfd){
  12071. // summary: okHandler function for dojo._ioSetArgs call.
  12072. var ret = handlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr);
  12073. return ret === undefined ? null : ret;
  12074. };
  12075. var _deferError = function(/*Error*/error, /*Deferred*/dfd){
  12076. // summary: errHandler function for dojo._ioSetArgs call.
  12077. if(!dfd.ioArgs.args.failOk){
  12078. console.error(error);
  12079. }
  12080. return error;
  12081. };
  12082. // avoid setting a timer per request. It degrades performance on IE
  12083. // something fierece if we don't use unified loops.
  12084. var _inFlightIntvl = null;
  12085. var _inFlight = [];
  12086. //Use a separate count for knowing if we are starting/stopping io calls.
  12087. //Cannot use _inFlight.length since it can change at a different time than
  12088. //when we want to do this kind of test. We only want to decrement the count
  12089. //after a callback/errback has finished, since the callback/errback should be
  12090. //considered as part of finishing a request.
  12091. var _pubCount = 0;
  12092. var _checkPubCount = function(dfd){
  12093. if(_pubCount <= 0){
  12094. _pubCount = 0;
  12095. if(cfg.ioPublish && dojo.publish && (!dfd || dfd && dfd.ioArgs.args.ioPublish !== false)){
  12096. dojo.publish("/dojo/io/stop");
  12097. }
  12098. }
  12099. };
  12100. var _watchInFlight = function(){
  12101. //summary:
  12102. // internal method that checks each inflight XMLHttpRequest to see
  12103. // if it has completed or if the timeout situation applies.
  12104. var now = (new Date()).getTime();
  12105. // make sure sync calls stay thread safe, if this callback is called
  12106. // during a sync call and this results in another sync call before the
  12107. // first sync call ends the browser hangs
  12108. if(!dojo._blockAsync){
  12109. // we need manual loop because we often modify _inFlight (and therefore 'i') while iterating
  12110. // note: the second clause is an assigment on purpose, lint may complain
  12111. for(var i = 0, tif; i < _inFlight.length && (tif = _inFlight[i]); i++){
  12112. var dfd = tif.dfd;
  12113. var func = function(){
  12114. if(!dfd || dfd.canceled || !tif.validCheck(dfd)){
  12115. _inFlight.splice(i--, 1);
  12116. _pubCount -= 1;
  12117. }else if(tif.ioCheck(dfd)){
  12118. _inFlight.splice(i--, 1);
  12119. tif.resHandle(dfd);
  12120. _pubCount -= 1;
  12121. }else if(dfd.startTime){
  12122. //did we timeout?
  12123. if(dfd.startTime + (dfd.ioArgs.args.timeout || 0) < now){
  12124. _inFlight.splice(i--, 1);
  12125. var err = new Error("timeout exceeded");
  12126. err.dojoType = "timeout";
  12127. dfd.errback(err);
  12128. //Cancel the request so the io module can do appropriate cleanup.
  12129. dfd.cancel();
  12130. _pubCount -= 1;
  12131. }
  12132. }
  12133. };
  12134. if(dojo.config.debugAtAllCosts){
  12135. func.call(this);
  12136. }else{
  12137. try{
  12138. func.call(this);
  12139. }catch(e){
  12140. dfd.errback(e);
  12141. }
  12142. }
  12143. }
  12144. }
  12145. _checkPubCount(dfd);
  12146. if(!_inFlight.length){
  12147. clearInterval(_inFlightIntvl);
  12148. _inFlightIntvl = null;
  12149. }
  12150. };
  12151. dojo._ioCancelAll = function(){
  12152. //summary: Cancels all pending IO requests, regardless of IO type
  12153. //(xhr, script, iframe).
  12154. try{
  12155. array.forEach(_inFlight, function(i){
  12156. try{
  12157. i.dfd.cancel();
  12158. }catch(e){/*squelch*/}
  12159. });
  12160. }catch(e){/*squelch*/}
  12161. };
  12162. //Automatically call cancel all io calls on unload
  12163. //in IE for trac issue #2357.
  12164. if(has("ie")){
  12165. on(window, "unload", dojo._ioCancelAll);
  12166. }
  12167. dojo._ioNotifyStart = function(/*Deferred*/dfd){
  12168. // summary:
  12169. // If dojo.publish is available, publish topics
  12170. // about the start of a request queue and/or the
  12171. // the beginning of request.
  12172. // description:
  12173. // Used by IO transports. An IO transport should
  12174. // call this method before making the network connection.
  12175. if(cfg.ioPublish && dojo.publish && dfd.ioArgs.args.ioPublish !== false){
  12176. if(!_pubCount){
  12177. dojo.publish("/dojo/io/start");
  12178. }
  12179. _pubCount += 1;
  12180. dojo.publish("/dojo/io/send", [dfd]);
  12181. }
  12182. };
  12183. dojo._ioWatch = function(dfd, validCheck, ioCheck, resHandle){
  12184. // summary:
  12185. // Watches the io request represented by dfd to see if it completes.
  12186. // dfd: Deferred
  12187. // The Deferred object to watch.
  12188. // validCheck: Function
  12189. // Function used to check if the IO request is still valid. Gets the dfd
  12190. // object as its only argument.
  12191. // ioCheck: Function
  12192. // Function used to check if basic IO call worked. Gets the dfd
  12193. // object as its only argument.
  12194. // resHandle: Function
  12195. // Function used to process response. Gets the dfd
  12196. // object as its only argument.
  12197. var args = dfd.ioArgs.args;
  12198. if(args.timeout){
  12199. dfd.startTime = (new Date()).getTime();
  12200. }
  12201. _inFlight.push({dfd: dfd, validCheck: validCheck, ioCheck: ioCheck, resHandle: resHandle});
  12202. if(!_inFlightIntvl){
  12203. _inFlightIntvl = setInterval(_watchInFlight, 50);
  12204. }
  12205. // handle sync requests
  12206. //A weakness: async calls in flight
  12207. //could have their handlers called as part of the
  12208. //_watchInFlight call, before the sync's callbacks
  12209. // are called.
  12210. if(args.sync){
  12211. _watchInFlight();
  12212. }
  12213. };
  12214. var _defaultContentType = "application/x-www-form-urlencoded";
  12215. var _validCheck = function(/*Deferred*/dfd){
  12216. return dfd.ioArgs.xhr.readyState; //boolean
  12217. };
  12218. var _ioCheck = function(/*Deferred*/dfd){
  12219. return 4 == dfd.ioArgs.xhr.readyState; //boolean
  12220. };
  12221. var _resHandle = function(/*Deferred*/dfd){
  12222. var xhr = dfd.ioArgs.xhr;
  12223. if(dojo._isDocumentOk(xhr)){
  12224. dfd.callback(dfd);
  12225. }else{
  12226. var err = new Error("Unable to load " + dfd.ioArgs.url + " status:" + xhr.status);
  12227. err.status = xhr.status;
  12228. err.responseText = xhr.responseText;
  12229. err.xhr = xhr;
  12230. dfd.errback(err);
  12231. }
  12232. };
  12233. dojo._ioAddQueryToUrl = function(/*dojo.__IoCallbackArgs*/ioArgs){
  12234. //summary: Adds query params discovered by the io deferred construction to the URL.
  12235. //Only use this for operations which are fundamentally GET-type operations.
  12236. if(ioArgs.query.length){
  12237. ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
  12238. ioArgs.query = null;
  12239. }
  12240. };
  12241. /*=====
  12242. dojo.declare("dojo.__XhrArgs", dojo.__IoArgs, {
  12243. constructor: function(){
  12244. // summary:
  12245. // In addition to the properties listed for the dojo._IoArgs type,
  12246. // the following properties are allowed for dojo.xhr* methods.
  12247. // handleAs: String?
  12248. // Acceptable values are: text (default), json, json-comment-optional,
  12249. // json-comment-filtered, javascript, xml. See `dojo.contentHandlers`
  12250. // sync: Boolean?
  12251. // false is default. Indicates whether the request should
  12252. // be a synchronous (blocking) request.
  12253. // headers: Object?
  12254. // Additional HTTP headers to send in the request.
  12255. // failOk: Boolean?
  12256. // false is default. Indicates whether a request should be
  12257. // allowed to fail (and therefore no console error message in
  12258. // the event of a failure)
  12259. // contentType: String|Boolean
  12260. // "application/x-www-form-urlencoded" is default. Set to false to
  12261. // prevent a Content-Type header from being sent, or to a string
  12262. // to send a different Content-Type.
  12263. this.handleAs = handleAs;
  12264. this.sync = sync;
  12265. this.headers = headers;
  12266. this.failOk = failOk;
  12267. }
  12268. });
  12269. =====*/
  12270. dojo.xhr = function(/*String*/ method, /*dojo.__XhrArgs*/ args, /*Boolean?*/ hasBody){
  12271. // summary:
  12272. // Sends an HTTP request with the given method.
  12273. // description:
  12274. // Sends an HTTP request with the given method.
  12275. // See also dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts
  12276. // for those HTTP methods. There are also methods for "raw" PUT and POST methods
  12277. // via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
  12278. // method:
  12279. // HTTP method to be used, such as GET, POST, PUT, DELETE. Should be uppercase.
  12280. // hasBody:
  12281. // If the request has an HTTP body, then pass true for hasBody.
  12282. //Make the Deferred object for this xhr request.
  12283. var dfd = dojo._ioSetArgs(args, _deferredCancel, _deferredOk, _deferError);
  12284. var ioArgs = dfd.ioArgs;
  12285. //Pass the args to _xhrObj, to allow alternate XHR calls based specific calls, like
  12286. //the one used for iframe proxies.
  12287. var xhr = ioArgs.xhr = dojo._xhrObj(ioArgs.args);
  12288. //If XHR factory fails, cancel the deferred.
  12289. if(!xhr){
  12290. dfd.cancel();
  12291. return dfd;
  12292. }
  12293. //Allow for specifying the HTTP body completely.
  12294. if("postData" in args){
  12295. ioArgs.query = args.postData;
  12296. }else if("putData" in args){
  12297. ioArgs.query = args.putData;
  12298. }else if("rawBody" in args){
  12299. ioArgs.query = args.rawBody;
  12300. }else if((arguments.length > 2 && !hasBody) || "POST|PUT".indexOf(method.toUpperCase()) == -1){
  12301. //Check for hasBody being passed. If no hasBody,
  12302. //then only append query string if not a POST or PUT request.
  12303. dojo._ioAddQueryToUrl(ioArgs);
  12304. }
  12305. // IE 6 is a steaming pile. It won't let you call apply() on the native function (xhr.open).
  12306. // workaround for IE6's apply() "issues"
  12307. xhr.open(method, ioArgs.url, args.sync !== true, args.user || undefined, args.password || undefined);
  12308. if(args.headers){
  12309. for(var hdr in args.headers){
  12310. if(hdr.toLowerCase() === "content-type"){
  12311. if(!args.contentType){
  12312. args.contentType = args.headers[hdr];
  12313. }
  12314. }else if(args.headers[hdr]){
  12315. //Only add header if it has a value. This allows for instnace, skipping
  12316. //insertion of X-Requested-With by specifying empty value.
  12317. xhr.setRequestHeader(hdr, args.headers[hdr]);
  12318. }
  12319. }
  12320. }
  12321. // FIXME: is this appropriate for all content types?
  12322. if(args.contentType !== false){
  12323. xhr.setRequestHeader("Content-Type", args.contentType || _defaultContentType);
  12324. }
  12325. if(!args.headers || !("X-Requested-With" in args.headers)){
  12326. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  12327. }
  12328. // FIXME: set other headers here!
  12329. dojo._ioNotifyStart(dfd);
  12330. if(dojo.config.debugAtAllCosts){
  12331. xhr.send(ioArgs.query);
  12332. }else{
  12333. try{
  12334. xhr.send(ioArgs.query);
  12335. }catch(e){
  12336. ioArgs.error = e;
  12337. dfd.cancel();
  12338. }
  12339. }
  12340. dojo._ioWatch(dfd, _validCheck, _ioCheck, _resHandle);
  12341. xhr = null;
  12342. return dfd; // dojo.Deferred
  12343. };
  12344. dojo.xhrGet = function(/*dojo.__XhrArgs*/ args){
  12345. // summary:
  12346. // Sends an HTTP GET request to the server.
  12347. return dojo.xhr("GET", args); // dojo.Deferred
  12348. };
  12349. dojo.rawXhrPost = dojo.xhrPost = function(/*dojo.__XhrArgs*/ args){
  12350. // summary:
  12351. // Sends an HTTP POST request to the server. In addtion to the properties
  12352. // listed for the dojo.__XhrArgs type, the following property is allowed:
  12353. // postData:
  12354. // String. Send raw data in the body of the POST request.
  12355. return dojo.xhr("POST", args, true); // dojo.Deferred
  12356. };
  12357. dojo.rawXhrPut = dojo.xhrPut = function(/*dojo.__XhrArgs*/ args){
  12358. // summary:
  12359. // Sends an HTTP PUT request to the server. In addtion to the properties
  12360. // listed for the dojo.__XhrArgs type, the following property is allowed:
  12361. // putData:
  12362. // String. Send raw data in the body of the PUT request.
  12363. return dojo.xhr("PUT", args, true); // dojo.Deferred
  12364. };
  12365. dojo.xhrDelete = function(/*dojo.__XhrArgs*/ args){
  12366. // summary:
  12367. // Sends an HTTP DELETE request to the server.
  12368. return dojo.xhr("DELETE", args); //dojo.Deferred
  12369. };
  12370. /*
  12371. dojo.wrapForm = function(formNode){
  12372. //summary:
  12373. // A replacement for FormBind, but not implemented yet.
  12374. // FIXME: need to think harder about what extensions to this we might
  12375. // want. What should we allow folks to do w/ this? What events to
  12376. // set/send?
  12377. throw new Error("dojo.wrapForm not yet implemented");
  12378. }
  12379. */
  12380. dojo._isDocumentOk = function(http){
  12381. var stat = http.status || 0;
  12382. stat =
  12383. (stat >= 200 && stat < 300) || // allow any 2XX response code
  12384. stat == 304 || // or, get it out of the cache
  12385. stat == 1223 || // or, Internet Explorer mangled the status code
  12386. !stat; // or, we're Titanium/browser chrome/chrome extension requesting a local file
  12387. return stat; // Boolean
  12388. };
  12389. dojo._getText = function(url){
  12390. var result;
  12391. dojo.xhrGet({url:url, sync:true, load:function(text){
  12392. result = text;
  12393. }});
  12394. return result;
  12395. };
  12396. // Add aliases for static functions to dojo.xhr since dojo.xhr is what's returned from this module
  12397. lang.mixin(dojo.xhr, {
  12398. _xhrObj: dojo._xhrObj,
  12399. fieldToObject: domForm.fieldToObject,
  12400. formToObject: domForm.toObject,
  12401. objectToQuery: ioq.objectToQuery,
  12402. formToQuery: domForm.toQuery,
  12403. formToJson: domForm.toJson,
  12404. queryToObject: ioq.queryToObject,
  12405. contentHandlers: handlers,
  12406. _ioSetArgs: dojo._ioSetArgs,
  12407. _ioCancelAll: dojo._ioCancelAll,
  12408. _ioNotifyStart: dojo._ioNotifyStart,
  12409. _ioWatch: dojo._ioWatch,
  12410. _ioAddQueryToUrl: dojo._ioAddQueryToUrl,
  12411. _isDocumentOk: dojo._isDocumentOk,
  12412. _getText: dojo._getText,
  12413. get: dojo.xhrGet,
  12414. post: dojo.xhrPost,
  12415. put: dojo.xhrPut,
  12416. del: dojo.xhrDelete // because "delete" is a reserved word
  12417. });
  12418. return dojo.xhr;
  12419. });
  12420. },
  12421. 'dojo/loadInit':function(){
  12422. define("dojo/loadInit", ["./_base/loader"], function(loader){
  12423. return {
  12424. dynamic:0,
  12425. normalize:function(id){return id;},
  12426. load:loader.loadInit
  12427. };
  12428. });
  12429. },
  12430. 'dojo/_base/unload':function(){
  12431. define(["./kernel", "./connect"], function(dojo, connect) {
  12432. // module:
  12433. // dojo/unload
  12434. // summary:
  12435. // This module contains the document and window unload detection API.
  12436. var win = window;
  12437. /*=====
  12438. dojo.windowUnloaded = function(){
  12439. // summary:
  12440. // signal fired by impending window destruction. You may use
  12441. // dojo.addOnWindowUnload() to register a listener for this
  12442. // event. NOTE: if you wish to dojo.connect() to this method
  12443. // to perform page/application cleanup, be aware that this
  12444. // event WILL NOT fire if no handler has been registered with
  12445. // dojo.addOnWindowUnload. This behavior started in Dojo 1.3.
  12446. // Previous versions always triggered dojo.windowUnloaded. See
  12447. // dojo.addOnWindowUnload for more info.
  12448. };
  12449. =====*/
  12450. dojo.addOnWindowUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
  12451. // summary:
  12452. // registers a function to be triggered when window.onunload
  12453. // fires.
  12454. // description:
  12455. // The first time that addOnWindowUnload is called Dojo
  12456. // will register a page listener to trigger your unload
  12457. // handler with. Note that registering these handlers may
  12458. // destory "fastback" page caching in browsers that support
  12459. // it. Be careful trying to modify the DOM or access
  12460. // JavaScript properties during this phase of page unloading:
  12461. // they may not always be available. Consider
  12462. // dojo.addOnUnload() if you need to modify the DOM or do
  12463. // heavy JavaScript work since it fires at the eqivalent of
  12464. // the page's "onbeforeunload" event.
  12465. // example:
  12466. // | dojo.addOnWindowUnload(functionPointer)
  12467. // | dojo.addOnWindowUnload(object, "functionName");
  12468. // | dojo.addOnWindowUnload(object, function(){ /* ... */});
  12469. if (!dojo.windowUnloaded) {
  12470. connect.connect(win, "unload", (dojo.windowUnloaded= function(){}));
  12471. }
  12472. connect.connect(win, "unload", obj, functionName);
  12473. };
  12474. dojo.addOnUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
  12475. // summary:
  12476. // registers a function to be triggered when the page unloads.
  12477. // description:
  12478. // The first time that addOnUnload is called Dojo will
  12479. // register a page listener to trigger your unload handler
  12480. // with.
  12481. //
  12482. // In a browser enviroment, the functions will be triggered
  12483. // during the window.onbeforeunload event. Be careful of doing
  12484. // too much work in an unload handler. onbeforeunload can be
  12485. // triggered if a link to download a file is clicked, or if
  12486. // the link is a javascript: link. In these cases, the
  12487. // onbeforeunload event fires, but the document is not
  12488. // actually destroyed. So be careful about doing destructive
  12489. // operations in a dojo.addOnUnload callback.
  12490. //
  12491. // Further note that calling dojo.addOnUnload will prevent
  12492. // browsers from using a "fast back" cache to make page
  12493. // loading via back button instantaneous.
  12494. // example:
  12495. // | dojo.addOnUnload(functionPointer)
  12496. // | dojo.addOnUnload(object, "functionName")
  12497. // | dojo.addOnUnload(object, function(){ /* ... */});
  12498. connect.connect(win, "beforeunload", obj, functionName);
  12499. };
  12500. return {
  12501. addOnWindowUnload: dojo.addOnWindowUnload,
  12502. addOnUnload: dojo.addOnUnload
  12503. };
  12504. });
  12505. },
  12506. 'dojo/_base/NodeList':function(){
  12507. define("dojo/_base/NodeList", ["./kernel", "../query", "./array", "./html", "../NodeList-dom"], function(dojo, query, array){
  12508. // module:
  12509. // dojo/_base/NodeList
  12510. // summary:
  12511. // This module defines dojo.NodeList.
  12512. var NodeList = query.NodeList;
  12513. /*=====
  12514. dojo.extend(dojo.NodeList, {
  12515. connect: function(methodName, objOrFunc, funcName){
  12516. // summary:
  12517. // attach event handlers to every item of the NodeList. Uses dojo.connect()
  12518. // so event properties are normalized
  12519. // methodName: String
  12520. // the name of the method to attach to. For DOM events, this should be
  12521. // the lower-case name of the event
  12522. // objOrFunc: Object|Function|String
  12523. // if 2 arguments are passed (methodName, objOrFunc), objOrFunc should
  12524. // reference a function or be the name of the function in the global
  12525. // namespace to attach. If 3 arguments are provided
  12526. // (methodName, objOrFunc, funcName), objOrFunc must be the scope to
  12527. // locate the bound function in
  12528. // funcName: String?
  12529. // optional. A string naming the function in objOrFunc to bind to the
  12530. // event. May also be a function reference.
  12531. // example:
  12532. // add an onclick handler to every button on the page
  12533. // | dojo.query("div:nth-child(odd)").connect("onclick", function(e){
  12534. // | console.log("clicked!");
  12535. // | });
  12536. // example:
  12537. // attach foo.bar() to every odd div's onmouseover
  12538. // | dojo.query("div:nth-child(odd)").connect("onmouseover", foo, "bar");
  12539. },
  12540. coords: function(){
  12541. // summary:
  12542. // Deprecated: Use position() for border-box x/y/w/h
  12543. // or marginBox() for margin-box w/h/l/t.
  12544. // Returns the box objects of all elements in a node list as
  12545. // an Array (*not* a NodeList). Acts like `dojo.coords`, though assumes
  12546. // the node passed is each node in this list.
  12547. return dojo.map(this, dojo.coords); // Array
  12548. }
  12549. });
  12550. var NodeList = dojo.NodeList;
  12551. =====*/
  12552. var nlp = NodeList.prototype;
  12553. // don't bind early to dojo.connect since we no longer explicitly depend on it
  12554. nlp.connect = NodeList._adaptAsForEach(function(){
  12555. return dojo.connect.apply(this, arguments);
  12556. });
  12557. nlp.coords = NodeList._adaptAsMap(dojo.coords);
  12558. NodeList.events = [
  12559. // summary:
  12560. // list of all DOM events used in NodeList
  12561. "blur", "focus", "change", "click", "error", "keydown", "keypress",
  12562. "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove",
  12563. "mouseout", "mouseover", "mouseup", "submit"
  12564. ];
  12565. // FIXME: pseudo-doc the above automatically generated on-event functions
  12566. // syntactic sugar for DOM events
  12567. array.forEach(NodeList.events, function(evt){
  12568. var _oe = "on" + evt;
  12569. nlp[_oe] = function(a, b){
  12570. return this.connect(_oe, a, b);
  12571. };
  12572. // FIXME: should these events trigger publishes?
  12573. /*
  12574. return (a ? this.connect(_oe, a, b) :
  12575. this.forEach(function(n){
  12576. // FIXME:
  12577. // listeners get buried by
  12578. // addEventListener and can't be dug back
  12579. // out to be triggered externally.
  12580. // see:
  12581. // http://developer.mozilla.org/en/docs/DOM:element
  12582. console.log(n, evt, _oe);
  12583. // FIXME: need synthetic event support!
  12584. var _e = { target: n, faux: true, type: evt };
  12585. // dojo._event_listener._synthesizeEvent({}, { target: n, faux: true, type: evt });
  12586. try{ n[evt](_e); }catch(e){ console.log(e); }
  12587. try{ n[_oe](_e); }catch(e){ console.log(e); }
  12588. })
  12589. );
  12590. */
  12591. }
  12592. );
  12593. dojo.NodeList = NodeList;
  12594. return dojo.NodeList;
  12595. });
  12596. },
  12597. 'dojo/_base/Color':function(){
  12598. define(["./kernel", "./lang", "./array", "./config"], function(dojo, lang, ArrayUtil, config){
  12599. var Color = dojo.Color = function(/*Array|String|Object*/ color){
  12600. // summary:
  12601. // Takes a named string, hex string, array of rgb or rgba values,
  12602. // an object with r, g, b, and a properties, or another `dojo.Color` object
  12603. // and creates a new Color instance to work from.
  12604. //
  12605. // example:
  12606. // Work with a Color instance:
  12607. // | var c = new dojo.Color();
  12608. // | c.setColor([0,0,0]); // black
  12609. // | var hex = c.toHex(); // #000000
  12610. //
  12611. // example:
  12612. // Work with a node's color:
  12613. // | var color = dojo.style("someNode", "backgroundColor");
  12614. // | var n = new dojo.Color(color);
  12615. // | // adjust the color some
  12616. // | n.r *= .5;
  12617. // | console.log(n.toString()); // rgb(128, 255, 255);
  12618. if(color){ this.setColor(color); }
  12619. };
  12620. /*=====
  12621. lang.mixin(dojo.Color,{
  12622. named:{
  12623. // summary: Dictionary list of all CSS named colors, by name. Values are 3-item arrays with corresponding RG and B values.
  12624. }
  12625. });
  12626. =====*/
  12627. // FIXME:
  12628. // there's got to be a more space-efficient way to encode or discover
  12629. // these!! Use hex?
  12630. Color.named = {
  12631. "black": [0,0,0],
  12632. "silver": [192,192,192],
  12633. "gray": [128,128,128],
  12634. "white": [255,255,255],
  12635. "maroon": [128,0,0],
  12636. "red": [255,0,0],
  12637. "purple": [128,0,128],
  12638. "fuchsia":[255,0,255],
  12639. "green": [0,128,0],
  12640. "lime": [0,255,0],
  12641. "olive": [128,128,0],
  12642. "yellow": [255,255,0],
  12643. "navy": [0,0,128],
  12644. "blue": [0,0,255],
  12645. "teal": [0,128,128],
  12646. "aqua": [0,255,255],
  12647. "transparent": config.transparentColor || [0,0,0,0]
  12648. };
  12649. lang.extend(Color, {
  12650. r: 255, g: 255, b: 255, a: 1,
  12651. _set: function(r, g, b, a){
  12652. var t = this; t.r = r; t.g = g; t.b = b; t.a = a;
  12653. },
  12654. setColor: function(/*Array|String|Object*/ color){
  12655. // summary:
  12656. // Takes a named string, hex string, array of rgb or rgba values,
  12657. // an object with r, g, b, and a properties, or another `dojo.Color` object
  12658. // and sets this color instance to that value.
  12659. //
  12660. // example:
  12661. // | var c = new dojo.Color(); // no color
  12662. // | c.setColor("#ededed"); // greyish
  12663. if(lang.isString(color)){
  12664. Color.fromString(color, this);
  12665. }else if(lang.isArray(color)){
  12666. Color.fromArray(color, this);
  12667. }else{
  12668. this._set(color.r, color.g, color.b, color.a);
  12669. if(!(color instanceof Color)){ this.sanitize(); }
  12670. }
  12671. return this; // dojo.Color
  12672. },
  12673. sanitize: function(){
  12674. // summary:
  12675. // Ensures the object has correct attributes
  12676. // description:
  12677. // the default implementation does nothing, include dojo.colors to
  12678. // augment it with real checks
  12679. return this; // dojo.Color
  12680. },
  12681. toRgb: function(){
  12682. // summary:
  12683. // Returns 3 component array of rgb values
  12684. // example:
  12685. // | var c = new dojo.Color("#000000");
  12686. // | console.log(c.toRgb()); // [0,0,0]
  12687. var t = this;
  12688. return [t.r, t.g, t.b]; // Array
  12689. },
  12690. toRgba: function(){
  12691. // summary:
  12692. // Returns a 4 component array of rgba values from the color
  12693. // represented by this object.
  12694. var t = this;
  12695. return [t.r, t.g, t.b, t.a]; // Array
  12696. },
  12697. toHex: function(){
  12698. // summary:
  12699. // Returns a CSS color string in hexadecimal representation
  12700. // example:
  12701. // | console.log(new dojo.Color([0,0,0]).toHex()); // #000000
  12702. var arr = ArrayUtil.map(["r", "g", "b"], function(x){
  12703. var s = this[x].toString(16);
  12704. return s.length < 2 ? "0" + s : s;
  12705. }, this);
  12706. return "#" + arr.join(""); // String
  12707. },
  12708. toCss: function(/*Boolean?*/ includeAlpha){
  12709. // summary:
  12710. // Returns a css color string in rgb(a) representation
  12711. // example:
  12712. // | var c = new dojo.Color("#FFF").toCss();
  12713. // | console.log(c); // rgb('255','255','255')
  12714. var t = this, rgb = t.r + ", " + t.g + ", " + t.b;
  12715. return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")"; // String
  12716. },
  12717. toString: function(){
  12718. // summary:
  12719. // Returns a visual representation of the color
  12720. return this.toCss(true); // String
  12721. }
  12722. });
  12723. Color.blendColors = dojo.blendColors = function(
  12724. /*dojo.Color*/ start,
  12725. /*dojo.Color*/ end,
  12726. /*Number*/ weight,
  12727. /*dojo.Color?*/ obj
  12728. ){
  12729. // summary:
  12730. // Blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend,
  12731. // can reuse a previously allocated dojo.Color object for the result
  12732. var t = obj || new Color();
  12733. ArrayUtil.forEach(["r", "g", "b", "a"], function(x){
  12734. t[x] = start[x] + (end[x] - start[x]) * weight;
  12735. if(x != "a"){ t[x] = Math.round(t[x]); }
  12736. });
  12737. return t.sanitize(); // dojo.Color
  12738. };
  12739. Color.fromRgb = dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
  12740. // summary:
  12741. // Returns a `dojo.Color` instance from a string of the form
  12742. // "rgb(...)" or "rgba(...)". Optionally accepts a `dojo.Color`
  12743. // object to update with the parsed value and return instead of
  12744. // creating a new object.
  12745. // returns:
  12746. // A dojo.Color object. If obj is passed, it will be the return value.
  12747. var m = color.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);
  12748. return m && Color.fromArray(m[1].split(/\s*,\s*/), obj); // dojo.Color
  12749. };
  12750. Color.fromHex = dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){
  12751. // summary:
  12752. // Converts a hex string with a '#' prefix to a color object.
  12753. // Supports 12-bit #rgb shorthand. Optionally accepts a
  12754. // `dojo.Color` object to update with the parsed value.
  12755. //
  12756. // returns:
  12757. // A dojo.Color object. If obj is passed, it will be the return value.
  12758. //
  12759. // example:
  12760. // | var thing = dojo.colorFromHex("#ededed"); // grey, longhand
  12761. //
  12762. // example:
  12763. // | var thing = dojo.colorFromHex("#000"); // black, shorthand
  12764. var t = obj || new Color(),
  12765. bits = (color.length == 4) ? 4 : 8,
  12766. mask = (1 << bits) - 1;
  12767. color = Number("0x" + color.substr(1));
  12768. if(isNaN(color)){
  12769. return null; // dojo.Color
  12770. }
  12771. ArrayUtil.forEach(["b", "g", "r"], function(x){
  12772. var c = color & mask;
  12773. color >>= bits;
  12774. t[x] = bits == 4 ? 17 * c : c;
  12775. });
  12776. t.a = 1;
  12777. return t; // dojo.Color
  12778. };
  12779. Color.fromArray = dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){
  12780. // summary:
  12781. // Builds a `dojo.Color` from a 3 or 4 element array, mapping each
  12782. // element in sequence to the rgb(a) values of the color.
  12783. // example:
  12784. // | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
  12785. // returns:
  12786. // A dojo.Color object. If obj is passed, it will be the return value.
  12787. var t = obj || new Color();
  12788. t._set(Number(a[0]), Number(a[1]), Number(a[2]), Number(a[3]));
  12789. if(isNaN(t.a)){ t.a = 1; }
  12790. return t.sanitize(); // dojo.Color
  12791. };
  12792. Color.fromString = dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){
  12793. // summary:
  12794. // Parses `str` for a color value. Accepts hex, rgb, and rgba
  12795. // style color values.
  12796. // description:
  12797. // Acceptable input values for str may include arrays of any form
  12798. // accepted by dojo.colorFromArray, hex strings such as "#aaaaaa", or
  12799. // rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10,
  12800. // 10, 50)"
  12801. // returns:
  12802. // A dojo.Color object. If obj is passed, it will be the return value.
  12803. var a = Color.named[str];
  12804. return a && Color.fromArray(a, obj) || Color.fromRgb(str, obj) || Color.fromHex(str, obj); // dojo.Color
  12805. };
  12806. return Color;
  12807. });
  12808. },
  12809. 'dojo/selector/_loader':function(){
  12810. define(["../has", "require"],
  12811. function(has, require){
  12812. // summary:
  12813. // This module handles loading the appropriate selector engine for the given browser
  12814. "use strict";
  12815. var testDiv = document.createElement("div");
  12816. has.add("dom-qsa2.1", !!testDiv.querySelectorAll);
  12817. has.add("dom-qsa3", function(){
  12818. // test to see if we have a reasonable native selector engine available
  12819. try{
  12820. testDiv.innerHTML = "<p class='TEST'></p>"; // test kind of from sizzle
  12821. // Safari can't handle uppercase or unicode characters when
  12822. // in quirks mode, IE8 can't handle pseudos like :empty
  12823. return testDiv.querySelectorAll(".TEST:empty").length == 1;
  12824. }catch(e){}
  12825. });
  12826. var fullEngine;
  12827. var acme = "./acme", lite = "./lite";
  12828. return {
  12829. load: function(id, parentRequire, loaded, config){
  12830. var req = require;
  12831. // here we implement the default logic for choosing a selector engine
  12832. id = id == "default" ? has("config-selectorEngine") || "css3" : id;
  12833. id = id == "css2" || id == "lite" ? lite :
  12834. id == "css2.1" ? has("dom-qsa2.1") ? lite : acme :
  12835. id == "css3" ? has("dom-qsa3") ? lite : acme :
  12836. id == "acme" ? acme : (req = parentRequire) && id;
  12837. if(id.charAt(id.length-1) == '?'){
  12838. id = id.substring(0,id.length - 1);
  12839. var optionalLoad = true;
  12840. }
  12841. // the query engine is optional, only load it if a native one is not available or existing one has not been loaded
  12842. if(optionalLoad && (has("dom-compliant-qsa") || fullEngine)){
  12843. return loaded(fullEngine);
  12844. }
  12845. // load the referenced selector engine
  12846. req([id], function(engine){
  12847. if(id != "./lite"){
  12848. fullEngine = engine;
  12849. }
  12850. loaded(engine);
  12851. });
  12852. }
  12853. };
  12854. });
  12855. },
  12856. 'dojo/on':function(){
  12857. define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], function(aspect, dojo, has){
  12858. // summary:
  12859. // The export of this module is a function that provides core event listening functionality. With this function
  12860. // you can provide a target, event type, and listener to be notified of
  12861. // future matching events that are fired.
  12862. // target: Element|Object
  12863. // This is the target object or DOM element that to receive events from
  12864. // type: String|Function
  12865. // This is the name of the event to listen for or an extension event type.
  12866. // listener: Function
  12867. // This is the function that should be called when the event fires.
  12868. // returns: Object
  12869. // An object with a remove() method that can be used to stop listening for this
  12870. // event.
  12871. // description:
  12872. // To listen for "click" events on a button node, we can do:
  12873. // | define(["dojo/on"], function(listen){
  12874. // | on(button, "click", clickHandler);
  12875. // | ...
  12876. // Evented JavaScript objects can also have their own events.
  12877. // | var obj = new Evented;
  12878. // | on(obj, "foo", fooHandler);
  12879. // And then we could publish a "foo" event:
  12880. // | on.emit(obj, "foo", {key: "value"});
  12881. // We can use extension events as well. For example, you could listen for a tap gesture:
  12882. // | define(["dojo/on", "dojo/gesture/tap", function(listen, tap){
  12883. // | on(button, tap, tapHandler);
  12884. // | ...
  12885. // which would trigger fooHandler. Note that for a simple object this is equivalent to calling:
  12886. // | obj.onfoo({key:"value"});
  12887. // If you use on.emit on a DOM node, it will use native event dispatching when possible.
  12888. "use strict";
  12889. if(1){ // check to make sure we are in a browser, this module should work anywhere
  12890. var major = window.ScriptEngineMajorVersion;
  12891. has.add("jscript", major && (major() + ScriptEngineMinorVersion() / 10));
  12892. has.add("event-orientationchange", has("touch") && !has("android")); // TODO: how do we detect this?
  12893. has.add("event-focusin", function(global, doc, element){
  12894. return 'onfocusin' in element;
  12895. });
  12896. if(has("touch")){
  12897. has.add("touch-can-modify-event-delegate", function(){
  12898. // This feature test checks whether deleting a property of an event delegate works
  12899. // for a touch-enabled device. If it works, event delegation can be used as fallback
  12900. // for browsers such as Safari in older iOS where deleting properties of the original
  12901. // event does not work.
  12902. var EventDelegate = function(){};
  12903. EventDelegate.prototype =
  12904. document.createEvent("MouseEvents"); // original event
  12905. // Attempt to modify a property of an event delegate and check if
  12906. // it succeeds. Depending on browsers and on whether dojo/on's
  12907. // strict mode is stripped in a Dojo build, there are 3 known behaviors:
  12908. // it may either succeed, or raise an error, or fail to set the property
  12909. // without raising an error.
  12910. try{
  12911. var eventDelegate = new EventDelegate;
  12912. eventDelegate.target = null;
  12913. return eventDelegate.target === null;
  12914. }catch(e){
  12915. return false; // cannot use event delegation
  12916. }
  12917. });
  12918. }
  12919. }
  12920. var on = function(target, type, listener, dontFix){
  12921. if(typeof target.on == "function" && typeof type != "function" && !target.nodeType){
  12922. // delegate to the target's on() method, so it can handle it's own listening if it wants
  12923. return target.on(type, listener);
  12924. }
  12925. // delegate to main listener code
  12926. return on.parse(target, type, listener, addListener, dontFix, this);
  12927. };
  12928. on.pausable = function(target, type, listener, dontFix){
  12929. // summary:
  12930. // This function acts the same as on(), but with pausable functionality. The
  12931. // returned signal object has pause() and resume() functions. Calling the
  12932. // pause() method will cause the listener to not be called for future events. Calling the
  12933. // resume() method will cause the listener to again be called for future events.
  12934. var paused;
  12935. var signal = on(target, type, function(){
  12936. if(!paused){
  12937. return listener.apply(this, arguments);
  12938. }
  12939. }, dontFix);
  12940. signal.pause = function(){
  12941. paused = true;
  12942. };
  12943. signal.resume = function(){
  12944. paused = false;
  12945. };
  12946. return signal;
  12947. };
  12948. on.once = function(target, type, listener, dontFix){
  12949. // summary:
  12950. // This function acts the same as on(), but will only call the listener once. The
  12951. // listener will be called for the first
  12952. // event that takes place and then listener will automatically be removed.
  12953. var signal = on(target, type, function(){
  12954. // remove this listener
  12955. signal.remove();
  12956. // proceed to call the listener
  12957. return listener.apply(this, arguments);
  12958. });
  12959. return signal;
  12960. };
  12961. on.parse = function(target, type, listener, addListener, dontFix, matchesTarget){
  12962. if(type.call){
  12963. // event handler function
  12964. // on(node, dojo.touch.press, touchListener);
  12965. return type.call(matchesTarget, target, listener);
  12966. }
  12967. if(type.indexOf(",") > -1){
  12968. // we allow comma delimited event names, so you can register for multiple events at once
  12969. var events = type.split(/\s*,\s*/);
  12970. var handles = [];
  12971. var i = 0;
  12972. var eventName;
  12973. while(eventName = events[i++]){
  12974. handles.push(addListener(target, eventName, listener, dontFix, matchesTarget));
  12975. }
  12976. handles.remove = function(){
  12977. for(var i = 0; i < handles.length; i++){
  12978. handles[i].remove();
  12979. }
  12980. };
  12981. return handles;
  12982. }
  12983. return addListener(target, type, listener, dontFix, matchesTarget)
  12984. };
  12985. var touchEvents = /^touch/;
  12986. function addListener(target, type, listener, dontFix, matchesTarget){
  12987. // event delegation:
  12988. var selector = type.match(/(.*):(.*)/);
  12989. // if we have a selector:event, the last one is interpreted as an event, and we use event delegation
  12990. if(selector){
  12991. type = selector[2];
  12992. selector = selector[1];
  12993. // create the extension event for selectors and directly call it
  12994. return on.selector(selector, type).call(matchesTarget, target, listener);
  12995. }
  12996. // test to see if it a touch event right now, so we don't have to do it every time it fires
  12997. if(has("touch")){
  12998. if(touchEvents.test(type)){
  12999. // touch event, fix it
  13000. listener = fixTouchListener(listener);
  13001. }
  13002. if(!has("event-orientationchange") && (type == "orientationchange")){
  13003. //"orientationchange" not supported <= Android 2.1,
  13004. //but works through "resize" on window
  13005. type = "resize";
  13006. target = window;
  13007. listener = fixTouchListener(listener);
  13008. }
  13009. }
  13010. // normal path, the target is |this|
  13011. if(target.addEventListener){
  13012. // 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)
  13013. // check for capture conversions
  13014. var capture = type in captures;
  13015. target.addEventListener(capture ? captures[type] : type, listener, capture);
  13016. // create and return the signal
  13017. return {
  13018. remove: function(){
  13019. target.removeEventListener(type, listener, capture);
  13020. }
  13021. };
  13022. }
  13023. type = "on" + type;
  13024. if(fixAttach && target.attachEvent){
  13025. return fixAttach(target, type, listener);
  13026. }
  13027. throw new Error("Target must be an event emitter");
  13028. }
  13029. on.selector = function(selector, eventType, children){
  13030. // summary:
  13031. // Creates a new extension event with event delegation. This is based on
  13032. // the provided event type (can be extension event) that
  13033. // only calls the listener when the CSS selector matches the target of the event.
  13034. // selector:
  13035. // The CSS selector to use for filter events and determine the |this| of the event listener.
  13036. // eventType:
  13037. // The event to listen for
  13038. // children:
  13039. // Indicates if children elements of the selector should be allowed. This defaults to
  13040. // true (except in the case of normally non-bubbling events like mouse.enter, in which case it defaults to false).
  13041. // example:
  13042. // define(["dojo/on", "dojo/mouse"], function(listen, mouse){
  13043. // on(node, on.selector(".my-class", mouse.enter), handlerForMyHover);
  13044. return function(target, listener){
  13045. var matchesTarget = this;
  13046. var bubble = eventType.bubble;
  13047. if(bubble){
  13048. // the event type doesn't naturally bubble, but has a bubbling form, use that
  13049. eventType = bubble;
  13050. }else if(children !== false){
  13051. // for normal bubbling events we default to allowing children of the selector
  13052. children = true;
  13053. }
  13054. return on(target, eventType, function(event){
  13055. var eventTarget = event.target;
  13056. // see if we have a valid matchesTarget or default to dojo.query
  13057. matchesTarget = matchesTarget && matchesTarget.matches ? matchesTarget : dojo.query;
  13058. // there is a selector, so make sure it matches
  13059. while(!matchesTarget.matches(eventTarget, selector, target)){
  13060. if(eventTarget == target || !children || !(eventTarget = eventTarget.parentNode)){ // intentional assignment
  13061. return;
  13062. }
  13063. }
  13064. return listener.call(eventTarget, event);
  13065. });
  13066. };
  13067. };
  13068. function syntheticPreventDefault(){
  13069. this.cancelable = false;
  13070. }
  13071. function syntheticStopPropagation(){
  13072. this.bubbles = false;
  13073. }
  13074. var slice = [].slice,
  13075. syntheticDispatch = on.emit = function(target, type, event){
  13076. // summary:
  13077. // Fires an event on the target object.
  13078. // target:
  13079. // The target object to fire the event on. This can be a DOM element or a plain
  13080. // JS object. If the target is a DOM element, native event emiting mechanisms
  13081. // are used when possible.
  13082. // type:
  13083. // The event type name. You can emulate standard native events like "click" and
  13084. // "mouseover" or create custom events like "open" or "finish".
  13085. // event:
  13086. // An object that provides the properties for the event. See https://developer.mozilla.org/en/DOM/event.initEvent
  13087. // for some of the properties. These properties are copied to the event object.
  13088. // Of particular importance are the cancelable and bubbles properties. The
  13089. // cancelable property indicates whether or not the event has a default action
  13090. // that can be cancelled. The event is cancelled by calling preventDefault() on
  13091. // the event object. The bubbles property indicates whether or not the
  13092. // event will bubble up the DOM tree. If bubbles is true, the event will be called
  13093. // on the target and then each parent successively until the top of the tree
  13094. // is reached or stopPropagation() is called. Both bubbles and cancelable
  13095. // default to false.
  13096. // returns:
  13097. // If the event is cancelable and the event is not cancelled,
  13098. // emit will return true. If the event is cancelable and the event is cancelled,
  13099. // emit will return false.
  13100. // details:
  13101. // Note that this is designed to emit events for listeners registered through
  13102. // dojo/on. It should actually work with any event listener except those
  13103. // added through IE's attachEvent (IE8 and below's non-W3C event emiting
  13104. // doesn't support custom event types). It should work with all events registered
  13105. // through dojo/on. Also note that the emit method does do any default
  13106. // action, it only returns a value to indicate if the default action should take
  13107. // place. For example, emiting a keypress event would not cause a character
  13108. // to appear in a textbox.
  13109. // example:
  13110. // To fire our own click event
  13111. // | on.emit(dojo.byId("button"), "click", {
  13112. // | cancelable: true,
  13113. // | bubbles: true,
  13114. // | screenX: 33,
  13115. // | screenY: 44
  13116. // | });
  13117. // We can also fire our own custom events:
  13118. // | on.emit(dojo.byId("slider"), "slide", {
  13119. // | cancelable: true,
  13120. // | bubbles: true,
  13121. // | direction: "left-to-right"
  13122. // | });
  13123. var args = slice.call(arguments, 2);
  13124. var method = "on" + type;
  13125. if("parentNode" in target){
  13126. // node (or node-like), create event controller methods
  13127. var newEvent = args[0] = {};
  13128. for(var i in event){
  13129. newEvent[i] = event[i];
  13130. }
  13131. newEvent.preventDefault = syntheticPreventDefault;
  13132. newEvent.stopPropagation = syntheticStopPropagation;
  13133. newEvent.target = target;
  13134. newEvent.type = type;
  13135. event = newEvent;
  13136. }
  13137. do{
  13138. // 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)
  13139. target[method] && target[method].apply(target, args);
  13140. // and then continue up the parent node chain if it is still bubbling (if started as bubbles and stopPropagation hasn't been called)
  13141. }while(event && event.bubbles && (target = target.parentNode));
  13142. return event && event.cancelable && event; // if it is still true (was cancelable and was cancelled), return the event to indicate default action should happen
  13143. };
  13144. var captures = has("event-focusin") ? {} : {focusin: "focus", focusout: "blur"};
  13145. if(has("dom-addeventlistener")){
  13146. if(has("opera")){
  13147. 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)
  13148. }
  13149. // emiter that works with native event handling
  13150. on.emit = function(target, type, event){
  13151. if(target.dispatchEvent && document.createEvent){
  13152. // use the native event emiting mechanism if it is available on the target object
  13153. // create a generic event
  13154. // we could create branch into the different types of event constructors, but
  13155. // that would be a lot of extra code, with little benefit that I can see, seems
  13156. // best to use the generic constructor and copy properties over, making it
  13157. // easy to have events look like the ones created with specific initializers
  13158. var ownerDocument = target.ownerDocument || document;
  13159. var nativeEvent = ownerDocument.createEvent("HTMLEvents");
  13160. nativeEvent.initEvent(type, !!event.bubbles, !!event.cancelable);
  13161. // and copy all our properties over
  13162. for(var i in event){
  13163. var value = event[i];
  13164. if(!(i in nativeEvent)){
  13165. nativeEvent[i] = event[i];
  13166. }
  13167. }
  13168. return target.dispatchEvent(nativeEvent) && nativeEvent;
  13169. }
  13170. return syntheticDispatch.apply(on, arguments); // emit for a non-node
  13171. };
  13172. }else{
  13173. // no addEventListener, basically old IE event normalization
  13174. on._fixEvent = function(evt, sender){
  13175. // summary:
  13176. // normalizes properties on the event object including event
  13177. // bubbling methods, keystroke normalization, and x/y positions
  13178. // evt:
  13179. // native event object
  13180. // sender:
  13181. // node to treat as "currentTarget"
  13182. if(!evt){
  13183. var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
  13184. evt = w.event;
  13185. }
  13186. if(!evt){return(evt);}
  13187. if(!evt.target){ // check to see if it has been fixed yet
  13188. evt.target = evt.srcElement;
  13189. evt.currentTarget = (sender || evt.srcElement);
  13190. if(evt.type == "mouseover"){
  13191. evt.relatedTarget = evt.fromElement;
  13192. }
  13193. if(evt.type == "mouseout"){
  13194. evt.relatedTarget = evt.toElement;
  13195. }
  13196. if(!evt.stopPropagation){
  13197. evt.stopPropagation = stopPropagation;
  13198. evt.preventDefault = preventDefault;
  13199. }
  13200. switch(evt.type){
  13201. case "keypress":
  13202. var c = ("charCode" in evt ? evt.charCode : evt.keyCode);
  13203. if (c==10){
  13204. // CTRL-ENTER is CTRL-ASCII(10) on IE, but CTRL-ENTER on Mozilla
  13205. c=0;
  13206. evt.keyCode = 13;
  13207. }else if(c==13||c==27){
  13208. c=0; // Mozilla considers ENTER and ESC non-printable
  13209. }else if(c==3){
  13210. c=99; // Mozilla maps CTRL-BREAK to CTRL-c
  13211. }
  13212. // Mozilla sets keyCode to 0 when there is a charCode
  13213. // but that stops the event on IE.
  13214. evt.charCode = c;
  13215. _setKeyChar(evt);
  13216. break;
  13217. }
  13218. }
  13219. return evt;
  13220. };
  13221. var IESignal = function(handle){
  13222. this.handle = handle;
  13223. };
  13224. IESignal.prototype.remove = function(){
  13225. delete _dojoIEListeners_[this.handle];
  13226. };
  13227. var fixListener = function(listener){
  13228. // this is a minimal function for closing on the previous listener with as few as variables as possible
  13229. return function(evt){
  13230. evt = on._fixEvent(evt, this);
  13231. return listener.call(this, evt);
  13232. }
  13233. }
  13234. var fixAttach = function(target, type, listener){
  13235. listener = fixListener(listener);
  13236. if(((target.ownerDocument ? target.ownerDocument.parentWindow : target.parentWindow || target.window || window) != top ||
  13237. has("jscript") < 5.8) &&
  13238. !has("config-_allow_leaks")){
  13239. // IE will leak memory on certain handlers in frames (IE8 and earlier) and in unattached DOM nodes for JScript 5.7 and below.
  13240. // Here we use global redirection to solve the memory leaks
  13241. if(typeof _dojoIEListeners_ == "undefined"){
  13242. _dojoIEListeners_ = [];
  13243. }
  13244. var emiter = target[type];
  13245. if(!emiter || !emiter.listeners){
  13246. var oldListener = emiter;
  13247. target[type] = 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);}}');
  13248. emiter.listeners = [];
  13249. emiter.global = this;
  13250. if(oldListener){
  13251. emiter.listeners.push(_dojoIEListeners_.push(oldListener) - 1);
  13252. }
  13253. }
  13254. var handle;
  13255. emiter.listeners.push(handle = (emiter.global._dojoIEListeners_.push(listener) - 1));
  13256. return new IESignal(handle);
  13257. }
  13258. return aspect.after(target, type, listener, true);
  13259. };
  13260. var _setKeyChar = function(evt){
  13261. evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
  13262. evt.charOrCode = evt.keyChar || evt.keyCode;
  13263. };
  13264. // Called in Event scope
  13265. var stopPropagation = function(){
  13266. this.cancelBubble = true;
  13267. };
  13268. var preventDefault = on._preventDefault = function(){
  13269. // Setting keyCode to 0 is the only way to prevent certain keypresses (namely
  13270. // ctrl-combinations that correspond to menu accelerator keys).
  13271. // Otoh, it prevents upstream listeners from getting this information
  13272. // Try to split the difference here by clobbering keyCode only for ctrl
  13273. // combinations. If you still need to access the key upstream, bubbledKeyCode is
  13274. // provided as a workaround.
  13275. this.bubbledKeyCode = this.keyCode;
  13276. if(this.ctrlKey){
  13277. try{
  13278. // squelch errors when keyCode is read-only
  13279. // (e.g. if keyCode is ctrl or shift)
  13280. this.keyCode = 0;
  13281. }catch(e){
  13282. }
  13283. }
  13284. this.returnValue = false;
  13285. };
  13286. }
  13287. if(has("touch")){
  13288. var EventDelegate = function (){};
  13289. var windowOrientation = window.orientation;
  13290. var fixTouchListener = function(listener){
  13291. return function(originalEvent){
  13292. //Event normalization(for ontouchxxx and resize):
  13293. //1.incorrect e.pageX|pageY in iOS
  13294. //2.there are no "e.rotation", "e.scale" and "onorientationchange" in Andriod
  13295. //3.More TBD e.g. force | screenX | screenX | clientX | clientY | radiusX | radiusY
  13296. // see if it has already been corrected
  13297. var event = originalEvent.corrected;
  13298. if(!event){
  13299. var type = originalEvent.type;
  13300. try{
  13301. delete originalEvent.type; // on some JS engines (android), deleting properties make them mutable
  13302. }catch(e){}
  13303. if(originalEvent.type){
  13304. // Deleting the property of the original event did not work (this is the case of
  13305. // browsers such as older Safari iOS), hence fallback:
  13306. if(has("touch-can-modify-event-delegate")){
  13307. // If deleting properties of delegated event works, use event delegation:
  13308. EventDelegate.prototype = originalEvent;
  13309. event = new EventDelegate;
  13310. }else{
  13311. // Otherwise last fallback: other browsers, such as mobile Firefox, do not like
  13312. // delegated properties, so we have to copy
  13313. event = {};
  13314. for(var name in originalEvent){
  13315. event[name] = originalEvent[name];
  13316. }
  13317. }
  13318. // have to delegate methods to make them work
  13319. event.preventDefault = function(){
  13320. originalEvent.preventDefault();
  13321. };
  13322. event.stopPropagation = function(){
  13323. originalEvent.stopPropagation();
  13324. };
  13325. }else{
  13326. // deletion worked, use property as is
  13327. event = originalEvent;
  13328. event.type = type;
  13329. }
  13330. originalEvent.corrected = event;
  13331. if(type == 'resize'){
  13332. if(windowOrientation == window.orientation){
  13333. return null;//double tap causes an unexpected 'resize' in Andriod
  13334. }
  13335. windowOrientation = window.orientation;
  13336. event.type = "orientationchange";
  13337. return listener.call(this, event);
  13338. }
  13339. // We use the original event and augment, rather than doing an expensive mixin operation
  13340. if(!("rotation" in event)){ // test to see if it has rotation
  13341. event.rotation = 0;
  13342. event.scale = 1;
  13343. }
  13344. //use event.changedTouches[0].pageX|pageY|screenX|screenY|clientX|clientY|target
  13345. var firstChangeTouch = event.changedTouches[0];
  13346. for(var i in firstChangeTouch){ // use for-in, we don't need to have dependency on dojo/_base/lang here
  13347. delete event[i]; // delete it first to make it mutable
  13348. event[i] = firstChangeTouch[i];
  13349. }
  13350. }
  13351. return listener.call(this, event);
  13352. };
  13353. };
  13354. }
  13355. return on;
  13356. });
  13357. },
  13358. 'dojo/_base/sniff':function(){
  13359. define(["./kernel", "../has"], function(dojo, has){
  13360. // module:
  13361. // dojo/sniff
  13362. // summary:
  13363. // This module populates the dojo browser version sniffing properties.
  13364. if(!1){
  13365. return has;
  13366. }
  13367. dojo.isBrowser = true,
  13368. dojo._name = "browser";
  13369. var hasAdd = has.add,
  13370. n = navigator,
  13371. dua = n.userAgent,
  13372. dav = n.appVersion,
  13373. tv = parseFloat(dav),
  13374. isOpera,
  13375. isAIR,
  13376. isKhtml,
  13377. isWebKit,
  13378. isChrome,
  13379. isMac,
  13380. isSafari,
  13381. isMozilla ,
  13382. isMoz,
  13383. isIE,
  13384. isFF,
  13385. isQuirks,
  13386. isIos,
  13387. isAndroid,
  13388. isWii;
  13389. /*=====
  13390. dojo.isBrowser = {
  13391. // example:
  13392. // | if(dojo.isBrowser){ ... }
  13393. };
  13394. dojo.isFF = {
  13395. // example:
  13396. // | if(dojo.isFF > 1){ ... }
  13397. };
  13398. dojo.isIE = {
  13399. // example:
  13400. // | if(dojo.isIE > 6){
  13401. // | // we are IE7
  13402. // | }
  13403. };
  13404. dojo.isSafari = {
  13405. // example:
  13406. // | if(dojo.isSafari){ ... }
  13407. // example:
  13408. // Detect iPhone:
  13409. // | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
  13410. // | // we are iPhone. Note, iPod touch reports "iPod" above and fails this test.
  13411. // | }
  13412. };
  13413. dojo.mixin(dojo, {
  13414. // isBrowser: Boolean
  13415. // True if the client is a web-browser
  13416. isBrowser: true,
  13417. // isFF: Number | undefined
  13418. // Version as a Number if client is FireFox. undefined otherwise. Corresponds to
  13419. // major detected FireFox version (1.5, 2, 3, etc.)
  13420. isFF: 2,
  13421. // isIE: Number | undefined
  13422. // Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to
  13423. // major detected IE version (6, 7, 8, etc.)
  13424. isIE: 6,
  13425. // isKhtml: Number | undefined
  13426. // Version as a Number if client is a KHTML browser. undefined otherwise. Corresponds to major
  13427. // detected version.
  13428. isKhtml: 0,
  13429. // isWebKit: Number | undefined
  13430. // Version as a Number if client is a WebKit-derived browser (Konqueror,
  13431. // Safari, Chrome, etc.). undefined otherwise.
  13432. isWebKit: 0,
  13433. // isMozilla: Number | undefined
  13434. // Version as a Number if client is a Mozilla-based browser (Firefox,
  13435. // SeaMonkey). undefined otherwise. Corresponds to major detected version.
  13436. isMozilla: 0,
  13437. // isOpera: Number | undefined
  13438. // Version as a Number if client is Opera. undefined otherwise. Corresponds to
  13439. // major detected version.
  13440. isOpera: 0,
  13441. // isSafari: Number | undefined
  13442. // Version as a Number if client is Safari or iPhone. undefined otherwise.
  13443. isSafari: 0,
  13444. // isChrome: Number | undefined
  13445. // Version as a Number if client is Chrome browser. undefined otherwise.
  13446. isChrome: 0,
  13447. // isMac: Boolean
  13448. // True if the client runs on Mac
  13449. isMac: 0,
  13450. // isIos: Boolean
  13451. // True if client is iPhone, iPod, or iPad
  13452. isIos: 0,
  13453. // isAndroid: Number | undefined
  13454. // Version as a Number if client is android browser. undefined otherwise.
  13455. isAndroid: 0,
  13456. // isWii: Boolean
  13457. // True if client is Wii
  13458. isWii: 0
  13459. });
  13460. =====*/
  13461. // fill in the rendering support information in dojo.render.*
  13462. if(dua.indexOf("AdobeAIR") >= 0){ isAIR = 1; }
  13463. isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
  13464. isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
  13465. isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
  13466. isMac = dav.indexOf("Macintosh") >= 0;
  13467. isIos = /iPhone|iPod|iPad/.test(dua);
  13468. isAndroid = parseFloat(dua.split("Android ")[1]) || undefined;
  13469. isWii = typeof opera != "undefined" && opera.wiiremote;
  13470. isTrident = parseFloat(dav.split("Trident/")[1]) || undefined;
  13471. // safari detection derived from:
  13472. // http://developer.apple.com/internet/safari/faq.html#anchor2
  13473. // http://developer.apple.com/internet/safari/uamatrix.html
  13474. var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
  13475. if(index && !isChrome){
  13476. // try to grab the explicit Safari version first. If we don't get
  13477. // one, look for less than 419.3 as the indication that we're on something
  13478. // "Safari 2-ish".
  13479. isSafari = parseFloat(dav.split("Version/")[1]);
  13480. if(!isSafari || parseFloat(dav.substr(index + 7)) <= 419.3){
  13481. isSafari = 2;
  13482. }
  13483. }
  13484. if (!has("dojo-webkit")) {
  13485. if(dua.indexOf("Opera") >= 0){
  13486. isOpera = tv;
  13487. // see http://dev.opera.com/articles/view/opera-ua-string-changes and http://www.useragentstring.com/pages/Opera/
  13488. // 9.8 has both styles; <9.8, 9.9 only old style
  13489. if(isOpera >= 9.8){
  13490. isOpera = parseFloat(dua.split("Version/")[1]) || tv;
  13491. }
  13492. }
  13493. if(dua.indexOf("Gecko") >= 0 && !isKhtml && !isWebKit && !isTrident){
  13494. isMozilla = isMoz = tv;
  13495. }
  13496. if(isMoz){
  13497. //We really need to get away from this. Consider a sane isGecko approach for the future.
  13498. isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined;
  13499. }
  13500. if(document.all && !isOpera){
  13501. isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
  13502. //In cases where the page has an HTTP header or META tag with
  13503. //X-UA-Compatible, then it is in emulation mode.
  13504. //Make sure isIE reflects the desired version.
  13505. //document.documentMode of 5 means quirks mode.
  13506. //Only switch the value if documentMode's major version
  13507. //is different from isIE's major version.
  13508. var mode = document.documentMode;
  13509. if(mode && mode != 5 && Math.floor(isIE) != mode){
  13510. isIE = mode;
  13511. }
  13512. }
  13513. }
  13514. isQuirks = document.compatMode == "BackCompat";
  13515. hasAdd("opera", dojo.isOpera = isOpera);
  13516. hasAdd("air", dojo.isAIR = isAIR);
  13517. hasAdd("khtml", dojo.isKhtml = isKhtml);
  13518. hasAdd("webkit", dojo.isWebKit = isWebKit);
  13519. hasAdd("chrome", dojo.isChrome = isChrome);
  13520. hasAdd("mac", dojo.isMac = isMac );
  13521. hasAdd("safari", dojo.isSafari = isSafari);
  13522. hasAdd("mozilla", dojo.isMozilla = dojo.isMoz = isMozilla );
  13523. hasAdd("ie", dojo.isIE = isIE );
  13524. hasAdd("ff", dojo.isFF = isFF);
  13525. hasAdd("quirks", dojo.isQuirks = isQuirks);
  13526. hasAdd("ios", dojo.isIos = isIos);
  13527. hasAdd("android", dojo.isAndroid = isAndroid);
  13528. hasAdd("trident", dojo.isTrident = isTrident);
  13529. dojo.locale = dojo.locale || (isIE ? n.userLanguage : n.language).toLowerCase();
  13530. return has;
  13531. });
  13532. },
  13533. 'dojo/_base/array':function(){
  13534. define(["./kernel", "../has", "./lang"], function(dojo, has, lang){
  13535. // module:
  13536. // dojo/_base/array
  13537. // summary:
  13538. // This module defines the Javascript v1.6 array extensions.
  13539. /*=====
  13540. dojo.indexOf = function(arr, value, fromIndex, findLast){
  13541. // summary:
  13542. // locates the first index of the provided value in the
  13543. // passed array. If the value is not found, -1 is returned.
  13544. // description:
  13545. // This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
  13546. // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
  13547. // 1.6's indexOf skips the holes in the sparse array.
  13548. // For details on this method, see:
  13549. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
  13550. // arr: Array
  13551. // value: Object
  13552. // fromIndex: Integer?
  13553. // findLast: Boolean?
  13554. // returns: Number
  13555. };
  13556. dojo.lastIndexOf = function(arr, value, fromIndex){
  13557. // summary:
  13558. // locates the last index of the provided value in the passed
  13559. // array. If the value is not found, -1 is returned.
  13560. // description:
  13561. // This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
  13562. // run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
  13563. // 1.6's lastIndexOf skips the holes in the sparse array.
  13564. // For details on this method, see:
  13565. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
  13566. // arr: Array,
  13567. // value: Object,
  13568. // fromIndex: Integer?
  13569. // returns: Number
  13570. };
  13571. dojo.forEach = function(arr, callback, thisObject){
  13572. // summary:
  13573. // for every item in arr, callback is invoked. Return values are ignored.
  13574. // If you want to break out of the loop, consider using dojo.every() or dojo.some().
  13575. // forEach does not allow breaking out of the loop over the items in arr.
  13576. // arr:
  13577. // the array to iterate over. If a string, operates on individual characters.
  13578. // callback:
  13579. // a function is invoked with three arguments: item, index, and array
  13580. // thisObject:
  13581. // may be used to scope the call to callback
  13582. // description:
  13583. // This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
  13584. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  13585. // the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
  13586. // For more details, see:
  13587. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach
  13588. // example:
  13589. // | // log out all members of the array:
  13590. // | dojo.forEach(
  13591. // | [ "thinger", "blah", "howdy", 10 ],
  13592. // | function(item){
  13593. // | console.log(item);
  13594. // | }
  13595. // | );
  13596. // example:
  13597. // | // log out the members and their indexes
  13598. // | dojo.forEach(
  13599. // | [ "thinger", "blah", "howdy", 10 ],
  13600. // | function(item, idx, arr){
  13601. // | console.log(item, "at index:", idx);
  13602. // | }
  13603. // | );
  13604. // example:
  13605. // | // use a scoped object member as the callback
  13606. // |
  13607. // | var obj = {
  13608. // | prefix: "logged via obj.callback:",
  13609. // | callback: function(item){
  13610. // | console.log(this.prefix, item);
  13611. // | }
  13612. // | };
  13613. // |
  13614. // | // specifying the scope function executes the callback in that scope
  13615. // | dojo.forEach(
  13616. // | [ "thinger", "blah", "howdy", 10 ],
  13617. // | obj.callback,
  13618. // | obj
  13619. // | );
  13620. // |
  13621. // | // alternately, we can accomplish the same thing with dojo.hitch()
  13622. // | dojo.forEach(
  13623. // | [ "thinger", "blah", "howdy", 10 ],
  13624. // | dojo.hitch(obj, "callback")
  13625. // | );
  13626. // arr: Array|String
  13627. // callback: Function|String
  13628. // thisObject: Object?
  13629. };
  13630. dojo.every = function(arr, callback, thisObject){
  13631. // summary:
  13632. // Determines whether or not every item in arr satisfies the
  13633. // condition implemented by callback.
  13634. // arr: Array|String
  13635. // the array to iterate on. If a string, operates on individual characters.
  13636. // callback: Function|String
  13637. // a function is invoked with three arguments: item, index,
  13638. // and array and returns true if the condition is met.
  13639. // thisObject: Object?
  13640. // may be used to scope the call to callback
  13641. // returns: Boolean
  13642. // description:
  13643. // This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
  13644. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  13645. // the callback function with a value of undefined. JavaScript 1.6's every skips the holes in the sparse array.
  13646. // For more details, see:
  13647. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/every
  13648. // example:
  13649. // | // returns false
  13650. // | dojo.every([1, 2, 3, 4], function(item){ return item>1; });
  13651. // example:
  13652. // | // returns true
  13653. // | dojo.every([1, 2, 3, 4], function(item){ return item>0; });
  13654. };
  13655. dojo.some = function(arr, callback, thisObject){
  13656. // summary:
  13657. // Determines whether or not any item in arr satisfies the
  13658. // condition implemented by callback.
  13659. // arr: Array|String
  13660. // the array to iterate over. If a string, operates on individual characters.
  13661. // callback: Function|String
  13662. // a function is invoked with three arguments: item, index,
  13663. // and array and returns true if the condition is met.
  13664. // thisObject: Object?
  13665. // may be used to scope the call to callback
  13666. // returns: Boolean
  13667. // description:
  13668. // This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
  13669. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  13670. // the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
  13671. // For more details, see:
  13672. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/some
  13673. // example:
  13674. // | // is true
  13675. // | dojo.some([1, 2, 3, 4], function(item){ return item>1; });
  13676. // example:
  13677. // | // is false
  13678. // | dojo.some([1, 2, 3, 4], function(item){ return item<1; });
  13679. };
  13680. dojo.map = function(arr, callback, thisObject){
  13681. // summary:
  13682. // applies callback to each element of arr and returns
  13683. // an Array with the results
  13684. // arr: Array|String
  13685. // the array to iterate on. If a string, operates on
  13686. // individual characters.
  13687. // callback: Function|String
  13688. // a function is invoked with three arguments, (item, index,
  13689. // array), and returns a value
  13690. // thisObject: Object?
  13691. // may be used to scope the call to callback
  13692. // returns: Array
  13693. // description:
  13694. // This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
  13695. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  13696. // the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
  13697. // For more details, see:
  13698. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
  13699. // example:
  13700. // | // returns [2, 3, 4, 5]
  13701. // | dojo.map([1, 2, 3, 4], function(item){ return item+1 });
  13702. };
  13703. dojo.filter = function(arr, callback, thisObject){
  13704. // summary:
  13705. // Returns a new Array with those items from arr that match the
  13706. // condition implemented by callback.
  13707. // arr: Array
  13708. // the array to iterate over.
  13709. // callback: Function|String
  13710. // a function that is invoked with three arguments (item,
  13711. // index, array). The return of this function is expected to
  13712. // be a boolean which determines whether the passed-in item
  13713. // will be included in the returned array.
  13714. // thisObject: Object?
  13715. // may be used to scope the call to callback
  13716. // returns: Array
  13717. // description:
  13718. // This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
  13719. // run over sparse arrays, this implementation passes the "holes" in the sparse array to
  13720. // the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
  13721. // For more details, see:
  13722. // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
  13723. // example:
  13724. // | // returns [2, 3, 4]
  13725. // | dojo.filter([1, 2, 3, 4], function(item){ return item>1; });
  13726. };
  13727. =====*/
  13728. // our old simple function builder stuff
  13729. var cache = {}, u, array; // the export object
  13730. function clearCache(){
  13731. cache = {};
  13732. }
  13733. function buildFn(fn){
  13734. return cache[fn] = new Function("item", "index", "array", fn); // Function
  13735. }
  13736. // magic snippet: if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  13737. // every & some
  13738. function everyOrSome(some){
  13739. var every = !some;
  13740. return function(a, fn, o){
  13741. var i = 0, l = a && a.length || 0, result;
  13742. if(l && typeof a == "string") a = a.split("");
  13743. if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  13744. if(o){
  13745. for(; i < l; ++i){
  13746. result = !fn.call(o, a[i], i, a);
  13747. if(some ^ result){
  13748. return !result;
  13749. }
  13750. }
  13751. }else{
  13752. for(; i < l; ++i){
  13753. result = !fn(a[i], i, a);
  13754. if(some ^ result){
  13755. return !result;
  13756. }
  13757. }
  13758. }
  13759. return every; // Boolean
  13760. }
  13761. }
  13762. // var every = everyOrSome(false), some = everyOrSome(true);
  13763. // indexOf, lastIndexOf
  13764. function index(up){
  13765. var delta = 1, lOver = 0, uOver = 0;
  13766. if(!up){
  13767. delta = lOver = uOver = -1;
  13768. }
  13769. return function(a, x, from, last){
  13770. if(last && delta > 0){
  13771. // TODO: why do we use a non-standard signature? why do we need "last"?
  13772. return array.lastIndexOf(a, x, from);
  13773. }
  13774. var l = a && a.length || 0, end = up ? l + uOver : lOver, i;
  13775. if(from === u){
  13776. i = up ? lOver : l + uOver;
  13777. }else{
  13778. if(from < 0){
  13779. i = l + from;
  13780. if(i < 0){
  13781. i = lOver;
  13782. }
  13783. }else{
  13784. i = from >= l ? l + uOver : from;
  13785. }
  13786. }
  13787. if(l && typeof a == "string") a = a.split("");
  13788. for(; i != end; i += delta){
  13789. if(a[i] == x){
  13790. return i; // Number
  13791. }
  13792. }
  13793. return -1; // Number
  13794. }
  13795. }
  13796. // var indexOf = index(true), lastIndexOf = index(false);
  13797. function forEach(a, fn, o){
  13798. var i = 0, l = a && a.length || 0;
  13799. if(l && typeof a == "string") a = a.split("");
  13800. if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  13801. if(o){
  13802. for(; i < l; ++i){
  13803. fn.call(o, a[i], i, a);
  13804. }
  13805. }else{
  13806. for(; i < l; ++i){
  13807. fn(a[i], i, a);
  13808. }
  13809. }
  13810. }
  13811. function map(a, fn, o, Ctr){
  13812. // TODO: why do we have a non-standard signature here? do we need "Ctr"?
  13813. var i = 0, l = a && a.length || 0, out = new (Ctr || Array)(l);
  13814. if(l && typeof a == "string") a = a.split("");
  13815. if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  13816. if(o){
  13817. for(; i < l; ++i){
  13818. out[i] = fn.call(o, a[i], i, a);
  13819. }
  13820. }else{
  13821. for(; i < l; ++i){
  13822. out[i] = fn(a[i], i, a);
  13823. }
  13824. }
  13825. return out; // Array
  13826. }
  13827. function filter(a, fn, o){
  13828. // TODO: do we need "Ctr" here like in map()?
  13829. var i = 0, l = a && a.length || 0, out = [], value;
  13830. if(l && typeof a == "string") a = a.split("");
  13831. if(typeof fn == "string") fn = cache[fn] || buildFn(fn);
  13832. if(o){
  13833. for(; i < l; ++i){
  13834. value = a[i];
  13835. if(fn.call(o, value, i, a)){
  13836. out.push(value);
  13837. }
  13838. }
  13839. }else{
  13840. for(; i < l; ++i){
  13841. value = a[i];
  13842. if(fn(value, i, a)){
  13843. out.push(value);
  13844. }
  13845. }
  13846. }
  13847. return out; // Array
  13848. }
  13849. array = {
  13850. every: everyOrSome(false),
  13851. some: everyOrSome(true),
  13852. indexOf: index(true),
  13853. lastIndexOf: index(false),
  13854. forEach: forEach,
  13855. map: map,
  13856. filter: filter,
  13857. clearCache: clearCache
  13858. };
  13859. 1 && lang.mixin(dojo, array);
  13860. /*===== return dojo.array; =====*/
  13861. return array;
  13862. });
  13863. },
  13864. 'dojo/_base/json':function(){
  13865. define(["./kernel", "../json"], function(dojo, json){
  13866. // module:
  13867. // dojo/_base/json
  13868. // summary:
  13869. // This module defines the dojo JSON API.
  13870. dojo.fromJson = function(/*String*/ js){
  13871. // summary:
  13872. // Parses a JavaScript expression and returns a JavaScript value.
  13873. // description:
  13874. // Throws for invalid JavaScript expressions. It does not use a strict JSON parser. It
  13875. // always delegates to eval(). The content passed to this method must therefore come
  13876. // from a trusted source.
  13877. // It is recommend that you use dojo/json's parse function for an
  13878. // implementation uses the (faster) native JSON parse when available.
  13879. // js:
  13880. // a string literal of a JavaScript expression, for instance:
  13881. // `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
  13882. return eval("(" + js + ")"); // Object
  13883. };
  13884. /*=====
  13885. dojo._escapeString = function(){
  13886. // summary:
  13887. // Adds escape sequences for non-visual characters, double quote and
  13888. // backslash and surrounds with double quotes to form a valid string
  13889. // literal.
  13890. };
  13891. =====*/
  13892. dojo._escapeString = json.stringify; // just delegate to json.stringify
  13893. dojo.toJsonIndentStr = "\t";
  13894. dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint){
  13895. // summary:
  13896. // Returns a [JSON](http://json.org) serialization of an object.
  13897. // description:
  13898. // Returns a [JSON](http://json.org) serialization of an object.
  13899. // Note that this doesn't check for infinite recursion, so don't do that!
  13900. // It is recommend that you use dojo/json's stringify function for an lighter
  13901. // and faster implementation that matches the native JSON API and uses the
  13902. // native JSON serializer when available.
  13903. // it:
  13904. // an object to be serialized. Objects may define their own
  13905. // serialization via a special "__json__" or "json" function
  13906. // property. If a specialized serializer has been defined, it will
  13907. // be used as a fallback.
  13908. // Note that in 1.6, toJson would serialize undefined, but this no longer supported
  13909. // since it is not supported by native JSON serializer.
  13910. // prettyPrint:
  13911. // if true, we indent objects and arrays to make the output prettier.
  13912. // The variable `dojo.toJsonIndentStr` is used as the indent string --
  13913. // to use something other than the default (tab), change that variable
  13914. // before calling dojo.toJson().
  13915. // Note that if native JSON support is available, it will be used for serialization,
  13916. // and native implementations vary on the exact spacing used in pretty printing.
  13917. // returns:
  13918. // A JSON string serialization of the passed-in object.
  13919. // example:
  13920. // simple serialization of a trivial object
  13921. // | var jsonStr = dojo.toJson({ howdy: "stranger!", isStrange: true });
  13922. // | doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
  13923. // example:
  13924. // a custom serializer for an objects of a particular class:
  13925. // | dojo.declare("Furby", null, {
  13926. // | furbies: "are strange",
  13927. // | furbyCount: 10,
  13928. // | __json__: function(){
  13929. // | },
  13930. // | });
  13931. // use dojo/json
  13932. return json.stringify(it, function(key, value){
  13933. if(value){
  13934. var tf = value.__json__||value.json;
  13935. if(typeof tf == "function"){
  13936. return tf.call(value);
  13937. }
  13938. }
  13939. return value;
  13940. }, prettyPrint && dojo.toJsonIndentStr); // String
  13941. };
  13942. return dojo;
  13943. });
  13944. },
  13945. 'dojo/_base/window':function(){
  13946. define("dojo/_base/window", ["./kernel", "../has", "./sniff"], function(dojo, has){
  13947. // module:
  13948. // dojo/window
  13949. // summary:
  13950. // This module provides an API to save/set/restore the global/document scope.
  13951. /*=====
  13952. dojo.doc = {
  13953. // summary:
  13954. // Alias for the current document. 'dojo.doc' can be modified
  13955. // for temporary context shifting. Also see dojo.withDoc().
  13956. // description:
  13957. // Refer to dojo.doc rather
  13958. // than referring to 'window.document' to ensure your code runs
  13959. // correctly in managed contexts.
  13960. // example:
  13961. // | n.appendChild(dojo.doc.createElement('div'));
  13962. }
  13963. =====*/
  13964. dojo.doc = dojo.global["document"] || null;
  13965. dojo.body = function(){
  13966. // summary:
  13967. // Return the body element of the document
  13968. // return the body object associated with dojo.doc
  13969. // example:
  13970. // | dojo.body().appendChild(dojo.doc.createElement('div'));
  13971. // Note: document.body is not defined for a strict xhtml document
  13972. // Would like to memoize this, but dojo.doc can change vi dojo.withDoc().
  13973. return dojo.doc.body || dojo.doc.getElementsByTagName("body")[0]; // Node
  13974. };
  13975. dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocument){
  13976. // summary:
  13977. // changes the behavior of many core Dojo functions that deal with
  13978. // namespace and DOM lookup, changing them to work in a new global
  13979. // context (e.g., an iframe). The varibles dojo.global and dojo.doc
  13980. // are modified as a result of calling this function and the result of
  13981. // `dojo.body()` likewise differs.
  13982. dojo.global = ret.global = globalObject;
  13983. dojo.doc = ret.doc = globalDocument;
  13984. };
  13985. dojo.withGlobal = function( /*Object*/globalObject,
  13986. /*Function*/callback,
  13987. /*Object?*/thisObject,
  13988. /*Array?*/cbArguments){
  13989. // summary:
  13990. // Invoke callback with globalObject as dojo.global and
  13991. // globalObject.document as dojo.doc.
  13992. // description:
  13993. // Invoke callback with globalObject as dojo.global and
  13994. // globalObject.document as dojo.doc. If provided, globalObject
  13995. // will be executed in the context of object thisObject
  13996. // When callback() returns or throws an error, the dojo.global
  13997. // and dojo.doc will be restored to its previous state.
  13998. var oldGlob = dojo.global;
  13999. try{
  14000. dojo.global = ret.global = globalObject;
  14001. return dojo.withDoc.call(null, globalObject.document, callback, thisObject, cbArguments);
  14002. }finally{
  14003. dojo.global = ret.global = oldGlob;
  14004. }
  14005. };
  14006. dojo.withDoc = function( /*DocumentElement*/documentObject,
  14007. /*Function*/callback,
  14008. /*Object?*/thisObject,
  14009. /*Array?*/cbArguments){
  14010. // summary:
  14011. // Invoke callback with documentObject as dojo.doc.
  14012. // description:
  14013. // Invoke callback with documentObject as dojo.doc. If provided,
  14014. // callback will be executed in the context of object thisObject
  14015. // When callback() returns or throws an error, the dojo.doc will
  14016. // be restored to its previous state.
  14017. var oldDoc = dojo.doc,
  14018. oldQ = dojo.isQuirks,
  14019. oldIE = dojo.isIE, isIE, mode, pwin;
  14020. try{
  14021. dojo.doc = ret.doc = documentObject;
  14022. // update dojo.isQuirks and the value of the has feature "quirks"
  14023. dojo.isQuirks = has.add("quirks", dojo.doc.compatMode == "BackCompat", true, true); // no need to check for QuirksMode which was Opera 7 only
  14024. if(has("ie")){
  14025. if((pwin = documentObject.parentWindow) && pwin.navigator){
  14026. // re-run IE detection logic and update dojo.isIE / has("ie")
  14027. // (the only time parentWindow/navigator wouldn't exist is if we were not
  14028. // passed an actual legitimate document object)
  14029. isIE = parseFloat(pwin.navigator.appVersion.split("MSIE ")[1]) || undefined;
  14030. mode = documentObject.documentMode;
  14031. if(mode && mode != 5 && Math.floor(isIE) != mode){
  14032. isIE = mode;
  14033. }
  14034. dojo.isIE = has.add("ie", isIE, true, true);
  14035. }
  14036. }
  14037. if(thisObject && typeof callback == "string"){
  14038. callback = thisObject[callback];
  14039. }
  14040. return callback.apply(thisObject, cbArguments || []);
  14041. }finally{
  14042. dojo.doc = ret.doc = oldDoc;
  14043. dojo.isQuirks = has.add("quirks", oldQ, true, true);
  14044. dojo.isIE = has.add("ie", oldIE, true, true);
  14045. }
  14046. };
  14047. var ret = {
  14048. global: dojo.global,
  14049. doc: dojo.doc,
  14050. body: dojo.body,
  14051. setContext: dojo.setContext,
  14052. withGlobal: dojo.withGlobal,
  14053. withDoc: dojo.withDoc
  14054. };
  14055. return ret;
  14056. });
  14057. },
  14058. 'dojo/dom-class':function(){
  14059. define(["./_base/lang", "./_base/array", "./dom"], function(lang, array, dom){
  14060. // module:
  14061. // dojo/dom-class
  14062. // summary:
  14063. // This module defines the core dojo DOM class API.
  14064. var className = "className";
  14065. /* Part I of classList-based implementation is preserved here for posterity
  14066. var classList = "classList";
  14067. has.add("dom-classList", function(){
  14068. return classList in document.createElement("p");
  14069. });
  14070. */
  14071. // =============================
  14072. // (CSS) Class Functions
  14073. // =============================
  14074. /*=====
  14075. dojo.hasClass = function(node, classStr){
  14076. // summary:
  14077. // Returns whether or not the specified classes are a portion of the
  14078. // class list currently applied to the node.
  14079. //
  14080. // node: String|DOMNode
  14081. // String ID or DomNode reference to check the class for.
  14082. //
  14083. // classStr: String
  14084. // A string class name to look for.
  14085. //
  14086. // returns: Boolean
  14087. //
  14088. // example:
  14089. // Do something if a node with id="someNode" has class="aSillyClassName" present
  14090. // | if(dojo.hasClass("someNode","aSillyClassName")){ ... }
  14091. };
  14092. =====*/
  14093. /*=====
  14094. dojo.addClass = function(node, classStr){
  14095. // summary:
  14096. // Adds the specified classes to the end of the class list on the
  14097. // passed node. Will not re-apply duplicate classes.
  14098. //
  14099. // node: String|DOMNode
  14100. // String ID or DomNode reference to add a class string too
  14101. //
  14102. // classStr: String|Array
  14103. // A String class name to add, or several space-separated class names,
  14104. // or an array of class names.
  14105. //
  14106. // example:
  14107. // Add a class to some node:
  14108. // | dojo.addClass("someNode", "anewClass");
  14109. //
  14110. // example:
  14111. // Add two classes at once:
  14112. // | dojo.addClass("someNode", "firstClass secondClass");
  14113. //
  14114. // example:
  14115. // Add two classes at once (using array):
  14116. // | dojo.addClass("someNode", ["firstClass", "secondClass"]);
  14117. //
  14118. // example:
  14119. // Available in `dojo.NodeList` for multiple additions
  14120. // | dojo.query("ul > li").addClass("firstLevel");
  14121. };
  14122. =====*/
  14123. /*=====
  14124. dojo.removeClass = function(node, classStr){
  14125. // summary:
  14126. // Removes the specified classes from node. No `dojo.hasClass`
  14127. // check is required.
  14128. //
  14129. // node: String|DOMNode
  14130. // String ID or DomNode reference to remove the class from.
  14131. //
  14132. // classStr: String|Array
  14133. // An optional String class name to remove, or several space-separated
  14134. // class names, or an array of class names. If omitted, all class names
  14135. // will be deleted.
  14136. //
  14137. // example:
  14138. // Remove a class from some node:
  14139. // | dojo.removeClass("someNode", "firstClass");
  14140. //
  14141. // example:
  14142. // Remove two classes from some node:
  14143. // | dojo.removeClass("someNode", "firstClass secondClass");
  14144. //
  14145. // example:
  14146. // Remove two classes from some node (using array):
  14147. // | dojo.removeClass("someNode", ["firstClass", "secondClass"]);
  14148. //
  14149. // example:
  14150. // Remove all classes from some node:
  14151. // | dojo.removeClass("someNode");
  14152. //
  14153. // example:
  14154. // Available in `dojo.NodeList()` for multiple removal
  14155. // | dojo.query(".foo").removeClass("foo");
  14156. };
  14157. =====*/
  14158. /*=====
  14159. dojo.replaceClass = function(node, addClassStr, removeClassStr){
  14160. // summary:
  14161. // Replaces one or more classes on a node if not present.
  14162. // Operates more quickly than calling dojo.removeClass and dojo.addClass
  14163. //
  14164. // node: String|DOMNode
  14165. // String ID or DomNode reference to remove the class from.
  14166. //
  14167. // addClassStr: String|Array
  14168. // A String class name to add, or several space-separated class names,
  14169. // or an array of class names.
  14170. //
  14171. // removeClassStr: String|Array?
  14172. // A String class name to remove, or several space-separated class names,
  14173. // or an array of class names.
  14174. //
  14175. // example:
  14176. // | dojo.replaceClass("someNode", "add1 add2", "remove1 remove2");
  14177. //
  14178. // example:
  14179. // Replace all classes with addMe
  14180. // | dojo.replaceClass("someNode", "addMe");
  14181. //
  14182. // example:
  14183. // Available in `dojo.NodeList()` for multiple toggles
  14184. // | dojo.query(".findMe").replaceClass("addMe", "removeMe");
  14185. };
  14186. =====*/
  14187. /*=====
  14188. dojo.toggleClass = function(node, classStr, condition){
  14189. // summary:
  14190. // Adds a class to node if not present, or removes if present.
  14191. // Pass a boolean condition if you want to explicitly add or remove.
  14192. // Returns the condition that was specified directly or indirectly.
  14193. //
  14194. // node: String|DOMNode
  14195. // String ID or DomNode reference to toggle a class string
  14196. //
  14197. // classStr: String|Array
  14198. // A String class name to toggle, or several space-separated class names,
  14199. // or an array of class names.
  14200. //
  14201. // condition:
  14202. // If passed, true means to add the class, false means to remove.
  14203. // Otherwise dojo.hasClass(node, classStr) is used to detect the class presence.
  14204. //
  14205. // example:
  14206. // | dojo.toggleClass("someNode", "hovered");
  14207. //
  14208. // example:
  14209. // Forcefully add a class
  14210. // | dojo.toggleClass("someNode", "hovered", true);
  14211. //
  14212. // example:
  14213. // Available in `dojo.NodeList()` for multiple toggles
  14214. // | dojo.query(".toggleMe").toggleClass("toggleMe");
  14215. };
  14216. =====*/
  14217. var cls, // exports object
  14218. spaces = /\s+/, a1 = [""];
  14219. function str2array(s){
  14220. if(typeof s == "string" || s instanceof String){
  14221. if(s && !spaces.test(s)){
  14222. a1[0] = s;
  14223. return a1;
  14224. }
  14225. var a = s.split(spaces);
  14226. if(a.length && !a[0]){
  14227. a.shift();
  14228. }
  14229. if(a.length && !a[a.length - 1]){
  14230. a.pop();
  14231. }
  14232. return a;
  14233. }
  14234. // assumed to be an array
  14235. if(!s){
  14236. return [];
  14237. }
  14238. return array.filter(s, function(x){ return x; });
  14239. }
  14240. /* Part II of classList-based implementation is preserved here for posterity
  14241. if(has("dom-classList")){
  14242. // new classList version
  14243. cls = {
  14244. contains: function containsClass(node, classStr){
  14245. var clslst = classStr && dom.byId(node)[classList];
  14246. return clslst && clslst.contains(classStr); // Boolean
  14247. },
  14248. add: function addClass(node, classStr){
  14249. node = dom.byId(node);
  14250. classStr = str2array(classStr);
  14251. for(var i = 0, len = classStr.length; i < len; ++i){
  14252. node[classList].add(classStr[i]);
  14253. }
  14254. },
  14255. remove: function removeClass(node, classStr){
  14256. node = dom.byId(node);
  14257. if(classStr === undefined){
  14258. node[className] = "";
  14259. }else{
  14260. classStr = str2array(classStr);
  14261. for(var i = 0, len = classStr.length; i < len; ++i){
  14262. node[classList].remove(classStr[i]);
  14263. }
  14264. }
  14265. },
  14266. replace: function replaceClass(node, addClassStr, removeClassStr){
  14267. node = dom.byId(node);
  14268. if(removeClassStr === undefined){
  14269. node[className] = "";
  14270. }else{
  14271. removeClassStr = str2array(removeClassStr);
  14272. for(var i = 0, len = removeClassStr.length; i < len; ++i){
  14273. node[classList].remove(removeClassStr[i]);
  14274. }
  14275. }
  14276. addClassStr = str2array(addClassStr);
  14277. for(i = 0, len = addClassStr.length; i < len; ++i){
  14278. node[classList].add(addClassStr[i]);
  14279. }
  14280. },
  14281. toggle: function toggleClass(node, classStr, condition){
  14282. node = dom.byId(node);
  14283. if(condition === undefined){
  14284. classStr = str2array(classStr);
  14285. for(var i = 0, len = classStr.length; i < len; ++i){
  14286. node[classList].toggle(classStr[i]);
  14287. }
  14288. }else{
  14289. cls[condition ? "add" : "remove"](node, classStr);
  14290. }
  14291. return condition; // Boolean
  14292. }
  14293. }
  14294. }
  14295. */
  14296. // regular DOM version
  14297. var fakeNode = {}; // for effective replacement
  14298. cls = {
  14299. contains: function containsClass(/*DomNode|String*/node, /*String*/classStr){
  14300. return ((" " + dom.byId(node)[className] + " ").indexOf(" " + classStr + " ") >= 0); // Boolean
  14301. },
  14302. add: function addClass(/*DomNode|String*/node, /*String|Array*/classStr){
  14303. node = dom.byId(node);
  14304. classStr = str2array(classStr);
  14305. var cls = node[className], oldLen;
  14306. cls = cls ? " " + cls + " " : " ";
  14307. oldLen = cls.length;
  14308. for(var i = 0, len = classStr.length, c; i < len; ++i){
  14309. c = classStr[i];
  14310. if(c && cls.indexOf(" " + c + " ") < 0){
  14311. cls += c + " ";
  14312. }
  14313. }
  14314. if(oldLen < cls.length){
  14315. node[className] = cls.substr(1, cls.length - 2);
  14316. }
  14317. },
  14318. remove: function removeClass(/*DomNode|String*/node, /*String|Array?*/classStr){
  14319. node = dom.byId(node);
  14320. var cls;
  14321. if(classStr !== undefined){
  14322. classStr = str2array(classStr);
  14323. cls = " " + node[className] + " ";
  14324. for(var i = 0, len = classStr.length; i < len; ++i){
  14325. cls = cls.replace(" " + classStr[i] + " ", " ");
  14326. }
  14327. cls = lang.trim(cls);
  14328. }else{
  14329. cls = "";
  14330. }
  14331. if(node[className] != cls){ node[className] = cls; }
  14332. },
  14333. replace: function replaceClass(/*DomNode|String*/node, /*String|Array*/addClassStr, /*String|Array?*/removeClassStr){
  14334. node = dom.byId(node);
  14335. fakeNode[className] = node[className];
  14336. cls.remove(fakeNode, removeClassStr);
  14337. cls.add(fakeNode, addClassStr);
  14338. if(node[className] !== fakeNode[className]){
  14339. node[className] = fakeNode[className];
  14340. }
  14341. },
  14342. toggle: function toggleClass(/*DomNode|String*/node, /*String|Array*/classStr, /*Boolean?*/condition){
  14343. node = dom.byId(node);
  14344. if(condition === undefined){
  14345. classStr = str2array(classStr);
  14346. for(var i = 0, len = classStr.length, c; i < len; ++i){
  14347. c = classStr[i];
  14348. cls[cls.contains(node, c) ? "remove" : "add"](node, c);
  14349. }
  14350. }else{
  14351. cls[condition ? "add" : "remove"](node, classStr);
  14352. }
  14353. return condition; // Boolean
  14354. }
  14355. };
  14356. return cls;
  14357. });
  14358. },
  14359. 'dojo/_base/config':function(){
  14360. define(["../has", "require"], function(has, require){
  14361. // module:
  14362. // dojo/_base/config
  14363. // summary:
  14364. // This module defines the user configuration during bootstrap.
  14365. // description:
  14366. // By defining user configuration as a module value, an entire configuration can be specified in a build,
  14367. // thereby eliminating the need for sniffing and or explicitly setting in the global variable dojoConfig.
  14368. // Also, when multiple instances of dojo exist in a single application, each will necessarily be located
  14369. // at an unique absolute module identifier as given by the package configuration. Implementing configuration
  14370. // as a module allows for specifying unique, per-instance configurations.
  14371. // example:
  14372. // Create a second instance of dojo with a different, instance-uniqe configuration (assume the loader and
  14373. // dojo.js are already loaded).
  14374. // | // specify a configuration that creates a new instance of dojo at the absolute module identifier "myDojo"
  14375. // | require({
  14376. // | packages:[{
  14377. // | name:"myDojo",
  14378. // | location:".", //assume baseUrl points to dojo.js
  14379. // | }]
  14380. // | });
  14381. // |
  14382. // | // specify a configuration for the myDojo instance
  14383. // | define("myDojo/config", {
  14384. // | // normal configuration variables go here, e.g.,
  14385. // | locale:"fr-ca"
  14386. // | });
  14387. // |
  14388. // | // load and use the new instance of dojo
  14389. // | require(["myDojo"], function(dojo) {
  14390. // | // dojo is the new instance of dojo
  14391. // | // use as required
  14392. // | });
  14393. var result = {};
  14394. if(1){
  14395. // must be the dojo loader; take a shallow copy of require.rawConfig
  14396. var src = require.rawConfig, p;
  14397. for(p in src){
  14398. result[p] = src[p];
  14399. }
  14400. }else{
  14401. var global = (function () { return this; })();
  14402. var adviseHas = function(featureSet, prefix, booting){
  14403. for(p in featureSet){
  14404. p!="has" && has.add(prefix + p, featureSet[p], 0, booting);
  14405. }
  14406. };
  14407. result = 1 ?
  14408. // must be a built version of the dojo loader; all config stuffed in require.rawConfig
  14409. require.rawConfig :
  14410. // a foreign loader
  14411. global.dojoConfig || global.djConfig || {};
  14412. adviseHas(result, "config", 1);
  14413. adviseHas(result.has, "", 1);
  14414. }
  14415. return result;
  14416. /*=====
  14417. // note:
  14418. // 'dojoConfig' does not exist under 'dojo.*' so that it can be set before the
  14419. // 'dojo' variable exists.
  14420. // note:
  14421. // Setting any of these variables *after* the library has loaded does
  14422. // nothing at all.
  14423. // FIXME: can we document these on dojo.config object and explain they must be set via djConfig/dojoConfig global prior to loading dojo.js
  14424. dojoConfig = {
  14425. // summary:
  14426. // Application code can set the global 'dojoConfig' prior to loading
  14427. // the library to control certain global settings for how dojo works.
  14428. //
  14429. // isDebug: Boolean
  14430. // Defaults to `false`. If set to `true`, ensures that Dojo provides
  14431. // extended debugging feedback via Firebug. If Firebug is not available
  14432. // on your platform, setting `isDebug` to `true` will force Dojo to
  14433. // pull in (and display) the version of Firebug Lite which is
  14434. // integrated into the Dojo distribution, thereby always providing a
  14435. // debugging/logging console when `isDebug` is enabled. Note that
  14436. // Firebug's `console.*` methods are ALWAYS defined by Dojo. If
  14437. // `isDebug` is false and you are on a platform without Firebug, these
  14438. // methods will be defined as no-ops.
  14439. isDebug: false,
  14440. // locale: String
  14441. // The locale to assume for loading localized resources in this page,
  14442. // specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
  14443. // Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
  14444. // See the documentation for `dojo.i18n` and `dojo.requireLocalization`
  14445. // for details on loading localized resources. If no locale is specified,
  14446. // Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
  14447. // or `navigator.language` properties.
  14448. locale: undefined,
  14449. // extraLocale: Array
  14450. // No default value. Specifies additional locales whose
  14451. // resources should also be loaded alongside the default locale when
  14452. // calls to `dojo.requireLocalization()` are processed.
  14453. extraLocale: undefined,
  14454. // baseUrl: String
  14455. // The directory in which `dojo.js` is located. Under normal
  14456. // conditions, Dojo auto-detects the correct location from which it
  14457. // was loaded. You may need to manually configure `baseUrl` in cases
  14458. // where you have renamed `dojo.js` or in which `<base>` tags confuse
  14459. // some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
  14460. // either the value of `djConfig.baseUrl` if one is provided or the
  14461. // auto-detected root if not. Other modules are located relative to
  14462. // this path. The path should end in a slash.
  14463. baseUrl: undefined,
  14464. // modulePaths: Object
  14465. // A map of module names to paths relative to `dojo.baseUrl`. The
  14466. // key/value pairs correspond directly to the arguments which
  14467. // `dojo.registerModulePath` accepts. Specifiying
  14468. // `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
  14469. // of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
  14470. // modules may be configured via `djConfig.modulePaths`.
  14471. modulePaths: {},
  14472. // afterOnLoad: Boolean
  14473. // Indicates Dojo was added to the page after the page load. In this case
  14474. // Dojo will not wait for the page DOMContentLoad/load events and fire
  14475. // its dojo.addOnLoad callbacks after making sure all outstanding
  14476. // dojo.required modules have loaded. Only works with a built dojo.js,
  14477. // it does not work the dojo.js directly from source control.
  14478. afterOnLoad: false,
  14479. // addOnLoad: Function or Array
  14480. // Adds a callback via dojo.addOnLoad. Useful when Dojo is added after
  14481. // the page loads and djConfig.afterOnLoad is true. Supports the same
  14482. // arguments as dojo.addOnLoad. When using a function reference, use
  14483. // `djConfig.addOnLoad = function(){};`. For object with function name use
  14484. // `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
  14485. // function reference use
  14486. // `djConfig.addOnLoad = [myObject, function(){}];`
  14487. addOnLoad: null,
  14488. // require: Array
  14489. // An array of module names to be loaded immediately after dojo.js has been included
  14490. // in a page.
  14491. require: [],
  14492. // defaultDuration: Array
  14493. // Default duration, in milliseconds, for wipe and fade animations within dijits.
  14494. // Assigned to dijit.defaultDuration.
  14495. defaultDuration: 200,
  14496. // dojoBlankHtmlUrl: String
  14497. // Used by some modules to configure an empty iframe. Used by dojo.io.iframe and
  14498. // dojo.back, and dijit popup support in IE where an iframe is needed to make sure native
  14499. // controls do not bleed through the popups. Normally this configuration variable
  14500. // does not need to be set, except when using cross-domain/CDN Dojo builds.
  14501. // Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
  14502. // to the path on your domain your copy of blank.html.
  14503. dojoBlankHtmlUrl: undefined,
  14504. // ioPublish: Boolean?
  14505. // Set this to true to enable publishing of topics for the different phases of
  14506. // IO operations. Publishing is done via dojo.publish. See dojo.__IoPublish for a list
  14507. // of topics that are published.
  14508. ioPublish: false,
  14509. // useCustomLogger: Anything?
  14510. // If set to a value that evaluates to true such as a string or array and
  14511. // isDebug is true and Firebug is not available or running, then it bypasses
  14512. // the creation of Firebug Lite allowing you to define your own console object.
  14513. useCustomLogger: undefined,
  14514. // transparentColor: Array
  14515. // Array containing the r, g, b components used as transparent color in dojo.Color;
  14516. // if undefined, [255,255,255] (white) will be used.
  14517. transparentColor: undefined,
  14518. // skipIeDomLoaded: Boolean
  14519. // For IE only, skip the DOMContentLoaded hack used. Sometimes it can cause an Operation
  14520. // Aborted error if the rest of the page triggers script defers before the DOM is ready.
  14521. // If this is config value is set to true, then dojo.addOnLoad callbacks will not be
  14522. // triggered until the page load event, which is after images and iframes load. If you
  14523. // want to trigger the callbacks sooner, you can put a script block in the bottom of
  14524. // your HTML that calls dojo._loadInit();. If you are using multiversion support, change
  14525. // "dojo." to the appropriate scope name for dojo.
  14526. skipIeDomLoaded: false
  14527. }
  14528. =====*/
  14529. });
  14530. },
  14531. 'dojo/_base/event':function(){
  14532. define("dojo/_base/event", ["./kernel", "../on", "../has", "../dom-geometry"], function(dojo, on, has, dom){
  14533. // module:
  14534. // dojo/_base/event
  14535. // summary:
  14536. // This module defines dojo DOM event API.
  14537. if(on._fixEvent){
  14538. var fixEvent = on._fixEvent;
  14539. on._fixEvent = function(evt, se){
  14540. // add some additional normalization for back-compat, this isn't in on.js because it is somewhat more expensive
  14541. evt = fixEvent(evt, se);
  14542. if(evt){
  14543. dom.normalizeEvent(evt);
  14544. }
  14545. return evt;
  14546. };
  14547. }
  14548. dojo.fixEvent = function(/*Event*/ evt, /*DOMNode*/ sender){
  14549. // summary:
  14550. // normalizes properties on the event object including event
  14551. // bubbling methods, keystroke normalization, and x/y positions
  14552. // evt: Event
  14553. // native event object
  14554. // sender: DOMNode
  14555. // node to treat as "currentTarget"
  14556. if(on._fixEvent){
  14557. return on._fixEvent(evt, sender);
  14558. }
  14559. return evt; // Event
  14560. };
  14561. dojo.stopEvent = function(/*Event*/ evt){
  14562. // summary:
  14563. // prevents propagation and clobbers the default action of the
  14564. // passed event
  14565. // evt: Event
  14566. // The event object. If omitted, window.event is used on IE.
  14567. if(has("dom-addeventlistener") || (evt && evt.preventDefault)){
  14568. evt.preventDefault();
  14569. evt.stopPropagation();
  14570. }else{
  14571. evt = evt || window.event;
  14572. evt.cancelBubble = true;
  14573. on._preventDefault.call(evt);
  14574. }
  14575. };
  14576. return {
  14577. fix: dojo.fixEvent,
  14578. stop: dojo.stopEvent
  14579. };
  14580. });
  14581. },
  14582. 'dojo/main':function(){
  14583. define([
  14584. "./_base/kernel",
  14585. "./has",
  14586. "require",
  14587. "./_base/sniff",
  14588. "./_base/lang",
  14589. "./_base/array",
  14590. "./ready",
  14591. "./_base/declare",
  14592. "./_base/connect",
  14593. "./_base/Deferred",
  14594. "./_base/json",
  14595. "./_base/Color",
  14596. "./has!dojo-firebug?./_firebug/firebug",
  14597. "./_base/browser",
  14598. "./_base/loader"], function(dojo, has, require, sniff, lang, array, ready){
  14599. // module:
  14600. // dojo/main
  14601. // summary:
  14602. // This is the package main module for the dojo package; it loads dojo base appropriate for the execution environment.
  14603. // the preferred way to load the dojo firebug console is by setting has("dojo-firebug") true in dojoConfig
  14604. // the isDebug config switch is for backcompat and will work fine in sync loading mode; it works in
  14605. // async mode too, but there's no guarantee when the module is loaded; therefore, if you need a firebug
  14606. // console guarnanteed at a particular spot in an app, either set config.has["dojo-firebug"] true before
  14607. // loading dojo.js or explicitly include dojo/_firebug/firebug in a dependency list.
  14608. if(dojo.config.isDebug){
  14609. require(["./_firebug/firebug"]);
  14610. }
  14611. // dojoConfig.require is deprecated; use the loader configuration property deps
  14612. true || has.add("dojo-config-require", 1);
  14613. if(1){
  14614. var deps= dojo.config.require;
  14615. if(deps){
  14616. // dojo.config.require may be dot notation
  14617. deps= array.map(lang.isArray(deps) ? deps : [deps], function(item){ return item.replace(/\./g, "/"); });
  14618. if(dojo.isAsync){
  14619. require(deps);
  14620. }else{
  14621. // this is a bit janky; in 1.6- dojo is defined before these requires are applied; but in 1.7+
  14622. // dojo isn't defined until returning from this module; this is only a problem in sync mode
  14623. // since we're in sync mode, we know we've got our loader with its priority ready queue
  14624. ready(1, function(){require(deps);});
  14625. }
  14626. }
  14627. }
  14628. return dojo;
  14629. });
  14630. },
  14631. 'dojo/ready':function(){
  14632. define("dojo/ready", ["./_base/kernel", "./has", "require", "./domReady", "./_base/lang"], function(dojo, has, require, domReady, lang) {
  14633. // module:
  14634. // dojo/ready
  14635. // summary:
  14636. // This module defines the dojo.ready API.
  14637. //
  14638. // note:
  14639. // This module should be unnecessary in dojo 2.0
  14640. var
  14641. // truthy if DOMContentLoaded or better (e.g., window.onload fired) has been achieved
  14642. isDomReady = 0,
  14643. // The queue of functions waiting to execute as soon as dojo.ready conditions satisfied
  14644. loadQ = [],
  14645. // prevent recursion in onLoad
  14646. onLoadRecursiveGuard = 0,
  14647. handleDomReady = function(){
  14648. isDomReady = 1;
  14649. dojo._postLoad = dojo.config.afterOnLoad = true;
  14650. onEvent();
  14651. },
  14652. onEvent = function(){
  14653. // Called when some state changes:
  14654. // - dom ready
  14655. // - dojo/domReady has finished processing everything in its queue
  14656. // - task added to loadQ
  14657. // - require() has finished loading all currently requested modules
  14658. //
  14659. // Run the functions queued with dojo.ready if appropriate.
  14660. //guard against recursions into this function
  14661. if(onLoadRecursiveGuard){
  14662. return;
  14663. }
  14664. onLoadRecursiveGuard = 1;
  14665. // Run tasks in queue if require() is finished loading modules, the dom is ready, and there are no
  14666. // pending tasks registered via domReady().
  14667. // The last step is necessary so that a user defined dojo.ready() callback is delayed until after the
  14668. // domReady() calls inside of dojo. Failure can be seen on dijit/tests/robot/Dialog_ally.html on IE8
  14669. // because the dijit/focus.js domReady() callback doesn't execute until after the test starts running.
  14670. while(isDomReady && (!domReady || domReady._Q.length == 0) && require.idle() && loadQ.length){
  14671. var f = loadQ.shift();
  14672. try{
  14673. f();
  14674. }catch(e){
  14675. // FIXME: signal the error via require.on
  14676. }
  14677. }
  14678. onLoadRecursiveGuard = 0;
  14679. };
  14680. // Check if we should run the next queue operation whenever require() finishes loading modules or domReady
  14681. // finishes processing it's queue.
  14682. require.on("idle", onEvent);
  14683. if(domReady){
  14684. domReady._onQEmpty = onEvent;
  14685. }
  14686. var ready = dojo.ready = dojo.addOnLoad = function(priority, context, callback){
  14687. // summary:
  14688. // Add a function to execute on DOM content loaded and all requested modules have arrived and been evaluated.
  14689. // In most cases, the `domReady` plug-in should suffice and this method should not be needed.
  14690. //
  14691. // When called in a non-browser environment, just checks that all requested modules have arrived and been
  14692. // evaluated.
  14693. // priority: Integer?
  14694. // The order in which to exec this callback relative to other callbacks, defaults to 1000
  14695. // context: Object?|Function
  14696. // The context in which to run execute callback, or a callback if not using context
  14697. // callback: Function?
  14698. // The function to execute.
  14699. //
  14700. // example:
  14701. // Simple DOM and Modules ready syntax
  14702. // | dojo.ready(function(){ alert("Dom ready!"); });
  14703. //
  14704. // example:
  14705. // Using a priority
  14706. // | dojo.ready(2, function(){ alert("low priority ready!"); })
  14707. //
  14708. // example:
  14709. // Using context
  14710. // | dojo.ready(foo, function(){
  14711. // | // in here, this == foo
  14712. // | })
  14713. //
  14714. // example:
  14715. // Using dojo.hitch style args:
  14716. // | var foo = { dojoReady: function(){ console.warn(this, "dojo dom and modules ready."); } };
  14717. // | dojo.ready(foo, "dojoReady");
  14718. var hitchArgs = lang._toArray(arguments);
  14719. if(typeof priority != "number"){
  14720. callback = context;
  14721. context = priority;
  14722. priority = 1000;
  14723. }else{
  14724. hitchArgs.shift();
  14725. }
  14726. callback = callback ?
  14727. lang.hitch.apply(dojo, hitchArgs) :
  14728. function(){
  14729. context();
  14730. };
  14731. callback.priority = priority;
  14732. for(var i = 0; i < loadQ.length && priority >= loadQ[i].priority; i++){}
  14733. loadQ.splice(i, 0, callback);
  14734. onEvent();
  14735. };
  14736. true || has.add("dojo-config-addOnLoad", 1);
  14737. if(1){
  14738. var dca = dojo.config.addOnLoad;
  14739. if(dca){
  14740. ready[(lang.isArray(dca) ? "apply" : "call")](dojo, dca);
  14741. }
  14742. }
  14743. if(1 && dojo.config.parseOnLoad && !dojo.isAsync){
  14744. ready(99, function(){
  14745. if(!dojo.parser){
  14746. dojo.deprecated("Add explicit require(['dojo/parser']);", "", "2.0");
  14747. require(["dojo/parser"]);
  14748. }
  14749. });
  14750. }
  14751. if(domReady){
  14752. domReady(handleDomReady);
  14753. }else{
  14754. handleDomReady();
  14755. }
  14756. return ready;
  14757. });
  14758. },
  14759. 'dojo/aspect':function(){
  14760. define("dojo/aspect", [], function(){
  14761. // TODOC: after/before/around return object
  14762. // TODOC: after/before/around param types.
  14763. /*=====
  14764. dojo.aspect = {
  14765. // summary: provides aspect oriented programming functionality, allowing for
  14766. // one to add before, around, or after advice on existing methods.
  14767. //
  14768. // example:
  14769. // | define(["dojo/aspect"], function(aspect){
  14770. // | var signal = aspect.after(targetObject, "methodName", function(someArgument){
  14771. // | this will be called when targetObject.methodName() is called, after the original function is called
  14772. // | });
  14773. //
  14774. // example:
  14775. // The returned signal object can be used to cancel the advice.
  14776. // | signal.remove(); // this will stop the advice from being executed anymore
  14777. // | aspect.before(targetObject, "methodName", function(someArgument){
  14778. // | // this will be called when targetObject.methodName() is called, before the original function is called
  14779. // | });
  14780. after: function(target, methodName, advice, receiveArguments){
  14781. // summary: The "after" export of the aspect module is a function that can be used to attach
  14782. // "after" advice to a method. This function will be executed after the original method
  14783. // is executed. By default the function will be called with a single argument, the return
  14784. // value of the original method, or the the return value of the last executed advice (if a previous one exists).
  14785. // The fourth (optional) argument can be set to true to so the function receives the original
  14786. // arguments (from when the original method was called) rather than the return value.
  14787. // If there are multiple "after" advisors, they are executed in the order they were registered.
  14788. // target: Object
  14789. // This is the target object
  14790. // methodName: String
  14791. // This is the name of the method to attach to.
  14792. // advice: Function
  14793. // This is function to be called after the original method
  14794. // receiveArguments: Boolean?
  14795. // If this is set to true, the advice function receives the original arguments (from when the original mehtod
  14796. // was called) rather than the return value of the original/previous method.
  14797. // returns:
  14798. // A signal object that can be used to cancel the advice. If remove() is called on this signal object, it will
  14799. // stop the advice function from being executed.
  14800. },
  14801. before: function(target, methodName, advice){
  14802. // summary: The "before" export of the aspect module is a function that can be used to attach
  14803. // "before" advice to a method. This function will be executed before the original method
  14804. // is executed. This function will be called with the arguments used to call the method.
  14805. // This function may optionally return an array as the new arguments to use to call
  14806. // the original method (or the previous, next-to-execute before advice, if one exists).
  14807. // If the before method doesn't return anything (returns undefined) the original arguments
  14808. // will be preserved.
  14809. // If there are multiple "before" advisors, they are executed in the reverse order they were registered.
  14810. //
  14811. // target: Object
  14812. // This is the target object
  14813. // methodName: String
  14814. // This is the name of the method to attach to.
  14815. // advice: Function
  14816. // This is function to be called before the original method
  14817. },
  14818. around: function(target, methodName, advice){
  14819. // summary: The "around" export of the aspect module is a function that can be used to attach
  14820. // "around" advice to a method. The advisor function is immediately executed when
  14821. // the around() is called, is passed a single argument that is a function that can be
  14822. // called to continue execution of the original method (or the next around advisor).
  14823. // The advisor function should return a function, and this function will be called whenever
  14824. // the method is called. It will be called with the arguments used to call the method.
  14825. // Whatever this function returns will be returned as the result of the method call (unless after advise changes it).
  14826. //
  14827. // example:
  14828. // If there are multiple "around" advisors, the most recent one is executed first,
  14829. // which can then delegate to the next one and so on. For example:
  14830. // | around(obj, "foo", function(originalFoo){
  14831. // | return function(){
  14832. // | var start = new Date().getTime();
  14833. // | var results = originalFoo.apply(this, arguments); // call the original
  14834. // | var end = new Date().getTime();
  14835. // | console.log("foo execution took " + (end - start) + " ms");
  14836. // | return results;
  14837. // | };
  14838. // | });
  14839. //
  14840. // target: Object
  14841. // This is the target object
  14842. // methodName: String
  14843. // This is the name of the method to attach to.
  14844. // advice: Function
  14845. // This is function to be called around the original method
  14846. }
  14847. };
  14848. =====*/
  14849. "use strict";
  14850. var nextId = 0;
  14851. function advise(dispatcher, type, advice, receiveArguments){
  14852. var previous = dispatcher[type];
  14853. var around = type == "around";
  14854. var signal;
  14855. if(around){
  14856. var advised = advice(function(){
  14857. return previous.advice(this, arguments);
  14858. });
  14859. signal = {
  14860. remove: function(){
  14861. if(advised){
  14862. advised = dispatcher = advice = null;
  14863. }
  14864. },
  14865. advice: function(target, args){
  14866. return advised ?
  14867. advised.apply(target, args) : // called the advised function
  14868. previous.advice(target, args); // cancelled, skip to next one
  14869. }
  14870. };
  14871. }else{
  14872. // create the remove handler
  14873. signal = {
  14874. remove: function(){
  14875. if(signal.advice){
  14876. var previous = signal.previous;
  14877. var next = signal.next;
  14878. if(!next && !previous){
  14879. delete dispatcher[type];
  14880. }else{
  14881. if(previous){
  14882. previous.next = next;
  14883. }else{
  14884. dispatcher[type] = next;
  14885. }
  14886. if(next){
  14887. next.previous = previous;
  14888. }
  14889. }
  14890. // remove the advice to signal that this signal has been removed
  14891. dispatcher = advice = signal.advice = null;
  14892. }
  14893. },
  14894. id: nextId++,
  14895. advice: advice,
  14896. receiveArguments: receiveArguments
  14897. };
  14898. }
  14899. if(previous && !around){
  14900. if(type == "after"){
  14901. // add the listener to the end of the list
  14902. // note that we had to change this loop a little bit to workaround a bizarre IE10 JIT bug
  14903. while(previous.next && (previous = previous.next)){}
  14904. previous.next = signal;
  14905. signal.previous = previous;
  14906. }else if(type == "before"){
  14907. // add to beginning
  14908. dispatcher[type] = signal;
  14909. signal.next = previous;
  14910. previous.previous = signal;
  14911. }
  14912. }else{
  14913. // around or first one just replaces
  14914. dispatcher[type] = signal;
  14915. }
  14916. return signal;
  14917. }
  14918. function aspect(type){
  14919. return function(target, methodName, advice, receiveArguments){
  14920. var existing = target[methodName], dispatcher;
  14921. if(!existing || existing.target != target){
  14922. // no dispatcher in place
  14923. target[methodName] = dispatcher = function(){
  14924. var executionId = nextId;
  14925. // before advice
  14926. var args = arguments;
  14927. var before = dispatcher.before;
  14928. while(before){
  14929. args = before.advice.apply(this, args) || args;
  14930. before = before.next;
  14931. }
  14932. // around advice
  14933. if(dispatcher.around){
  14934. var results = dispatcher.around.advice(this, args);
  14935. }
  14936. // after advice
  14937. var after = dispatcher.after;
  14938. while(after && after.id < executionId){
  14939. results = after.receiveArguments ? after.advice.apply(this, args) || results :
  14940. after.advice.call(this, results);
  14941. after = after.next;
  14942. }
  14943. return results;
  14944. };
  14945. if(existing){
  14946. dispatcher.around = {advice: function(target, args){
  14947. return existing.apply(target, args);
  14948. }};
  14949. }
  14950. dispatcher.target = target;
  14951. }
  14952. var results = advise((dispatcher || existing), type, advice, receiveArguments);
  14953. advice = null;
  14954. return results;
  14955. };
  14956. }
  14957. return {
  14958. before: aspect("before"),
  14959. around: aspect("around"),
  14960. after: aspect("after")
  14961. };
  14962. });
  14963. },
  14964. 'dojo/_base/connect':function(){
  14965. define(["./kernel", "../on", "../topic", "../aspect", "./event", "../mouse", "./sniff", "./lang", "../keys"], function(kernel, on, hub, aspect, eventModule, mouse, has, lang){
  14966. // module:
  14967. // dojo/_base/connect
  14968. // summary:
  14969. // This module defines the dojo.connect API.
  14970. // This modules also provides keyboard event handling helpers.
  14971. // This module exports an extension event for emulating Firefox's keypress handling.
  14972. // However, this extension event exists primarily for backwards compatibility and
  14973. // is not recommended. WebKit and IE uses an alternate keypress handling (only
  14974. // firing for printable characters, to distinguish from keydown events), and most
  14975. // consider the WebKit/IE behavior more desirable.
  14976. has.add("events-keypress-typed", function(){ // keypresses should only occur a printable character is hit
  14977. var testKeyEvent = {charCode: 0};
  14978. try{
  14979. testKeyEvent = document.createEvent("KeyboardEvent");
  14980. (testKeyEvent.initKeyboardEvent || testKeyEvent.initKeyEvent).call(testKeyEvent, "keypress", true, true, null, false, false, false, false, 9, 3);
  14981. }catch(e){}
  14982. return testKeyEvent.charCode == 0 && !has("opera");
  14983. });
  14984. function connect_(obj, event, context, method, dontFix){
  14985. method = lang.hitch(context, method);
  14986. if(!obj || !(obj.addEventListener || obj.attachEvent)){
  14987. // it is a not a DOM node and we are using the dojo.connect style of treating a
  14988. // method like an event, must go right to aspect
  14989. return aspect.after(obj || kernel.global, event, method, true);
  14990. }
  14991. if(typeof event == "string" && event.substring(0, 2) == "on"){
  14992. event = event.substring(2);
  14993. }
  14994. if(!obj){
  14995. obj = kernel.global;
  14996. }
  14997. if(!dontFix){
  14998. switch(event){
  14999. // dojo.connect has special handling for these event types
  15000. case "keypress":
  15001. event = keypress;
  15002. break;
  15003. case "mouseenter":
  15004. event = mouse.enter;
  15005. break;
  15006. case "mouseleave":
  15007. event = mouse.leave;
  15008. break;
  15009. }
  15010. }
  15011. return on(obj, event, method, dontFix);
  15012. }
  15013. var _punctMap = {
  15014. 106:42,
  15015. 111:47,
  15016. 186:59,
  15017. 187:43,
  15018. 188:44,
  15019. 189:45,
  15020. 190:46,
  15021. 191:47,
  15022. 192:96,
  15023. 219:91,
  15024. 220:92,
  15025. 221:93,
  15026. 222:39,
  15027. 229:113
  15028. };
  15029. var evtCopyKey = has("mac") ? "metaKey" : "ctrlKey";
  15030. var _synthesizeEvent = function(evt, props){
  15031. var faux = lang.mixin({}, evt, props);
  15032. setKeyChar(faux);
  15033. // FIXME: would prefer to use lang.hitch: lang.hitch(evt, evt.preventDefault);
  15034. // but it throws an error when preventDefault is invoked on Safari
  15035. // does Event.preventDefault not support "apply" on Safari?
  15036. faux.preventDefault = function(){ evt.preventDefault(); };
  15037. faux.stopPropagation = function(){ evt.stopPropagation(); };
  15038. return faux;
  15039. };
  15040. function setKeyChar(evt){
  15041. evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
  15042. evt.charOrCode = evt.keyChar || evt.keyCode;
  15043. }
  15044. var keypress;
  15045. if(has("events-keypress-typed")){
  15046. // this emulates Firefox's keypress behavior where every keydown can correspond to a keypress
  15047. var _trySetKeyCode = function(e, code){
  15048. try{
  15049. // squelch errors when keyCode is read-only
  15050. // (e.g. if keyCode is ctrl or shift)
  15051. return (e.keyCode = code);
  15052. }catch(e){
  15053. return 0;
  15054. }
  15055. };
  15056. keypress = function(object, listener){
  15057. var keydownSignal = on(object, "keydown", function(evt){
  15058. // munge key/charCode
  15059. var k=evt.keyCode;
  15060. // These are Windows Virtual Key Codes
  15061. // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
  15062. var unprintable = (k!=13 || (has("ie") >= 9 && !has("quirks"))) && k!=32 && (k!=27||!has("ie")) && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222) && k!=229;
  15063. // synthesize keypress for most unprintables and CTRL-keys
  15064. if(unprintable||evt.ctrlKey){
  15065. var c = unprintable ? 0 : k;
  15066. if(evt.ctrlKey){
  15067. if(k==3 || k==13){
  15068. return listener.call(evt.currentTarget, evt); // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
  15069. }else if(c>95 && c<106){
  15070. c -= 48; // map CTRL-[numpad 0-9] to ASCII
  15071. }else if((!evt.shiftKey)&&(c>=65&&c<=90)){
  15072. c += 32; // map CTRL-[A-Z] to lowercase
  15073. }else{
  15074. c = _punctMap[c] || c; // map other problematic CTRL combinations to ASCII
  15075. }
  15076. }
  15077. // simulate a keypress event
  15078. var faux = _synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
  15079. listener.call(evt.currentTarget, faux);
  15080. if(has("ie")){
  15081. _trySetKeyCode(evt, faux.keyCode);
  15082. }
  15083. }
  15084. });
  15085. var keypressSignal = on(object, "keypress", function(evt){
  15086. var c = evt.charCode;
  15087. c = c>=32 ? c : 0;
  15088. evt = _synthesizeEvent(evt, {charCode: c, faux: true});
  15089. return listener.call(this, evt);
  15090. });
  15091. return {
  15092. remove: function(){
  15093. keydownSignal.remove();
  15094. keypressSignal.remove();
  15095. }
  15096. };
  15097. };
  15098. }else{
  15099. if(has("opera")){
  15100. keypress = function(object, listener){
  15101. return on(object, "keypress", function(evt){
  15102. var c = evt.which;
  15103. if(c==3){
  15104. c=99; // Mozilla maps CTRL-BREAK to CTRL-c
  15105. }
  15106. // can't trap some keys at all, like INSERT and DELETE
  15107. // there is no differentiating info between DELETE and ".", or INSERT and "-"
  15108. c = c<32 && !evt.shiftKey ? 0 : c;
  15109. if(evt.ctrlKey && !evt.shiftKey && c>=65 && c<=90){
  15110. // lowercase CTRL-[A-Z] keys
  15111. c += 32;
  15112. }
  15113. return listener.call(this, _synthesizeEvent(evt, { charCode: c }));
  15114. });
  15115. };
  15116. }else{
  15117. keypress = function(object, listener){
  15118. return on(object, "keypress", function(evt){
  15119. setKeyChar(evt);
  15120. return listener.call(this, evt);
  15121. });
  15122. };
  15123. }
  15124. }
  15125. var connect = {
  15126. _keypress:keypress,
  15127. connect:function(obj, event, context, method, dontFix){
  15128. // normalize arguments
  15129. var a=arguments, args=[], i=0;
  15130. // if a[0] is a String, obj was omitted
  15131. args.push(typeof a[0] == "string" ? null : a[i++], a[i++]);
  15132. // if the arg-after-next is a String or Function, context was NOT omitted
  15133. var a1 = a[i+1];
  15134. args.push(typeof a1 == "string" || typeof a1 == "function" ? a[i++] : null, a[i++]);
  15135. // absorb any additional arguments
  15136. for(var l=a.length; i<l; i++){ args.push(a[i]); }
  15137. return connect_.apply(this, args);
  15138. },
  15139. disconnect:function(handle){
  15140. if(handle){
  15141. handle.remove();
  15142. }
  15143. },
  15144. subscribe:function(topic, context, method){
  15145. return hub.subscribe(topic, lang.hitch(context, method));
  15146. },
  15147. publish:function(topic, args){
  15148. return hub.publish.apply(hub, [topic].concat(args));
  15149. },
  15150. connectPublisher:function(topic, obj, event){
  15151. var pf = function(){ connect.publish(topic, arguments); };
  15152. return event ? connect.connect(obj, event, pf) : connect.connect(obj, pf); //Handle
  15153. },
  15154. isCopyKey: function(e){
  15155. return e[evtCopyKey]; // Boolean
  15156. }
  15157. };
  15158. connect.unsubscribe = connect.disconnect;
  15159. 1 && lang.mixin(kernel, connect);
  15160. return connect;
  15161. /*=====
  15162. dojo.connect = function(obj, event, context, method, dontFix){
  15163. // summary:
  15164. // `dojo.connect` is the core event handling and delegation method in
  15165. // Dojo. It allows one function to "listen in" on the execution of
  15166. // any other, triggering the second whenever the first is called. Many
  15167. // listeners may be attached to a function, and source functions may
  15168. // be either regular function calls or DOM events.
  15169. //
  15170. // description:
  15171. // Connects listeners to actions, so that after event fires, a
  15172. // listener is called with the same arguments passed to the original
  15173. // function.
  15174. //
  15175. // Since `dojo.connect` allows the source of events to be either a
  15176. // "regular" JavaScript function or a DOM event, it provides a uniform
  15177. // interface for listening to all the types of events that an
  15178. // application is likely to deal with though a single, unified
  15179. // interface. DOM programmers may want to think of it as
  15180. // "addEventListener for everything and anything".
  15181. //
  15182. // When setting up a connection, the `event` parameter must be a
  15183. // string that is the name of the method/event to be listened for. If
  15184. // `obj` is null, `kernel.global` is assumed, meaning that connections
  15185. // to global methods are supported but also that you may inadvertently
  15186. // connect to a global by passing an incorrect object name or invalid
  15187. // reference.
  15188. //
  15189. // `dojo.connect` generally is forgiving. If you pass the name of a
  15190. // function or method that does not yet exist on `obj`, connect will
  15191. // not fail, but will instead set up a stub method. Similarly, null
  15192. // arguments may simply be omitted such that fewer than 4 arguments
  15193. // may be required to set up a connection See the examples for details.
  15194. //
  15195. // The return value is a handle that is needed to
  15196. // remove this connection with `dojo.disconnect`.
  15197. //
  15198. // obj: Object|null:
  15199. // The source object for the event function.
  15200. // Defaults to `kernel.global` if null.
  15201. // If obj is a DOM node, the connection is delegated
  15202. // to the DOM event manager (unless dontFix is true).
  15203. //
  15204. // event: String:
  15205. // String name of the event function in obj.
  15206. // I.e. identifies a property `obj[event]`.
  15207. //
  15208. // context: Object|null
  15209. // The object that method will receive as "this".
  15210. //
  15211. // If context is null and method is a function, then method
  15212. // inherits the context of event.
  15213. //
  15214. // If method is a string then context must be the source
  15215. // object object for method (context[method]). If context is null,
  15216. // kernel.global is used.
  15217. //
  15218. // method: String|Function:
  15219. // A function reference, or name of a function in context.
  15220. // The function identified by method fires after event does.
  15221. // method receives the same arguments as the event.
  15222. // See context argument comments for information on method's scope.
  15223. //
  15224. // dontFix: Boolean?
  15225. // If obj is a DOM node, set dontFix to true to prevent delegation
  15226. // of this connection to the DOM event manager.
  15227. //
  15228. // example:
  15229. // When obj.onchange(), do ui.update():
  15230. // | dojo.connect(obj, "onchange", ui, "update");
  15231. // | dojo.connect(obj, "onchange", ui, ui.update); // same
  15232. //
  15233. // example:
  15234. // Using return value for disconnect:
  15235. // | var link = dojo.connect(obj, "onchange", ui, "update");
  15236. // | ...
  15237. // | dojo.disconnect(link);
  15238. //
  15239. // example:
  15240. // When onglobalevent executes, watcher.handler is invoked:
  15241. // | dojo.connect(null, "onglobalevent", watcher, "handler");
  15242. //
  15243. // example:
  15244. // When ob.onCustomEvent executes, customEventHandler is invoked:
  15245. // | dojo.connect(ob, "onCustomEvent", null, "customEventHandler");
  15246. // | dojo.connect(ob, "onCustomEvent", "customEventHandler"); // same
  15247. //
  15248. // example:
  15249. // When ob.onCustomEvent executes, customEventHandler is invoked
  15250. // with the same scope (this):
  15251. // | dojo.connect(ob, "onCustomEvent", null, customEventHandler);
  15252. // | dojo.connect(ob, "onCustomEvent", customEventHandler); // same
  15253. //
  15254. // example:
  15255. // When globalEvent executes, globalHandler is invoked
  15256. // with the same scope (this):
  15257. // | dojo.connect(null, "globalEvent", null, globalHandler);
  15258. // | dojo.connect("globalEvent", globalHandler); // same
  15259. }
  15260. =====*/
  15261. /*=====
  15262. dojo.disconnect = function(handle){
  15263. // summary:
  15264. // Remove a link created by dojo.connect.
  15265. // description:
  15266. // Removes the connection between event and the method referenced by handle.
  15267. // handle: Handle:
  15268. // the return value of the dojo.connect call that created the connection.
  15269. }
  15270. =====*/
  15271. /*=====
  15272. dojo.subscribe = function(topic, context, method){
  15273. // summary:
  15274. // Attach a listener to a named topic. The listener function is invoked whenever the
  15275. // named topic is published (see: dojo.publish).
  15276. // Returns a handle which is needed to unsubscribe this listener.
  15277. // topic: String:
  15278. // The topic to which to subscribe.
  15279. // context: Object|null:
  15280. // Scope in which method will be invoked, or null for default scope.
  15281. // method: String|Function:
  15282. // The name of a function in context, or a function reference. This is the function that
  15283. // is invoked when topic is published.
  15284. // example:
  15285. // | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); });
  15286. // | dojo.publish("alerts", [ "read this", "hello world" ]);
  15287. }
  15288. =====*/
  15289. /*=====
  15290. dojo.unsubscribe = function(handle){
  15291. // summary:
  15292. // Remove a topic listener.
  15293. // handle: Handle
  15294. // The handle returned from a call to subscribe.
  15295. // example:
  15296. // | var alerter = dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
  15297. // | ...
  15298. // | dojo.unsubscribe(alerter);
  15299. }
  15300. =====*/
  15301. /*=====
  15302. dojo.publish = function(topic, args){
  15303. // summary:
  15304. // Invoke all listener method subscribed to topic.
  15305. // topic: String:
  15306. // The name of the topic to publish.
  15307. // args: Array?
  15308. // An array of arguments. The arguments will be applied
  15309. // to each topic subscriber (as first class parameters, via apply).
  15310. // example:
  15311. // | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
  15312. // | dojo.publish("alerts", [ "read this", "hello world" ]);
  15313. }
  15314. =====*/
  15315. /*=====
  15316. dojo.connectPublisher = function(topic, obj, event){
  15317. // summary:
  15318. // Ensure that every time obj.event() is called, a message is published
  15319. // on the topic. Returns a handle which can be passed to
  15320. // dojo.disconnect() to disable subsequent automatic publication on
  15321. // the topic.
  15322. // topic: String:
  15323. // The name of the topic to publish.
  15324. // obj: Object|null:
  15325. // The source object for the event function. Defaults to kernel.global
  15326. // if null.
  15327. // event: String:
  15328. // The name of the event function in obj.
  15329. // I.e. identifies a property obj[event].
  15330. // example:
  15331. // | dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
  15332. }
  15333. =====*/
  15334. /*=====
  15335. dojo.isCopyKey = function(e){
  15336. // summary:
  15337. // Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
  15338. // e: Event
  15339. // Event object to examine
  15340. }
  15341. =====*/
  15342. });
  15343. }}});
  15344. (function(){
  15345. // must use this.require to make this work in node.js
  15346. var require = this.require;
  15347. // consume the cached dojo layer
  15348. require({cache:{}});
  15349. !require.async && require(["dojo"]);
  15350. require.boot && require.apply(null, require.boot);
  15351. })();