123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357 |
- if(!dojo._hasResource["dojo.window"]){
- dojo._hasResource["dojo.window"] = true;
- dojo.provide("dojo.window");
- dojo.getObject("window", true, dojo);
- dojo.window.getBox = function(){
-
-
- var scrollRoot = (dojo.doc.compatMode == 'BackCompat') ? dojo.body() : dojo.doc.documentElement;
-
- var scroll = dojo._docScroll();
- return { w: scrollRoot.clientWidth, h: scrollRoot.clientHeight, l: scroll.x, t: scroll.y };
- };
- dojo.window.get = function(doc){
-
-
-
-
-
-
- if(dojo.isIE && window !== document.parentWindow){
-
- doc.parentWindow.execScript("document._parentWindow = window;", "Javascript");
-
-
- var win = doc._parentWindow;
- doc._parentWindow = null;
- return win;
- }
- return doc.parentWindow || doc.defaultView;
- };
- dojo.window.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
-
-
-
-
-
-
-
- node = dojo.byId(node);
- var body, doc = node.ownerDocument || dojo.doc;
-
- if(!("rtl_adjust_position_for_verticalScrollBar" in dojo.window)){
- body = dojo.body();
- var scrollable = dojo.create('div', {
- style: {overflow:'scroll', overflowX:'visible', direction:'rtl', visibility:'hidden', position:'absolute', left:'0', top:'0', width:'64px', height:'64px'}
- }, body, "last"),
- div = dojo.create('div', {
- style: {overflow:'hidden', direction:'ltr'}
- }, scrollable, "last");
- dojo.window.rtl_adjust_position_for_verticalScrollBar = dojo.position(div).x != 0;
- scrollable.removeChild(div);
- body.removeChild(scrollable);
- }
- if(!("position_fixed_support" in dojo.window)){
-
- body = dojo.body();
- var outer = dojo.create('span', {
- style: {visibility:'hidden', position:'fixed', left:'1px', top:'1px'}
- }, body, "last"),
- inner = dojo.create('span', {
- style: {position:'fixed', left:'0', top:'0'}
- }, outer, "last");
- dojo.window.position_fixed_support = dojo.position(inner).x != dojo.position(outer).x;
- outer.removeChild(inner);
- body.removeChild(outer);
- }
- try{
- body = doc.body || doc.getElementsByTagName("body")[0];
- var html = doc.documentElement || body.parentNode,
- isIE = dojo.isIE,
- isWK = dojo.isWebKit;
-
- if(node == body || node == html){ return; }
- if(!(dojo.isMozilla || isIE || isWK || dojo.isOpera) && ("scrollIntoView" in node)){
- node.scrollIntoView(false);
- return;
- }
- var backCompat = doc.compatMode == 'BackCompat',
- rootWidth = Math.min(body.clientWidth || html.clientWidth, html.clientWidth || body.clientWidth),
- rootHeight = Math.min(body.clientHeight || html.clientHeight, html.clientHeight || body.clientHeight),
- scrollRoot = (isWK || backCompat) ? body : html,
- nodePos = pos || dojo.position(node),
- el = node.parentNode,
- isFixed = function(el){
- return (isIE <= 6 || (isIE == 7 && backCompat))
- ? false
- : (dojo.window.position_fixed_support && (dojo.style(el, 'position').toLowerCase() == "fixed"));
- };
- if(isFixed(node)){ return; }
- while(el){
- if(el == body){ el = scrollRoot; }
- var elPos = dojo.position(el),
- fixedPos = isFixed(el),
- rtl = dojo.getComputedStyle(el).direction.toLowerCase() == "rtl";
-
- if(el == scrollRoot){
- elPos.w = rootWidth; elPos.h = rootHeight;
- if(scrollRoot == html && isIE && rtl){ elPos.x += scrollRoot.offsetWidth-elPos.w; }
- if(elPos.x < 0 || !isIE || isIE >= 9){ elPos.x = 0; }
- if(elPos.y < 0 || !isIE || isIE >= 9){ elPos.y = 0; }
- }else{
- var pb = dojo._getPadBorderExtents(el);
- elPos.w -= pb.w; elPos.h -= pb.h; elPos.x += pb.l; elPos.y += pb.t;
- var clientSize = el.clientWidth,
- scrollBarSize = elPos.w - clientSize;
- if(clientSize > 0 && scrollBarSize > 0){
- if(rtl && dojo.window.rtl_adjust_position_for_verticalScrollBar){
- elPos.x += scrollBarSize;
- }
- elPos.w = clientSize;
- }
- clientSize = el.clientHeight;
- scrollBarSize = elPos.h - clientSize;
- if(clientSize > 0 && scrollBarSize > 0){
- elPos.h = clientSize;
- }
- }
- if(fixedPos){
- if(elPos.y < 0){
- elPos.h += elPos.y; elPos.y = 0;
- }
- if(elPos.x < 0){
- elPos.w += elPos.x; elPos.x = 0;
- }
- if(elPos.y + elPos.h > rootHeight){
- elPos.h = rootHeight - elPos.y;
- }
- if(elPos.x + elPos.w > rootWidth){
- elPos.w = rootWidth - elPos.x;
- }
- }
-
- var l = nodePos.x - elPos.x,
- t = nodePos.y - elPos.y,
- r = l + nodePos.w - elPos.w,
- bot = t + nodePos.h - elPos.h;
- var s, old;
- if(r * l > 0 && (!!el.scrollLeft || el == scrollRoot || el.scrollWidth > el.offsetHeight)){
- s = Math[l < 0? "max" : "min"](l, r);
- if(rtl && ((isIE == 8 && !backCompat) || isIE >= 9)){ s = -s; }
- old = el.scrollLeft;
- el.scrollLeft += s;
- s = el.scrollLeft - old;
- nodePos.x -= s;
- }
- if(bot * t > 0 && (!!el.scrollTop || el == scrollRoot || el.scrollHeight > el.offsetHeight)){
- s = Math.ceil(Math[t < 0? "max" : "min"](t, bot));
- old = el.scrollTop;
- el.scrollTop += s;
- s = el.scrollTop - old;
- nodePos.y -= s;
- }
- el = (el != scrollRoot) && !fixedPos && el.parentNode;
- }
- }catch(error){
- console.error('scrollIntoView: ' + error);
- node.scrollIntoView(false);
- }
- };
- }
- if(!dojo._hasResource["dijit._base.manager"]){
- dojo._hasResource["dijit._base.manager"] = true;
- dojo.provide("dijit._base.manager");
- dojo.declare("dijit.WidgetSet", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- constructor: function(){
- this._hash = {};
- this.length = 0;
- },
- add: function(/*dijit._Widget*/ widget){
-
-
-
-
-
- if(this._hash[widget.id]){
- throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
- }
- this._hash[widget.id] = widget;
- this.length++;
- },
- remove: function(/*String*/ id){
-
-
-
- if(this._hash[id]){
- delete this._hash[id];
- this.length--;
- }
- },
- forEach: function(/*Function*/ func, /* Object? */thisObj){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var i = 0, id;
- for(id in this._hash){
- func.call(thisObj, this._hash[id], i++, this._hash);
- }
- return this;
- },
- filter: function(/*Function*/ filter, /* Object? */thisObj){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var res = new dijit.WidgetSet(), i = 0, id;
- for(id in this._hash){
- var w = this._hash[id];
- if(filter.call(thisObj, w, i++, this._hash)){
- res.add(w);
- }
- }
- return res;
- },
- byId: function(/*String*/ id){
-
-
-
-
-
-
-
-
- return this._hash[id];
- },
- byClass: function(/*String*/ cls){
-
-
-
-
-
-
-
-
-
- var res = new dijit.WidgetSet(), id, widget;
- for(id in this._hash){
- widget = this._hash[id];
- if(widget.declaredClass == cls){
- res.add(widget);
- }
- }
- return res;
- },
- toArray: function(){
-
-
-
-
-
-
- var ar = [];
- for(var id in this._hash){
- ar.push(this._hash[id]);
- }
- return ar;
- },
- map: function(/* Function */func, /* Object? */thisObj){
-
-
-
-
-
-
-
- return dojo.map(this.toArray(), func, thisObj);
- },
- every: function(func, thisObj){
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var x = 0, i;
- for(i in this._hash){
- if(!func.call(thisObj, this._hash[i], x++, this._hash)){
- return false;
- }
- }
- return true;
- },
- some: function(func, thisObj){
-
-
-
-
-
-
-
-
-
- thisObj = thisObj || dojo.global;
- var x = 0, i;
- for(i in this._hash){
- if(func.call(thisObj, this._hash[i], x++, this._hash)){
- return true;
- }
- }
- return false;
- }
- });
- (function(){
-
- dijit.registry = new dijit.WidgetSet();
- var hash = dijit.registry._hash,
- attr = dojo.attr,
- hasAttr = dojo.hasAttr,
- style = dojo.style;
- dijit.byId = function(/*String|dijit._Widget*/ id){
-
-
- return typeof id == "string" ? hash[id] : id;
- };
- var _widgetTypeCtr = {};
- dijit.getUniqueId = function(/*String*/widgetType){
-
-
-
- var id;
- do{
- id = widgetType + "_" +
- (widgetType in _widgetTypeCtr ?
- ++_widgetTypeCtr[widgetType] : _widgetTypeCtr[widgetType] = 0);
- }while(hash[id]);
- return dijit._scopeName == "dijit" ? id : dijit._scopeName + "_" + id;
- };
-
- dijit.findWidgets = function(/*DomNode*/ root){
-
-
-
-
- var outAry = [];
-
- function getChildrenHelper(root){
- for(var node = root.firstChild; node; node = node.nextSibling){
- if(node.nodeType == 1){
- var widgetId = node.getAttribute("widgetId");
- if(widgetId){
- var widget = hash[widgetId];
- if(widget){
- outAry.push(widget);
- }
- }else{
- getChildrenHelper(node);
- }
- }
- }
- }
-
- getChildrenHelper(root);
- return outAry;
- };
-
- dijit._destroyAll = function(){
-
-
-
-
- dijit._curFocus = null;
- dijit._prevFocus = null;
- dijit._activeStack = [];
-
-
- dojo.forEach(dijit.findWidgets(dojo.body()), function(widget){
-
-
- if(!widget._destroyed){
- if(widget.destroyRecursive){
- widget.destroyRecursive();
- }else if(widget.destroy){
- widget.destroy();
- }
- }
- });
- };
-
- if(dojo.isIE){
-
-
- dojo.addOnWindowUnload(function(){
- dijit._destroyAll();
- });
- }
-
- dijit.byNode = function(/*DOMNode*/ node){
-
-
- return hash[node.getAttribute("widgetId")];
- };
-
- dijit.getEnclosingWidget = function(/*DOMNode*/ node){
-
-
-
- while(node){
- var id = node.getAttribute && node.getAttribute("widgetId");
- if(id){
- return hash[id];
- }
- node = node.parentNode;
- }
- return null;
- };
- var shown = (dijit._isElementShown = function(/*Element*/ elem){
- var s = style(elem);
- return (s.visibility != "hidden")
- && (s.visibility != "collapsed")
- && (s.display != "none")
- && (attr(elem, "type") != "hidden");
- });
-
- dijit.hasDefaultTabStop = function(/*Element*/ elem){
-
-
-
-
- switch(elem.nodeName.toLowerCase()){
- case "a":
-
- return hasAttr(elem, "href");
- case "area":
- case "button":
- case "input":
- case "object":
- case "select":
- case "textarea":
-
- return true;
- case "iframe":
-
- var body;
- try{
-
- var contentDocument = elem.contentDocument;
- if("designMode" in contentDocument && contentDocument.designMode == "on"){
- return true;
- }
- body = contentDocument.body;
- }catch(e1){
-
-
-
- try{
- body = elem.contentWindow.document.body;
- }catch(e2){
- return false;
- }
- }
- return body.contentEditable == 'true' || (body.firstChild && body.firstChild.contentEditable == 'true');
- default:
- return elem.contentEditable == 'true';
- }
- };
-
- var isTabNavigable = (dijit.isTabNavigable = function(/*Element*/ elem){
-
-
-
-
- if(attr(elem, "disabled")){
- return false;
- }else if(hasAttr(elem, "tabIndex")){
-
- return attr(elem, "tabIndex") >= 0;
- }else{
-
- return dijit.hasDefaultTabStop(elem);
- }
- });
- dijit._getTabNavigable = function(/*DOMNode*/ root){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var first, last, lowest, lowestTabindex, highest, highestTabindex, radioSelected = {};
- function radioName(node) {
-
- return node && node.tagName.toLowerCase() == "input" &&
- node.type && node.type.toLowerCase() == "radio" &&
- node.name && node.name.toLowerCase();
- }
- var walkTree = function(/*DOMNode*/parent){
- dojo.query("> *", parent).forEach(function(child){
-
-
- if((dojo.isIE <= 9 && child.scopeName !== "HTML") || !shown(child)){
- return;
- }
- if(isTabNavigable(child)){
- var tabindex = attr(child, "tabIndex");
- if(!hasAttr(child, "tabIndex") || tabindex == 0){
- if(!first){ first = child; }
- last = child;
- }else if(tabindex > 0){
- if(!lowest || tabindex < lowestTabindex){
- lowestTabindex = tabindex;
- lowest = child;
- }
- if(!highest || tabindex >= highestTabindex){
- highestTabindex = tabindex;
- highest = child;
- }
- }
- var rn = radioName(child);
- if(dojo.attr(child, "checked") && rn) {
- radioSelected[rn] = child;
- }
- }
- if(child.nodeName.toUpperCase() != 'SELECT'){
- walkTree(child);
- }
- });
- };
- if(shown(root)){ walkTree(root) }
- function rs(node) {
-
- return radioSelected[radioName(node)] || node;
- }
- return { first: rs(first), last: rs(last), lowest: rs(lowest), highest: rs(highest) };
- }
- dijit.getFirstInTabbingOrder = function(/*String|DOMNode*/ root){
-
-
-
- var elems = dijit._getTabNavigable(dojo.byId(root));
- return elems.lowest ? elems.lowest : elems.first;
- };
-
- dijit.getLastInTabbingOrder = function(/*String|DOMNode*/ root){
-
-
-
- var elems = dijit._getTabNavigable(dojo.byId(root));
- return elems.last ? elems.last : elems.highest;
- };
-
-
-
- dijit.defaultDuration = dojo.config["defaultDuration"] || 200;
- })();
- }
- if(!dojo._hasResource["dijit._base.focus"]){
- dojo._hasResource["dijit._base.focus"] = true;
- dojo.provide("dijit._base.focus");
- dojo.mixin(dijit, {
-
-
- _curFocus: null,
-
-
- _prevFocus: null,
- isCollapsed: function(){
-
-
- return dijit.getBookmark().isCollapsed;
- },
- getBookmark: function(){
-
-
- var bm, rg, tg, sel = dojo.doc.selection, cf = dijit._curFocus;
- if(dojo.global.getSelection){
-
- sel = dojo.global.getSelection();
- if(sel){
- if(sel.isCollapsed){
- tg = cf? cf.tagName : "";
- if(tg){
-
- tg = tg.toLowerCase();
- if(tg == "textarea" ||
- (tg == "input" && (!cf.type || cf.type.toLowerCase() == "text"))){
- sel = {
- start: cf.selectionStart,
- end: cf.selectionEnd,
- node: cf,
- pRange: true
- };
- return {isCollapsed: (sel.end <= sel.start), mark: sel};
- }
- }
- bm = {isCollapsed:true};
- if(sel.rangeCount){
- bm.mark = sel.getRangeAt(0).cloneRange();
- }
- }else{
- rg = sel.getRangeAt(0);
- bm = {isCollapsed: false, mark: rg.cloneRange()};
- }
- }
- }else if(sel){
-
-
-
- tg = cf ? cf.tagName : "";
- tg = tg.toLowerCase();
- if(cf && tg && (tg == "button" || tg == "textarea" || tg == "input")){
- if(sel.type && sel.type.toLowerCase() == "none"){
- return {
- isCollapsed: true,
- mark: null
- }
- }else{
- rg = sel.createRange();
- return {
- isCollapsed: rg.text && rg.text.length?false:true,
- mark: {
- range: rg,
- pRange: true
- }
- };
- }
- }
- bm = {};
-
- try{
-
-
- rg = sel.createRange();
- bm.isCollapsed = !(sel.type == 'Text' ? rg.htmlText.length : rg.length);
- }catch(e){
- bm.isCollapsed = true;
- return bm;
- }
- if(sel.type.toUpperCase() == 'CONTROL'){
- if(rg.length){
- bm.mark=[];
- var i=0,len=rg.length;
- while(i<len){
- bm.mark.push(rg.item(i++));
- }
- }else{
- bm.isCollapsed = true;
- bm.mark = null;
- }
- }else{
- bm.mark = rg.getBookmark();
- }
- }else{
- console.warn("No idea how to store the current selection for this browser!");
- }
- return bm;
- },
- moveToBookmark: function(/*Object*/bookmark){
-
-
-
-
- var _doc = dojo.doc,
- mark = bookmark.mark;
- if(mark){
- if(dojo.global.getSelection){
-
- var sel = dojo.global.getSelection();
- if(sel && sel.removeAllRanges){
- if(mark.pRange){
- var r = mark;
- var n = r.node;
- n.selectionStart = r.start;
- n.selectionEnd = r.end;
- }else{
- sel.removeAllRanges();
- sel.addRange(mark);
- }
- }else{
- console.warn("No idea how to restore selection for this browser!");
- }
- }else if(_doc.selection && mark){
-
- var rg;
- if(mark.pRange){
- rg = mark.range;
- }else if(dojo.isArray(mark)){
- rg = _doc.body.createControlRange();
-
-
- dojo.forEach(mark, function(n){
- rg.addElement(n);
- });
- }else{
- rg = _doc.body.createTextRange();
- rg.moveToBookmark(mark);
- }
- rg.select();
- }
- }
- },
- getFocus: function(/*Widget?*/ menu, /*Window?*/ openedForWindow){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = !dijit._curFocus || (menu && dojo.isDescendant(dijit._curFocus, menu.domNode)) ? dijit._prevFocus : dijit._curFocus;
- return {
- node: node,
- bookmark: (node == dijit._curFocus) && dojo.withGlobal(openedForWindow || dojo.global, dijit.getBookmark),
- openedForWindow: openedForWindow
- };
- },
- focus: function(/*Object || DomNode */ handle){
-
-
-
-
-
- if(!handle){ return; }
- var node = "node" in handle ? handle.node : handle,
- bookmark = handle.bookmark,
- openedForWindow = handle.openedForWindow,
- collapsed = bookmark ? bookmark.isCollapsed : false;
-
-
-
- if(node){
- var focusNode = (node.tagName.toLowerCase() == "iframe") ? node.contentWindow : node;
- if(focusNode && focusNode.focus){
- try{
-
-
- focusNode.focus();
- }catch(e){}
- }
- dijit._onFocusNode(node);
- }
-
-
-
-
- if(bookmark && dojo.withGlobal(openedForWindow || dojo.global, dijit.isCollapsed) && !collapsed){
- if(openedForWindow){
- openedForWindow.focus();
- }
- try{
- dojo.withGlobal(openedForWindow || dojo.global, dijit.moveToBookmark, null, [bookmark]);
- }catch(e2){
-
- }
- }
- },
-
-
- _activeStack: [],
- registerIframe: function(/*DomNode*/ iframe){
-
-
-
-
-
-
-
-
- return dijit.registerWin(iframe.contentWindow, iframe);
- },
- unregisterIframe: function(/*Object*/ handle){
-
-
-
-
-
- dijit.unregisterWin(handle);
- },
- registerWin: function(/*Window?*/targetWindow, /*DomNode?*/ effectiveNode){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var mousedownListener = function(evt){
- dijit._justMouseDowned = true;
- setTimeout(function(){ dijit._justMouseDowned = false; }, 0);
-
-
-
- if(dojo.isIE && evt && evt.srcElement && evt.srcElement.parentNode == null){
- return;
- }
- dijit._onTouchNode(effectiveNode || evt.target || evt.srcElement, "mouse");
- };
-
-
-
-
-
-
-
- var doc = dojo.isIE ? targetWindow.document.documentElement : targetWindow.document;
- if(doc){
- if(dojo.isIE){
- targetWindow.document.body.attachEvent('onmousedown', mousedownListener);
- var activateListener = function(evt){
-
-
- if(evt.srcElement.tagName.toLowerCase() != "#document" &&
- dijit.isTabNavigable(evt.srcElement)){
- dijit._onFocusNode(effectiveNode || evt.srcElement);
- }else{
- dijit._onTouchNode(effectiveNode || evt.srcElement);
- }
- };
- doc.attachEvent('onactivate', activateListener);
- var deactivateListener = function(evt){
- dijit._onBlurNode(effectiveNode || evt.srcElement);
- };
- doc.attachEvent('ondeactivate', deactivateListener);
- return function(){
- targetWindow.document.detachEvent('onmousedown', mousedownListener);
- doc.detachEvent('onactivate', activateListener);
- doc.detachEvent('ondeactivate', deactivateListener);
- doc = null;
- };
- }else{
- doc.body.addEventListener('mousedown', mousedownListener, true);
- var focusListener = function(evt){
- dijit._onFocusNode(effectiveNode || evt.target);
- };
- doc.addEventListener('focus', focusListener, true);
- var blurListener = function(evt){
- dijit._onBlurNode(effectiveNode || evt.target);
- };
- doc.addEventListener('blur', blurListener, true);
- return function(){
- doc.body.removeEventListener('mousedown', mousedownListener, true);
- doc.removeEventListener('focus', focusListener, true);
- doc.removeEventListener('blur', blurListener, true);
- doc = null;
- };
- }
- }
- },
- unregisterWin: function(/*Handle*/ handle){
-
-
-
-
-
- handle && handle();
- },
- _onBlurNode: function(/*DomNode*/ node){
-
-
-
-
-
- dijit._prevFocus = dijit._curFocus;
- dijit._curFocus = null;
- if(dijit._justMouseDowned){
-
-
- return;
- }
-
- if(dijit._clearActiveWidgetsTimer){
- clearTimeout(dijit._clearActiveWidgetsTimer);
- }
- dijit._clearActiveWidgetsTimer = setTimeout(function(){
- delete dijit._clearActiveWidgetsTimer;
- dijit._setStack([]);
- dijit._prevFocus = null;
- }, 100);
- },
- _onTouchNode: function(/*DomNode*/ node, /*String*/ by){
-
-
-
-
-
-
-
- if(dijit._clearActiveWidgetsTimer){
- clearTimeout(dijit._clearActiveWidgetsTimer);
- delete dijit._clearActiveWidgetsTimer;
- }
-
- var newStack=[];
- try{
- while(node){
- var popupParent = dojo.attr(node, "dijitPopupParent");
- if(popupParent){
- node=dijit.byId(popupParent).domNode;
- }else if(node.tagName && node.tagName.toLowerCase() == "body"){
-
- if(node === dojo.body()){
-
- break;
- }
-
-
- node=dojo.window.get(node.ownerDocument).frameElement;
- }else{
-
-
-
- var id = node.getAttribute && node.getAttribute("widgetId"),
- widget = id && dijit.byId(id);
- if(widget && !(by == "mouse" && widget.get("disabled"))){
- newStack.unshift(id);
- }
- node=node.parentNode;
- }
- }
- }catch(e){ }
- dijit._setStack(newStack, by);
- },
- _onFocusNode: function(/*DomNode*/ node){
-
-
- if(!node){
- return;
- }
- if(node.nodeType == 9){
-
-
-
- return;
- }
- dijit._onTouchNode(node);
- if(node == dijit._curFocus){ return; }
- if(dijit._curFocus){
- dijit._prevFocus = dijit._curFocus;
- }
- dijit._curFocus = node;
- dojo.publish("focusNode", [node]);
- },
- _setStack: function(/*String[]*/ newStack, /*String*/ by){
-
-
-
-
-
-
- var oldStack = dijit._activeStack;
- dijit._activeStack = newStack;
-
- for(var nCommon=0; nCommon<Math.min(oldStack.length, newStack.length); nCommon++){
- if(oldStack[nCommon] != newStack[nCommon]){
- break;
- }
- }
- var widget;
-
- for(var i=oldStack.length-1; i>=nCommon; i--){
- widget = dijit.byId(oldStack[i]);
- if(widget){
- widget._focused = false;
- widget.set("focused", false);
- widget._hasBeenBlurred = true;
- if(widget._onBlur){
- widget._onBlur(by);
- }
- dojo.publish("widgetBlur", [widget, by]);
- }
- }
-
- for(i=nCommon; i<newStack.length; i++){
- widget = dijit.byId(newStack[i]);
- if(widget){
- widget._focused = true;
- widget.set("focused", true);
- if(widget._onFocus){
- widget._onFocus(by);
- }
- dojo.publish("widgetFocus", [widget, by]);
- }
- }
- }
- });
- dojo.addOnLoad(function(){
- var handle = dijit.registerWin(window);
- if(dojo.isIE){
- dojo.addOnWindowUnload(function(){
- dijit.unregisterWin(handle);
- handle = null;
- })
- }
- });
- }
- if(!dojo._hasResource["dojo.AdapterRegistry"]){
- dojo._hasResource["dojo.AdapterRegistry"] = true;
- dojo.provide("dojo.AdapterRegistry");
- dojo.AdapterRegistry = function(/*Boolean?*/ returnWrappers){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.pairs = [];
- this.returnWrappers = returnWrappers || false;
- };
- dojo.extend(dojo.AdapterRegistry, {
- register: function(/*String*/ name, /*Function*/ check, /*Function*/ wrap, /*Boolean?*/ directReturn, /*Boolean?*/ override){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.pairs[((override) ? "unshift" : "push")]([name, check, wrap, directReturn]);
- },
- match: function(/* ... */){
-
-
-
-
-
- for(var i = 0; i < this.pairs.length; i++){
- var pair = this.pairs[i];
- if(pair[1].apply(this, arguments)){
- if((pair[3])||(this.returnWrappers)){
- return pair[2];
- }else{
- return pair[2].apply(this, arguments);
- }
- }
- }
- throw new Error("No match found");
- },
- unregister: function(name){
-
-
-
-
- for(var i = 0; i < this.pairs.length; i++){
- var pair = this.pairs[i];
- if(pair[0] == name){
- this.pairs.splice(i, 1);
- return true;
- }
- }
- return false;
- }
- });
- }
- if(!dojo._hasResource["dijit._base.place"]){
- dojo._hasResource["dijit._base.place"] = true;
- dojo.provide("dijit._base.place");
- dijit.getViewport = function(){
-
-
- return dojo.window.getBox();
- };
- dijit.placeOnScreen = function(
- /* DomNode */ node,
- /* dijit.__Position */ pos,
- /* String[] */ corners,
- /* dijit.__Position? */ padding){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var choices = dojo.map(corners, function(corner){
- var c = { corner: corner, pos: {x:pos.x,y:pos.y} };
- if(padding){
- c.pos.x += corner.charAt(1) == 'L' ? padding.x : -padding.x;
- c.pos.y += corner.charAt(0) == 'T' ? padding.y : -padding.y;
- }
- return c;
- });
- return dijit._place(node, choices);
- }
- dijit._place = function(/*DomNode*/ node, choices, layoutNode, /*Object*/ aroundNodeCoords){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var view = dojo.window.getBox();
-
-
-
- if(!node.parentNode || String(node.parentNode.tagName).toLowerCase() != "body"){
- dojo.body().appendChild(node);
- }
- var best = null;
- dojo.some(choices, function(choice){
- var corner = choice.corner;
- var pos = choice.pos;
- var overflow = 0;
-
- var spaceAvailable = {
- w: corner.charAt(1) == 'L' ? (view.l + view.w) - pos.x : pos.x - view.l,
- h: corner.charAt(1) == 'T' ? (view.t + view.h) - pos.y : pos.y - view.t
- };
-
-
-
- if(layoutNode){
- var res = layoutNode(node, choice.aroundCorner, corner, spaceAvailable, aroundNodeCoords);
- overflow = typeof res == "undefined" ? 0 : res;
- }
-
- var style = node.style;
- var oldDisplay = style.display;
- var oldVis = style.visibility;
- style.visibility = "hidden";
- style.display = "";
- var mb = dojo.marginBox(node);
- style.display = oldDisplay;
- style.visibility = oldVis;
-
-
- var startX = Math.max(view.l, corner.charAt(1) == 'L' ? pos.x : (pos.x - mb.w)),
- startY = Math.max(view.t, corner.charAt(0) == 'T' ? pos.y : (pos.y - mb.h)),
- endX = Math.min(view.l + view.w, corner.charAt(1) == 'L' ? (startX + mb.w) : pos.x),
- endY = Math.min(view.t + view.h, corner.charAt(0) == 'T' ? (startY + mb.h) : pos.y),
- width = endX - startX,
- height = endY - startY;
- overflow += (mb.w - width) + (mb.h - height);
- if(best == null || overflow < best.overflow){
- best = {
- corner: corner,
- aroundCorner: choice.aroundCorner,
- x: startX,
- y: startY,
- w: width,
- h: height,
- overflow: overflow,
- spaceAvailable: spaceAvailable
- };
- }
-
- return !overflow;
- });
-
-
- if(best.overflow && layoutNode){
- layoutNode(node, best.aroundCorner, best.corner, best.spaceAvailable, aroundNodeCoords);
- }
-
-
-
-
-
-
-
- var l = dojo._isBodyLtr(),
- s = node.style;
- s.top = best.y + "px";
- s[l ? "left" : "right"] = (l ? best.x : view.w - best.x - best.w) + "px";
- s[l ? "right" : "left"] = "auto";
- return best;
- }
- dijit.placeOnScreenAroundNode = function(
- /* DomNode */ node,
- /* DomNode */ aroundNode,
- /* Object */ aroundCorners,
- /* Function? */ layoutNode){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- aroundNode = dojo.byId(aroundNode);
- var aroundNodePos = dojo.position(aroundNode, true);
-
- return dijit._placeOnScreenAroundRect(node,
- aroundNodePos.x, aroundNodePos.y, aroundNodePos.w, aroundNodePos.h,
- aroundCorners, layoutNode);
- };
- dijit.placeOnScreenAroundRectangle = function(
- /* DomNode */ node,
- /* dijit.__Rectangle */ aroundRect,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
-
- return dijit._placeOnScreenAroundRect(node,
- aroundRect.x, aroundRect.y, aroundRect.width, aroundRect.height,
- aroundCorners, layoutNode);
- };
- dijit._placeOnScreenAroundRect = function(
- /* DomNode */ node,
- /* Number */ x,
- /* Number */ y,
- /* Number */ width,
- /* Number */ height,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
-
-
- var choices = [];
- for(var nodeCorner in aroundCorners){
- choices.push( {
- aroundCorner: nodeCorner,
- corner: aroundCorners[nodeCorner],
- pos: {
- x: x + (nodeCorner.charAt(1) == 'L' ? 0 : width),
- y: y + (nodeCorner.charAt(0) == 'T' ? 0 : height)
- }
- });
- }
- return dijit._place(node, choices, layoutNode, {w: width, h: height});
- };
- dijit.placementRegistry= new dojo.AdapterRegistry();
- dijit.placementRegistry.register("node",
- function(n, x){
- return typeof x == "object" &&
- typeof x.offsetWidth != "undefined" && typeof x.offsetHeight != "undefined";
- },
- dijit.placeOnScreenAroundNode);
- dijit.placementRegistry.register("rect",
- function(n, x){
- return typeof x == "object" &&
- "x" in x && "y" in x && "width" in x && "height" in x;
- },
- dijit.placeOnScreenAroundRectangle);
- dijit.placeOnScreenAroundElement = function(
- /* DomNode */ node,
- /* Object */ aroundElement,
- /* Object */ aroundCorners,
- /* Function */ layoutNode){
-
-
-
- return dijit.placementRegistry.match.apply(dijit.placementRegistry, arguments);
- };
- dijit.getPopupAroundAlignment = function(/*Array*/ position, /*Boolean*/ leftToRight){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var align = {};
- dojo.forEach(position, function(pos){
- switch(pos){
- case "after":
- align[leftToRight ? "BR" : "BL"] = leftToRight ? "BL" : "BR";
- break;
- case "before":
- align[leftToRight ? "BL" : "BR"] = leftToRight ? "BR" : "BL";
- break;
- case "below-alt":
- leftToRight = !leftToRight;
-
- case "below":
-
- align[leftToRight ? "BL" : "BR"] = leftToRight ? "TL" : "TR";
- align[leftToRight ? "BR" : "BL"] = leftToRight ? "TR" : "TL";
- break;
- case "above-alt":
- leftToRight = !leftToRight;
-
- case "above":
- default:
-
- align[leftToRight ? "TL" : "TR"] = leftToRight ? "BL" : "BR";
- align[leftToRight ? "TR" : "TL"] = leftToRight ? "BR" : "BL";
- break;
- }
- });
- return align;
- };
- }
- if(!dojo._hasResource["dijit._base.window"]){
- dojo._hasResource["dijit._base.window"] = true;
- dojo.provide("dijit._base.window");
- dijit.getDocumentWindow = function(doc){
- return dojo.window.get(doc);
- };
- }
- if(!dojo._hasResource["dijit._base.popup"]){
- dojo._hasResource["dijit._base.popup"] = true;
- dojo.provide("dijit._base.popup");
- dijit.popup = {
-
-
-
-
-
- _stack: [],
-
-
-
-
- _beginZIndex: 1000,
- _idGen: 1,
- _createWrapper: function(/*Widget || DomNode*/ widget){
-
-
-
-
- var node = widget.domNode || widget,
- wrapper = widget.declaredClass ? widget._popupWrapper :
- node.parentNode && dojo.hasClass(node.parentNode, "dijitPopup") ? node.parentNode : null;
- if(!wrapper){
-
-
-
- wrapper = dojo.create("div",{
- "class":"dijitPopup",
- style:{ display: "none"},
- role: "presentation"
- }, dojo.body());
- wrapper.appendChild(node);
- var s = node.style;
- s.display = "";
- s.visibility = "";
- s.position = "";
- s.top = "0px";
- if(widget.declaredClass){
- widget._popupWrapper = wrapper;
- dojo.connect(widget, "destroy", function(){
- dojo.destroy(wrapper);
- delete widget._popupWrapper;
- });
- }
- }
-
- return wrapper;
- },
- moveOffScreen: function(/*Widget || DomNode*/ widget){
-
-
-
-
-
-
- var wrapper = this._createWrapper(widget);
- dojo.style(wrapper, {
- visibility: "hidden",
- top: "-9999px",
- display: ""
- });
- },
- hide: function(/*dijit._Widget*/ widget){
-
-
-
-
-
-
-
-
-
- var wrapper = this._createWrapper(widget);
- dojo.style(wrapper, "display", "none");
- },
-
- getTopPopup: function(){
-
-
-
- var stack = this._stack;
- for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--){
-
- }
- return stack[pi];
- },
- open: function(/*dijit.popup.__OpenArgs*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var stack = this._stack,
- widget = args.popup,
- orient = args.orient || (
- (args.parent ? args.parent.isLeftToRight() : dojo._isBodyLtr()) ?
- {'BL':'TL', 'BR':'TR', 'TL':'BL', 'TR':'BR'} :
- {'BR':'TR', 'BL':'TL', 'TR':'BR', 'TL':'BL'}
- ),
- around = args.around,
- id = (args.around && args.around.id) ? (args.around.id+"_dropdown") : ("popup_"+this._idGen++);
-
-
-
- while(stack.length && (!args.parent || !dojo.isDescendant(args.parent.domNode, stack[stack.length-1].widget.domNode))){
- dijit.popup.close(stack[stack.length-1].widget);
- }
-
- var wrapper = this._createWrapper(widget);
- dojo.attr(wrapper, {
- id: id,
- style: {
- zIndex: this._beginZIndex + stack.length
- },
- "class": "dijitPopup " + (widget.baseClass || widget["class"] || "").split(" ")[0] +"Popup",
- dijitPopupParent: args.parent ? args.parent.id : ""
- });
- if(dojo.isIE || dojo.isMoz){
- if(!widget.bgIframe){
-
- widget.bgIframe = new dijit.BackgroundIframe(wrapper);
- }
- }
-
- var best = around ?
- dijit.placeOnScreenAroundElement(wrapper, around, orient, widget.orient ? dojo.hitch(widget, "orient") : null) :
- dijit.placeOnScreen(wrapper, args, orient == 'R' ? ['TR','BR','TL','BL'] : ['TL','BL','TR','BR'], args.padding);
- wrapper.style.display = "";
- wrapper.style.visibility = "visible";
- widget.domNode.style.visibility = "visible";
- var handlers = [];
-
-
- handlers.push(dojo.connect(wrapper, "onkeypress", this, function(evt){
- if(evt.charOrCode == dojo.keys.ESCAPE && args.onCancel){
- dojo.stopEvent(evt);
- args.onCancel();
- }else if(evt.charOrCode === dojo.keys.TAB){
- dojo.stopEvent(evt);
- var topPopup = this.getTopPopup();
- if(topPopup && topPopup.onCancel){
- topPopup.onCancel();
- }
- }
- }));
-
-
- if(widget.onCancel){
- handlers.push(dojo.connect(widget, "onCancel", args.onCancel));
- }
- handlers.push(dojo.connect(widget, widget.onExecute ? "onExecute" : "onChange", this, function(){
- var topPopup = this.getTopPopup();
- if(topPopup && topPopup.onExecute){
- topPopup.onExecute();
- }
- }));
- stack.push({
- widget: widget,
- parent: args.parent,
- onExecute: args.onExecute,
- onCancel: args.onCancel,
- onClose: args.onClose,
- handlers: handlers
- });
- if(widget.onOpen){
-
- widget.onOpen(best);
- }
- return best;
- },
- close: function(/*dijit._Widget?*/ popup){
-
-
-
- var stack = this._stack;
-
-
-
-
-
- while((popup && dojo.some(stack, function(elem){return elem.widget == popup;})) ||
- (!popup && stack.length)){
- var top = stack.pop(),
- widget = top.widget,
- onClose = top.onClose;
- if(widget.onClose){
-
- widget.onClose();
- }
- dojo.forEach(top.handlers, dojo.disconnect);
-
- if(widget && widget.domNode){
- this.hide(widget);
- }
-
- if(onClose){
- onClose();
- }
- }
- }
- };
- dijit._frames = new function(){
-
-
- var queue = [];
- this.pop = function(){
- var iframe;
- if(queue.length){
- iframe = queue.pop();
- iframe.style.display="";
- }else{
- if(dojo.isIE < 9){
- var burl = dojo.config["dojoBlankHtmlUrl"] || (dojo.moduleUrl("dojo", "resources/blank.html")+"") || "javascript:\"\"";
- var html="<iframe src='" + burl + "'"
- + " style='position: absolute; left: 0px; top: 0px;"
- + "z-index: -1; filter:Alpha(Opacity=\"0\");'>";
- iframe = dojo.doc.createElement(html);
- }else{
- iframe = dojo.create("iframe");
- iframe.src = 'javascript:""';
- iframe.className = "dijitBackgroundIframe";
- dojo.style(iframe, "opacity", 0.1);
- }
- iframe.tabIndex = -1;
- dijit.setWaiRole(iframe,"presentation");
- }
- return iframe;
- };
- this.push = function(iframe){
- iframe.style.display="none";
- queue.push(iframe);
- }
- }();
- dijit.BackgroundIframe = function(/*DomNode*/ node){
-
-
-
-
-
-
-
- if(!node.id){ throw new Error("no id"); }
- if(dojo.isIE || dojo.isMoz){
- var iframe = (this.iframe = dijit._frames.pop());
- node.appendChild(iframe);
- if(dojo.isIE<7 || dojo.isQuirks){
- this.resize(node);
- this._conn = dojo.connect(node, 'onresize', this, function(){
- this.resize(node);
- });
- }else{
- dojo.style(iframe, {
- width: '100%',
- height: '100%'
- });
- }
- }
- };
- dojo.extend(dijit.BackgroundIframe, {
- resize: function(node){
-
-
-
- if(this.iframe){
- dojo.style(this.iframe, {
- width: node.offsetWidth + 'px',
- height: node.offsetHeight + 'px'
- });
- }
- },
- destroy: function(){
-
-
- if(this._conn){
- dojo.disconnect(this._conn);
- this._conn = null;
- }
- if(this.iframe){
- dijit._frames.push(this.iframe);
- delete this.iframe;
- }
- }
- });
- }
- if(!dojo._hasResource["dijit._base.scroll"]){
- dojo._hasResource["dijit._base.scroll"] = true;
- dojo.provide("dijit._base.scroll");
- dijit.scrollIntoView = function(/*DomNode*/ node, /*Object?*/ pos){
-
-
-
-
- dojo.window.scrollIntoView(node, pos);
- };
- }
- if(!dojo._hasResource["dojo.uacss"]){
- dojo._hasResource["dojo.uacss"] = true;
- dojo.provide("dojo.uacss");
- (function(){
-
-
-
-
-
-
-
-
-
- var d = dojo,
- html = d.doc.documentElement,
- ie = d.isIE,
- opera = d.isOpera,
- maj = Math.floor,
- ff = d.isFF,
- boxModel = d.boxModel.replace(/-/,''),
- classes = {
- dj_quirks: d.isQuirks,
-
- dj_opera: opera,
- dj_khtml: d.isKhtml,
- dj_webkit: d.isWebKit,
- dj_safari: d.isSafari,
- dj_chrome: d.isChrome,
- dj_gecko: d.isMozilla
- };
- if(ie){
- classes["dj_ie"] = true;
- classes["dj_ie" + maj(ie)] = true;
- classes["dj_iequirks"] = d.isQuirks;
- }
- if(ff){
- classes["dj_ff" + maj(ff)] = true;
- }
- classes["dj_" + boxModel] = true;
-
- var classStr = "";
- for(var clz in classes){
- if(classes[clz]){
- classStr += clz + " ";
- }
- }
- html.className = d.trim(html.className + " " + classStr);
-
-
-
- dojo._loaders.unshift(function(){
- if(!dojo._isBodyLtr()){
- var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ")
- html.className = d.trim(html.className + " " + rtlClassStr);
- }
- });
- })();
- }
- if(!dojo._hasResource["dijit._base.sniff"]){
- dojo._hasResource["dijit._base.sniff"] = true;
- dojo.provide("dijit._base.sniff");
- }
- if(!dojo._hasResource["dijit._base.typematic"]){
- dojo._hasResource["dijit._base.typematic"] = true;
- dojo.provide("dijit._base.typematic");
- dijit.typematic = {
-
-
-
-
-
- _fireEventAndReload: function(){
- this._timer = null;
- this._callback(++this._count, this._node, this._evt);
-
-
-
- this._currentTimeout = Math.max(
- this._currentTimeout < 0 ? this._initialDelay :
- (this._subsequentDelay > 1 ? this._subsequentDelay : Math.round(this._currentTimeout * this._subsequentDelay)),
- this._minDelay);
- this._timer = setTimeout(dojo.hitch(this, "_fireEventAndReload"), this._currentTimeout);
- },
- trigger: function(/*Event*/ evt, /*Object*/ _this, /*DOMNode*/ node, /*Function*/ callback, /*Object*/ obj, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(obj != this._obj){
- this.stop();
- this._initialDelay = initialDelay || 500;
- this._subsequentDelay = subsequentDelay || 0.90;
- this._minDelay = minDelay || 10;
- this._obj = obj;
- this._evt = evt;
- this._node = node;
- this._currentTimeout = -1;
- this._count = -1;
- this._callback = dojo.hitch(_this, callback);
- this._fireEventAndReload();
- this._evt = dojo.mixin({faux: true}, evt);
- }
- },
- stop: function(){
-
-
- if(this._timer){
- clearTimeout(this._timer);
- this._timer = null;
- }
- if(this._obj){
- this._callback(-1, this._node, this._evt);
- this._obj = null;
- }
- },
- addKeyListener: function(/*DOMNode*/ node, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(keyObject.keyCode){
- keyObject.charOrCode = keyObject.keyCode;
- dojo.deprecated("keyCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.", "", "2.0");
- }else if(keyObject.charCode){
- keyObject.charOrCode = String.fromCharCode(keyObject.charCode);
- dojo.deprecated("charCode attribute parameter for dijit.typematic.addKeyListener is deprecated. Use charOrCode instead.", "", "2.0");
- }
- return [
- dojo.connect(node, "onkeypress", this, function(evt){
- if(evt.charOrCode == keyObject.charOrCode &&
- (keyObject.ctrlKey === undefined || keyObject.ctrlKey == evt.ctrlKey) &&
- (keyObject.altKey === undefined || keyObject.altKey == evt.altKey) &&
- (keyObject.metaKey === undefined || keyObject.metaKey == (evt.metaKey || false)) &&
- (keyObject.shiftKey === undefined || keyObject.shiftKey == evt.shiftKey)){
- dojo.stopEvent(evt);
- dijit.typematic.trigger(evt, _this, node, callback, keyObject, subsequentDelay, initialDelay, minDelay);
- }else if(dijit.typematic._obj == keyObject){
- dijit.typematic.stop();
- }
- }),
- dojo.connect(node, "onkeyup", this, function(evt){
- if(dijit.typematic._obj == keyObject){
- dijit.typematic.stop();
- }
- })
- ];
- },
- addMouseListener: function(/*DOMNode*/ node, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
- var dc = dojo.connect;
- return [
- dc(node, "mousedown", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay, minDelay);
- }),
- dc(node, "mouseup", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.stop();
- }),
- dc(node, "mouseout", this, function(evt){
- dojo.stopEvent(evt);
- dijit.typematic.stop();
- }),
- dc(node, "mousemove", this, function(evt){
- evt.preventDefault();
- }),
- dc(node, "dblclick", this, function(evt){
- dojo.stopEvent(evt);
- if(dojo.isIE < 9){
- dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay, minDelay);
- setTimeout(dojo.hitch(this, dijit.typematic.stop), 50);
- }
- })
- ];
- },
- addListener: function(/*Node*/ mouseNode, /*Node*/ keyNode, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay, /*Number?*/ minDelay){
-
-
-
-
-
-
-
-
-
-
- return this.addKeyListener(keyNode, keyObject, _this, callback, subsequentDelay, initialDelay, minDelay).concat(
- this.addMouseListener(mouseNode, _this, callback, subsequentDelay, initialDelay, minDelay));
- }
- };
- }
- if(!dojo._hasResource["dijit._base.wai"]){
- dojo._hasResource["dijit._base.wai"] = true;
- dojo.provide("dijit._base.wai");
- dijit.wai = {
- onload: function(){
-
-
-
-
-
-
-
- var div = dojo.create("div",{
- id: "a11yTestNode",
- style:{
- cssText:'border: 1px solid;'
- + 'border-color:red green;'
- + 'position: absolute;'
- + 'height: 5px;'
- + 'top: -999px;'
- + 'background-image: url("' + (dojo.config.blankGif || dojo.moduleUrl("dojo", "resources/blank.gif")) + '");'
- }
- }, dojo.body());
-
- var cs = dojo.getComputedStyle(div);
- if(cs){
- var bkImg = cs.backgroundImage;
- var needsA11y = (cs.borderTopColor == cs.borderRightColor) || (bkImg != null && (bkImg == "none" || bkImg == "url(invalid-url:)" ));
- dojo[needsA11y ? "addClass" : "removeClass"](dojo.body(), "dijit_a11y");
- if(dojo.isIE){
- div.outerHTML = "";
- }else{
- dojo.body().removeChild(div);
- }
- }
- }
- };
- if(dojo.isIE || dojo.isMoz){
- dojo._loaders.unshift(dijit.wai.onload);
- }
- dojo.mixin(dijit, {
- hasWaiRole: function(/*Element*/ elem, /*String?*/ role){
-
-
-
-
-
-
- var waiRole = this.getWaiRole(elem);
- return role ? (waiRole.indexOf(role) > -1) : (waiRole.length > 0);
- },
- getWaiRole: function(/*Element*/ elem){
-
-
-
-
-
- return dojo.trim((dojo.attr(elem, "role") || "").replace("wairole:",""));
- },
- setWaiRole: function(/*Element*/ elem, /*String*/ role){
-
-
-
-
- dojo.attr(elem, "role", role);
- },
- removeWaiRole: function(/*Element*/ elem, /*String*/ role){
-
-
-
- var roleValue = dojo.attr(elem, "role");
- if(!roleValue){ return; }
- if(role){
- var t = dojo.trim((" " + roleValue + " ").replace(" " + role + " ", " "));
- dojo.attr(elem, "role", t);
- }else{
- elem.removeAttribute("role");
- }
- },
- hasWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
-
-
-
- return elem.hasAttribute ? elem.hasAttribute("aria-"+state) : !!elem.getAttribute("aria-"+state);
- },
- getWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
-
-
-
- return elem.getAttribute("aria-"+state) || "";
- },
- setWaiState: function(/*Element*/ elem, /*String*/ state, /*String*/ value){
-
-
-
-
- elem.setAttribute("aria-"+state, value);
- },
- removeWaiState: function(/*Element*/ elem, /*String*/ state){
-
-
-
-
- elem.removeAttribute("aria-"+state);
- }
- });
- }
- if(!dojo._hasResource["dijit._base"]){
- dojo._hasResource["dijit._base"] = true;
- dojo.provide("dijit._base");
- }
- if(!dojo._hasResource["dojo.Stateful"]){
- dojo._hasResource["dojo.Stateful"] = true;
- dojo.provide("dojo.Stateful");
- dojo.declare("dojo.Stateful", null, {
-
-
-
-
-
-
-
-
-
- postscript: function(mixin){
- if(mixin){
- dojo.mixin(this, mixin);
- }
- },
-
- get: function(/*String*/name){
-
-
-
-
-
-
-
-
-
-
-
-
-
- return this[name];
- },
- set: function(/*String*/name, /*Object*/value){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(typeof name === "object"){
- for(var x in name){
- this.set(x, name[x]);
- }
- return this;
- }
- var oldValue = this[name];
- this[name] = value;
- if(this._watchCallbacks){
- this._watchCallbacks(name, oldValue, value);
- }
- return this;
- },
- watch: function(/*String?*/name, /*Function*/callback){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var callbacks = this._watchCallbacks;
- if(!callbacks){
- var self = this;
- callbacks = this._watchCallbacks = function(name, oldValue, value, ignoreCatchall){
- var notify = function(propertyCallbacks){
- if(propertyCallbacks){
- propertyCallbacks = propertyCallbacks.slice();
- for(var i = 0, l = propertyCallbacks.length; i < l; i++){
- try{
- propertyCallbacks[i].call(self, name, oldValue, value);
- }catch(e){
- console.error(e);
- }
- }
- }
- };
- notify(callbacks['_' + name]);
- if(!ignoreCatchall){
- notify(callbacks["*"]);
- }
- };
- }
- if(!callback && typeof name === "function"){
- callback = name;
- name = "*";
- }else{
-
- name = '_' + name;
- }
- var propertyCallbacks = callbacks[name];
- if(typeof propertyCallbacks !== "object"){
- propertyCallbacks = callbacks[name] = [];
- }
- propertyCallbacks.push(callback);
- return {
- unwatch: function(){
- propertyCallbacks.splice(dojo.indexOf(propertyCallbacks, callback), 1);
- }
- };
- }
-
- });
- }
- if(!dojo._hasResource["dijit._WidgetBase"]){
- dojo._hasResource["dijit._WidgetBase"] = true;
- dojo.provide("dijit._WidgetBase");
- (function(){
- function isEqual(a, b){
-
-
-
-
- return a === b || ( a !== a && b !== b);
- }
- dojo.declare("dijit._WidgetBase", dojo.Stateful, {
-
-
-
-
-
-
-
-
- id: "",
-
-
-
-
-
- lang: "",
-
-
-
-
- dir: "",
-
-
- "class": "",
-
-
- style: "",
-
-
-
-
-
-
-
-
- title: "",
-
-
-
- tooltip: "",
-
-
-
- baseClass: "",
-
-
- srcNodeRef: null,
-
-
-
-
-
- domNode: null,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- containerNode: null,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- attributeMap: {id:"", dir:"", lang:"", "class":"", style:"", title:""},
-
-
-
- _blankGif: (dojo.config.blankGif || dojo.moduleUrl("dojo", "resources/blank.gif")).toString(),
-
- postscript: function(/*Object?*/params, /*DomNode|String*/srcNodeRef){
-
-
-
-
- this.create(params, srcNodeRef);
- },
- create: function(/*Object?*/params, /*DomNode|String?*/srcNodeRef){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.srcNodeRef = dojo.byId(srcNodeRef);
-
-
- this._connects = [];
-
-
- this._subscribes = [];
-
- if(this.srcNodeRef && (typeof this.srcNodeRef.id == "string")){ this.id = this.srcNodeRef.id; }
- if(params){
- this.params = params;
- dojo._mixin(this, params);
- }
- this.postMixInProperties();
-
-
-
- if(!this.id){
- this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
- }
- dijit.registry.add(this);
- this.buildRendering();
- if(this.domNode){
-
-
- this._applyAttributes();
-
-
-
-
- var source = this.srcNodeRef;
- if(source && source.parentNode && this.domNode !== source){
- source.parentNode.replaceChild(this.domNode, source);
- }
- }
- if(this.domNode){
-
-
- this.domNode.setAttribute("widgetId", this.id);
- }
- this.postCreate();
-
- if(this.srcNodeRef && !this.srcNodeRef.parentNode){
- delete this.srcNodeRef;
- }
- this._created = true;
- },
- _applyAttributes: function(){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var condAttrApply = function(attr, scope){
- if((scope.params && attr in scope.params) || scope[attr]){
- scope.set(attr, scope[attr]);
- }
- };
-
- for(var attr in this.attributeMap){
- condAttrApply(attr, this);
- }
-
- dojo.forEach(this._getSetterAttributes(), function(a){
- if(!(a in this.attributeMap)){
- condAttrApply(a, this);
- }
- }, this);
- },
- _getSetterAttributes: function(){
-
-
- var ctor = this.constructor;
- if(!ctor._setterAttrs){
- var r = (ctor._setterAttrs = []),
- attrs,
- proto = ctor.prototype;
- for(var fxName in proto){
- if(dojo.isFunction(proto[fxName]) && (attrs = fxName.match(/^_set([a-zA-Z]*)Attr$/)) && attrs[1]){
- r.push(attrs[1].charAt(0).toLowerCase() + attrs[1].substr(1));
- }
- }
- }
- return ctor._setterAttrs;
- },
- postMixInProperties: function(){
-
-
-
-
-
-
-
- },
- buildRendering: function(){
-
-
-
-
-
-
-
- if(!this.domNode){
-
- this.domNode = this.srcNodeRef || dojo.create('div');
- }
-
-
-
- if(this.baseClass){
- var classes = this.baseClass.split(" ");
- if(!this.isLeftToRight()){
- classes = classes.concat( dojo.map(classes, function(name){ return name+"Rtl"; }));
- }
- dojo.addClass(this.domNode, classes);
- }
- },
- postCreate: function(){
-
-
-
-
-
-
-
-
- },
- startup: function(){
-
-
-
-
-
-
-
- this._started = true;
- },
-
- destroyRecursive: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
-
-
- this._beingDestroyed = true;
- this.destroyDescendants(preserveDom);
- this.destroy(preserveDom);
- },
- destroy: function(/*Boolean*/ preserveDom){
-
-
-
-
-
-
- this._beingDestroyed = true;
- this.uninitialize();
- var d = dojo,
- dfe = d.forEach,
- dun = d.unsubscribe;
- dfe(this._connects, function(array){
- dfe(array, d.disconnect);
- });
- dfe(this._subscribes, function(handle){
- dun(handle);
- });
-
- dfe(this._supportingWidgets || [], function(w){
- if(w.destroyRecursive){
- w.destroyRecursive();
- }else if(w.destroy){
- w.destroy();
- }
- });
- this.destroyRendering(preserveDom);
- dijit.registry.remove(this.id);
- this._destroyed = true;
- },
- destroyRendering: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
- if(this.bgIframe){
- this.bgIframe.destroy(preserveDom);
- delete this.bgIframe;
- }
- if(this.domNode){
- if(preserveDom){
- dojo.removeAttr(this.domNode, "widgetId");
- }else{
- dojo.destroy(this.domNode);
- }
- delete this.domNode;
- }
- if(this.srcNodeRef){
- if(!preserveDom){
- dojo.destroy(this.srcNodeRef);
- }
- delete this.srcNodeRef;
- }
- },
- destroyDescendants: function(/*Boolean?*/ preserveDom){
-
-
-
-
-
-
-
-
- dojo.forEach(this.getChildren(), function(widget){
- if(widget.destroyRecursive){
- widget.destroyRecursive(preserveDom);
- }
- });
- },
- uninitialize: function(){
-
-
-
-
-
- return false;
- },
-
- _setClassAttr: function(/*String*/ value){
-
-
-
-
- var mapNode = this[this.attributeMap["class"] || 'domNode'];
- dojo.replaceClass(mapNode, value, this["class"]);
- this._set("class", value);
- },
- _setStyleAttr: function(/*String||Object*/ value){
-
-
-
-
-
-
-
-
-
- var mapNode = this[this.attributeMap.style || 'domNode'];
-
-
- if(dojo.isObject(value)){
- dojo.style(mapNode, value);
- }else{
- if(mapNode.style.cssText){
- mapNode.style.cssText += "; " + value;
- }else{
- mapNode.style.cssText = value;
- }
- }
- this._set("style", value);
- },
- _attrToDom: function(/*String*/ attr, /*String*/ value){
-
-
-
-
-
-
-
-
- var commands = this.attributeMap[attr];
- dojo.forEach(dojo.isArray(commands) ? commands : [commands], function(command){
-
- var mapNode = this[command.node || command || "domNode"];
- var type = command.type || "attribute";
- switch(type){
- case "attribute":
- if(dojo.isFunction(value)){
- value = dojo.hitch(this, value);
- }
-
-
-
- var attrName = command.attribute ? command.attribute :
- (/^on[A-Z][a-zA-Z]*$/.test(attr) ? attr.toLowerCase() : attr);
- dojo.attr(mapNode, attrName, value);
- break;
- case "innerText":
- mapNode.innerHTML = "";
- mapNode.appendChild(dojo.doc.createTextNode(value));
- break;
- case "innerHTML":
- mapNode.innerHTML = value;
- break;
- case "class":
- dojo.replaceClass(mapNode, value, this[attr]);
- break;
- }
- }, this);
- },
- get: function(name){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var names = this._getAttrNames(name);
- return this[names.g] ? this[names.g]() : this[name];
- },
-
- set: function(name, value){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(typeof name === "object"){
- for(var x in name){
- this.set(x, name[x]);
- }
- return this;
- }
- var names = this._getAttrNames(name);
- if(this[names.s]){
-
- var result = this[names.s].apply(this, Array.prototype.slice.call(arguments, 1));
- }else{
-
- if(name in this.attributeMap){
- this._attrToDom(name, value);
- }
- this._set(name, value);
- }
- return result || this;
- },
-
- _attrPairNames: {},
- _getAttrNames: function(name){
-
-
-
-
-
- var apn = this._attrPairNames;
- if(apn[name]){ return apn[name]; }
- var uc = name.charAt(0).toUpperCase() + name.substr(1);
- return (apn[name] = {
- n: name+"Node",
- s: "_set"+uc+"Attr",
- g: "_get"+uc+"Attr"
- });
- },
- _set: function(/*String*/ name, /*anything*/ value){
-
-
-
- var oldValue = this[name];
- this[name] = value;
- if(this._watchCallbacks && this._created && !isEqual(value, oldValue)){
- this._watchCallbacks(name, oldValue, value);
- }
- },
- toString: function(){
-
-
-
-
-
-
- return '[Widget ' + this.declaredClass + ', ' + (this.id || 'NO ID') + ']';
- },
- getDescendants: function(){
-
-
-
-
- return this.containerNode ? dojo.query('[widgetId]', this.containerNode).map(dijit.byNode) : [];
- },
- getChildren: function(){
-
-
-
- return this.containerNode ? dijit.findWidgets(this.containerNode) : [];
- },
- connect: function(
- /*Object|null*/ obj,
- /*String|Function*/ event,
- /*String|Function*/ method){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var handles = [dojo._connect(obj, event, this, method)];
- this._connects.push(handles);
- return handles;
- },
- disconnect: function(/* _Widget.Handle */ handles){
-
-
-
-
-
- for(var i=0; i<this._connects.length; i++){
- if(this._connects[i] == handles){
- dojo.forEach(handles, dojo.disconnect);
- this._connects.splice(i, 1);
- return;
- }
- }
- },
- subscribe: function(
- /*String*/ topic,
- /*String|Function*/ method){
-
-
-
-
-
-
-
-
-
-
-
-
-
- var handle = dojo.subscribe(topic, this, method);
-
- this._subscribes.push(handle);
- return handle;
- },
- unsubscribe: function(/*Object*/ handle){
-
-
-
- for(var i=0; i<this._subscribes.length; i++){
- if(this._subscribes[i] == handle){
- dojo.unsubscribe(handle);
- this._subscribes.splice(i, 1);
- return;
- }
- }
- },
- isLeftToRight: function(){
-
-
-
-
- return this.dir ? (this.dir == "ltr") : dojo._isBodyLtr();
- },
- placeAt: function(/* String|DomNode|_Widget */reference, /* String?|Int? */position){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(reference.declaredClass && reference.addChild){
- reference.addChild(this, position);
- }else{
- dojo.place(this.domNode, reference, position);
- }
- return this;
- },
- defer: function(fcn, delay){
-
-
-
-
-
-
-
-
- var timer = setTimeout(dojo.hitch(this,
- function(){
- timer = null;
- if(!this._destroyed){
- dojo.hitch(this, fcn)();
- }
- }),
- delay || 0
- );
- return {
- remove: function(){
- if(timer){
- clearTimeout(timer);
- timer = null;
- }
- return null;
- }
- };
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.mobile._base"]){
- dojo._hasResource["dojox.mobile._base"] = true;
- dojo.provide("dojox.mobile._base");
- dojo.isBB = (navigator.userAgent.indexOf("BlackBerry") != -1) && !dojo.isWebKit;
- dojo.declare(
- "dojox.mobile.View",
- dijit._WidgetBase,
- {
-
-
-
-
-
-
-
-
- selected: false,
-
-
- keepScrollPos: true,
- _started: false,
- constructor: function(params, node){
- if(node){
- dojo.byId(node).style.visibility = "hidden";
- }
- },
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("DIV");
- this.domNode.className = "mblView";
- this.connect(this.domNode, "webkitAnimationEnd", "onAnimationEnd");
- this.connect(this.domNode, "webkitAnimationStart", "onAnimationStart");
- var id = location.href.match(/#(\w+)([^\w=]|$)/) ? RegExp.$1 : null;
- this._visible = this.selected && !id || this.id == id;
- if(this.selected){
- dojox.mobile._defaultView = this;
- }
- },
- startup: function(){
- if(this._started){ return; }
- var _this = this;
- setTimeout(function(){
- if(!_this._visible){
- _this.domNode.style.display = "none";
- }else{
- dojox.mobile.currentView = _this;
- _this.onStartView();
- }
- _this.domNode.style.visibility = "visible";
- }, dojo.isIE?100:0);
- this._started = true;
- },
- onStartView: function(){
-
-
- },
- onBeforeTransitionIn: function(moveTo, dir, transition, context, method){
-
- },
- onAfterTransitionIn: function(moveTo, dir, transition, context, method){
-
- },
- onBeforeTransitionOut: function(moveTo, dir, transition, context, method){
-
- },
- onAfterTransitionOut: function(moveTo, dir, transition, context, method){
-
- },
- _saveState: function(moveTo, dir, transition, context, method){
- this._context = context;
- this._method = method;
- if(transition == "none" || !dojo.isWebKit){
- transition = null;
- }
- this._moveTo = moveTo;
- this._dir = dir;
- this._transition = transition;
- this._arguments = [];
- var i;
- for(i = 0; i < arguments.length; i++){
- this._arguments.push(arguments[i]);
- }
- this._args = [];
- if(context || method){
- for(i = 5; i < arguments.length; i++){
- this._args.push(arguments[i]);
- }
- }
- },
- performTransition: function(/*String*/moveTo, /*Number*/dir, /*String*/transition,
- /*Object|null*/context, /*String|Function*/method /*optional args*/){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(dojo.hash){
- if(typeof(moveTo) == "string" && moveTo.charAt(0) == '#' && !dojox.mobile._params){
- dojox.mobile._params = [];
- for(var i = 0; i < arguments.length; i++){
- dojox.mobile._params.push(arguments[i]);
- }
- dojo.hash(moveTo);
- return;
- }
- }
- this._saveState.apply(this, arguments);
- var toNode;
- if(moveTo){
- if(typeof(moveTo) == "string"){
-
-
- moveTo.match(/^#?([^&?]+)/);
- toNode = RegExp.$1;
- }else{
- toNode = moveTo;
- }
- }else{
- if(!this._dummyNode){
- this._dummyNode = dojo.doc.createElement("DIV");
- dojo.body().appendChild(this._dummyNode);
- }
- toNode = this._dummyNode;
- }
- var fromNode = this.domNode;
- toNode = this.toNode = dojo.byId(toNode);
- if(!toNode){ alert("dojox.mobile.View#performTransition: destination view not found: "+toNode); }
- toNode.style.visibility = "hidden";
- toNode.style.display = "";
- this.onBeforeTransitionOut.apply(this, arguments);
- var toWidget = dijit.byNode(toNode);
- if(toWidget){
-
- if(this.keepScrollPos && !dijit.getEnclosingWidget(this.domNode.parentNode)){
- var scrollTop = dojo.body().scrollTop || dojo.doc.documentElement.scrollTop || dojo.global.pageYOffset || 0;
- if(dir == 1){
- toNode.style.top = "0px";
- if(scrollTop > 1){
- fromNode.style.top = -scrollTop + "px";
- if(dojo.config["mblHideAddressBar"] !== false){
- setTimeout(function(){
- dojo.global.scrollTo(0, 1);
- }, 0);
- }
- }
- }else{
- if(scrollTop > 1 || toNode.offsetTop !== 0){
- var toTop = -toNode.offsetTop;
- toNode.style.top = "0px";
- fromNode.style.top = toTop - scrollTop + "px";
- if(dojo.config["mblHideAddressBar"] !== false && toTop > 0){
- setTimeout(function(){
- dojo.global.scrollTo(0, toTop + 1);
- }, 0);
- }
- }
- }
- }else{
- toNode.style.top = "0px";
- }
- toWidget.onBeforeTransitionIn.apply(toWidget, arguments);
- }
- toNode.style.display = "none";
- toNode.style.visibility = "visible";
- this._doTransition(fromNode, toNode, transition, dir);
- },
- _doTransition: function(fromNode, toNode, transition, dir){
- var rev = (dir == -1) ? " reverse" : "";
- toNode.style.display = "";
- if(!transition || transition == "none"){
- this.domNode.style.display = "none";
- this.invokeCallback();
- }else{
- dojo.addClass(fromNode, transition + " out" + rev);
- dojo.addClass(toNode, transition + " in" + rev);
- }
- },
- onAnimationStart: function(e){
- },
- onAnimationEnd: function(e){
- var isOut = false;
- if(dojo.hasClass(this.domNode, "out")){
- isOut = true;
- this.domNode.style.display = "none";
- dojo.forEach([this._transition,"in","out","reverse"], function(s){
- dojo.removeClass(this.domNode, s);
- }, this);
- }
- if(e.animationName.indexOf("shrink") === 0){
- var li = e.target;
- li.style.display = "none";
- dojo.removeClass(li, "mblCloseContent");
- }
- if(isOut){
- this.invokeCallback();
- }
-
-
- this.domNode && (this.domNode.className = "mblView");
- },
- invokeCallback: function(){
- this.onAfterTransitionOut.apply(this, this._arguments);
- var toWidget = dijit.byNode(this.toNode);
- if(toWidget){
- toWidget.onAfterTransitionIn.apply(toWidget, this._arguments);
- }
- dojox.mobile.currentView = toWidget;
- var c = this._context, m = this._method;
- if(!c && !m){ return; }
- if(!m){
- m = c;
- c = null;
- }
- c = c || dojo.global;
- if(typeof(m) == "string"){
- c[m].apply(c, this._args);
- }else{
- m.apply(c, this._args);
- }
- },
- getShowingView: function(){
-
-
-
-
-
- var nodes = this.domNode.parentNode.childNodes;
- for(var i = 0; i < nodes.length; i++){
- if(dojo.hasClass(nodes[i], "mblView") && dojo.style(nodes[i], "display") != "none"){
- return dijit.byNode(nodes[i]);
- }
- }
- },
- show: function(){
-
-
- var fs = this.getShowingView().domNode.style;
- var ts = this.domNode.style;
- fs.display = "none";
- ts.display = "";
- dojox.mobile.currentView = this;
- },
- addChild: function(widget){
- this.containerNode.appendChild(widget.domNode);
- }
- });
- dojo.declare(
- "dojox.mobile.Heading",
- dijit._WidgetBase,
- {
- back: "",
- href: "",
- moveTo: "",
- transition: "slide",
- label: "",
- iconBase: "",
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("H1");
- this.domNode.className = "mblHeading";
- this._view = dijit.getEnclosingWidget(this.domNode.parentNode);
- if(this.label){
- this.domNode.appendChild(document.createTextNode(this.label));
- }else{
- this.label = "";
- dojo.forEach(this.domNode.childNodes, function(n){
- if(n.nodeType == 3){ this.label += n.nodeValue; }
- }, this);
- this.label = dojo.trim(this.label);
- }
- if(this.back){
- var btn = dojo.create("DIV", {className:"mblArrowButton"}, this.domNode, "first");
- var head = dojo.create("DIV", {className:"mblArrowButtonHead"}, btn);
- var body = dojo.create("DIV", {className:"mblArrowButtonBody mblArrowButtonText"}, btn);
- this._body = body;
- this._head = head;
- this._btn = btn;
- body.innerHTML = this.back;
- this.connect(body, "onclick", "onClick");
- var neck = dojo.create("DIV", {className:"mblArrowButtonNeck"}, btn);
- btn.style.width = body.offsetWidth + head.offsetWidth + "px";
- this.setLabel(this.label);
- }
- },
- startup: function(){
- if(this._btn){
- this._btn.style.width = this._body.offsetWidth + this._head.offsetWidth + "px";
- }
- },
- onClick: function(e){
- var h1 = this.domNode;
- dojo.addClass(h1, "mblArrowButtonSelected");
- setTimeout(function(){
- dojo.removeClass(h1, "mblArrowButtonSelected");
- }, 1000);
- this.goTo(this.moveTo, this.href);
- },
- setLabel: function(label){
- if(label != this.label){
- this.label = label;
- this.domNode.firstChild.nodeValue = label;
- }
- },
- goTo: function(moveTo, href){
- if(!this._view){
- this._view = dijit.byNode(this.domNode.parentNode);
- }
- if(!this._view){ return; }
- if(href){
- this._view.performTransition(null, -1, this.transition, this, function(){location.href = href;});
- }else{
- if(dojox.mobile.app && dojox.mobile.app.STAGE_CONTROLLER_ACTIVE){
-
- dojo.publish("/dojox/mobile/app/goback");
- }
- else{
- this._view.performTransition(moveTo, -1, this.transition);
- }
- }
- }
- });
- dojo.declare(
- "dojox.mobile.RoundRect",
- dijit._WidgetBase,
- {
- shadow: false,
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("DIV");
- this.domNode.className = this.shadow ? "mblRoundRect mblShadow" : "mblRoundRect";
- }
- });
- dojo.declare(
- "dojox.mobile.RoundRectCategory",
- dijit._WidgetBase,
- {
- label: "",
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("H2");
- this.domNode.className = "mblRoundRectCategory";
- if(this.label){
- this.domNode.innerHTML = this.label;
- }else{
- this.label = this.domNode.innerHTML;
- }
- }
- });
- dojo.declare(
- "dojox.mobile.EdgeToEdgeCategory",
- dojox.mobile.RoundRectCategory,
- {
- buildRendering: function(){
- this.inherited(arguments);
- this.domNode.className = "mblEdgeToEdgeCategory";
- }
- });
- dojo.declare(
- "dojox.mobile.RoundRectList",
- dijit._WidgetBase,
- {
- transition: "slide",
- iconBase: "",
- iconPos: "",
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("UL");
- this.domNode.className = "mblRoundRectList";
- },
- addChild: function(widget){
- this.containerNode.appendChild(widget.domNode);
- widget.inheritParams();
- widget.setIcon();
- }
- });
- dojo.declare(
- "dojox.mobile.EdgeToEdgeList",
- dojox.mobile.RoundRectList,
- {
- stateful: false,
- buildRendering: function(){
- this.inherited(arguments);
- this.domNode.className = "mblEdgeToEdgeList";
- }
- });
- dojo.declare(
- "dojox.mobile.AbstractItem",
- dijit._WidgetBase,
- {
- icon: "",
- iconPos: "",
- href: "",
- hrefTarget: "",
- moveTo: "",
- scene: "",
- clickable: false,
- url: "",
- urlTarget: "",
- transition: "",
- transitionDir: 1,
- callback: null,
- sync: true,
- label: "",
- toggle: false,
- _duration: 800,
- inheritParams: function(){
- var parent = this.getParentWidget();
- if(parent){
- if(!this.transition){ this.transition = parent.transition; }
- if(!this.icon){ this.icon = parent.iconBase; }
- if(!this.iconPos){ this.iconPos = parent.iconPos; }
- }
- },
- findCurrentView: function(moveTo){
- var w;
- if(moveTo){
- w = dijit.byId(moveTo);
- if(w){ return w.getShowingView(); }
- }
- var n = this.domNode.parentNode;
- while(true){
- w = dijit.getEnclosingWidget(n);
- if(!w){ return null; }
- if(w.performTransition){ break; }
- n = w.domNode.parentNode;
- }
- return w;
- },
- transitionTo: function(moveTo, href, url, scene){
- var w = this.findCurrentView(moveTo);
- if(!w || moveTo && w === dijit.byId(moveTo)){ return; }
- if(href){
- if(this.hrefTarget){
- dojox.mobile.openWindow(this.href, this.hrefTarget);
- }else{
- w.performTransition(null, this.transitionDir, this.transition, this, function(){location.href = href;});
- }
- return;
- } else if(scene){
- dojo.publish("/dojox/mobile/app/pushScene", [scene]);
- return;
- }
- if(url){
- var id;
- if(dojox.mobile._viewMap && dojox.mobile._viewMap[url]){
-
- id = dojox.mobile._viewMap[url];
- }else{
-
- var text = this._text;
- if(!text){
- if(this.sync){
- text = dojo.trim(dojo._getText(url));
- }else{
- dojo["require"]("dojo._base.xhr");
- var prog = dojox.mobile.ProgressIndicator.getInstance();
- dojo.body().appendChild(prog.domNode);
- prog.start();
- var xhr = dojo.xhrGet({
- url: url,
- handleAs: "text"
- });
- xhr.addCallback(dojo.hitch(this, function(response, ioArgs){
- prog.stop();
- if(response){
- this._text = response;
- this.transitionTo(moveTo, href, url, scene);
- }
- }));
- xhr.addErrback(function(error){
- prog.stop();
- alert("Failed to load "+url+"\n"+(error.description||error));
- });
- return;
- }
- }
- this._text = null;
- id = this._parse(text);
- if(!dojox.mobile._viewMap){
- dojox.mobile._viewMap = [];
- }
- dojox.mobile._viewMap[url] = id;
- }
- moveTo = id;
- w = this.findCurrentView(moveTo) || w;
- }
- w.performTransition(moveTo, this.transitionDir, this.transition, this.callback && this, this.callback);
- },
- _parse: function(text){
- var container = dojo.create("DIV");
- var view;
- var id = this.urlTarget;
- var target = dijit.byId(id) && dijit.byId(id).containerNode ||
- dojo.byId(id) ||
- dojox.mobile.currentView && dojox.mobile.currentView.domNode.parentNode ||
- dojo.body();
- if(text.charAt(0) == "<"){
- container.innerHTML = text;
- view = container.firstChild;
- if(!view && view.nodeType != 1){
- alert("dojox.mobile.AbstractItem#transitionTo: invalid view content");
- return;
- }
- view.setAttribute("_started", "true");
- view.style.visibility = "hidden";
- target.appendChild(container);
- (dojox.mobile.parser || dojo.parser).parse(container);
- target.appendChild(target.removeChild(container).firstChild);
- }else if(text.charAt(0) == "{"){
- target.appendChild(container);
- this._ws = [];
- view = this._instantiate(eval('('+text+')'), container);
- for(var i = 0; i < this._ws.length; i++){
- var w = this._ws[i];
- w.startup && !w._started && (!w.getParent || !w.getParent()) && w.startup();
- }
- this._ws = null;
- }
- view.style.display = "none";
- view.style.visibility = "visible";
- var id = view.id;
- return dojo.hash ? "#" + id : id;
- },
- _instantiate: function(/*Object*/obj, /*DomNode*/node, /*Widget*/parent){
- var widget;
- for(var key in obj){
- if(key.charAt(0) == "@"){ continue; }
- var cls = dojo.getObject(key);
- if(!cls){ continue; }
- var params = {};
- var proto = cls.prototype;
- var objs = dojo.isArray(obj[key]) ? obj[key] : [obj[key]];
- for(var i = 0; i < objs.length; i++){
- for(var prop in objs[i]){
- if(prop.charAt(0) == "@"){
- var val = objs[i][prop];
- prop = prop.substring(1);
- if(typeof proto[prop] == "string"){
- params[prop] = val;
- }else if(typeof proto[prop] == "number"){
- params[prop] = val - 0;
- }else if(typeof proto[prop] == "boolean"){
- params[prop] = (val != "false");
- }else if(typeof proto[prop] == "object"){
- params[prop] = eval("(" + val + ")");
- }
- }
- }
- widget = new cls(params, node);
- if(!node){
- this._ws.push(widget);
- }
- if(parent && parent.addChild){
- parent.addChild(widget);
- }
- this._instantiate(objs[i], null, widget);
- }
- }
- return widget && widget.domNode;
- },
- createDomButton: function(/*DomNode*/refNode, /*DomNode?*/toNode){
- var s = refNode.className;
- if(s.match(/mblDomButton\w+_(\d+)/)){
- var nDiv = RegExp.$1 - 0;
- for(var i = 0, p = (toNode||refNode); i < nDiv; i++){
- p = dojo.create("DIV", null, p);
- }
- }
- },
- select: function(/*Boolean?*/deselect){
-
- },
- defaultClickAction: function(){
- if(this.toggle){
- this.select(this.selected);
- }else if(!this.selected){
- this.select();
- if(!this.selectOne){
- var _this = this;
- setTimeout(function(){
- _this.select(true);
- }, this._duration);
- }
- if(this.moveTo || this.href || this.url || this.scene){
- this.transitionTo(this.moveTo, this.href, this.url, this.scene);
- }
- }
- },
- getParentWidget: function(){
- var ref = this.srcNodeRef || this.domNode;
- return ref && ref.parentNode ? dijit.getEnclosingWidget(ref.parentNode) : null;
- }
- });
- dojo.declare(
- "dojox.mobile.ListItem",
- dojox.mobile.AbstractItem,
- {
- rightText: "",
- btnClass: "",
- anchorLabel: false,
- noArrow: false,
- selected: false,
- buildRendering: function(){
- this.inheritParams();
- var a = this.anchorNode = dojo.create("A");
- a.className = "mblListItemAnchor";
- var box = dojo.create("DIV");
- box.className = "mblListItemTextBox";
- if(this.anchorLabel){
- box.style.cursor = "pointer";
- }
- var r = this.srcNodeRef;
- if(r){
- for(var i = 0, len = r.childNodes.length; i < len; i++){
- box.appendChild(r.removeChild(r.firstChild));
- }
- }
- if(this.label){
- box.appendChild(dojo.doc.createTextNode(this.label));
- }
- a.appendChild(box);
- if(this.rightText){
- this._setRightTextAttr(this.rightText);
- }
- if(this.moveTo || this.href || this.url || this.clickable){
- var parent = this.getParentWidget();
- if(!this.noArrow && !(parent && parent.stateful)){
- var arrow = dojo.create("DIV");
- arrow.className = "mblArrow";
- a.appendChild(arrow);
- }
- this.connect(a, "onclick", "onClick");
- }else if(this.btnClass){
- var div = this.btnNode = dojo.create("DIV");
- div.className = this.btnClass+" mblRightButton";
- div.appendChild(dojo.create("DIV"));
- div.appendChild(dojo.create("P"));
- var dummyDiv = dojo.create("DIV");
- dummyDiv.className = "mblRightButtonContainer";
- dummyDiv.appendChild(div);
- a.appendChild(dummyDiv);
- dojo.addClass(a, "mblListItemAnchorHasRightButton");
- setTimeout(function(){
- dummyDiv.style.width = div.offsetWidth + "px";
- dummyDiv.style.height = div.offsetHeight + "px";
- if(dojo.isIE){
-
- a.parentNode.style.height = a.parentNode.offsetHeight + "px";
- }
- }, 0);
- }
- if(this.anchorLabel){
- box.style.display = "inline";
- }
- var li = this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("LI");
- li.className = "mblListItem" + (this.selected ? " mblItemSelected" : "");
- li.appendChild(a);
- this.setIcon();
- },
- setIcon: function(){
- if(this.iconNode){ return; }
- var a = this.anchorNode;
- if(this.icon && this.icon != "none"){
- var img = this.iconNode = dojo.create("IMG");
- img.className = "mblListItemIcon";
- img.src = this.icon;
- this.domNode.insertBefore(img, a);
- dojox.mobile.setupIcon(this.iconNode, this.iconPos);
- dojo.removeClass(a, "mblListItemAnchorNoIcon");
- }else{
- dojo.addClass(a, "mblListItemAnchorNoIcon");
- }
- },
- onClick: function(e){
- var a = e.currentTarget;
- var li = a.parentNode;
- if(dojo.hasClass(li, "mblItemSelected")){ return; }
- if(this.anchorLabel){
- for(var p = e.target; p.tagName != "LI"; p = p.parentNode){
- if(p.className == "mblListItemTextBox"){
- dojo.addClass(p, "mblListItemTextBoxSelected");
- setTimeout(function(){
- dojo.removeClass(p, "mblListItemTextBoxSelected");
- }, 1000);
- this.onAnchorLabelClicked(e);
- return;
- }
- }
- }
- if(this.getParentWidget().stateful){
- for(var i = 0, c = li.parentNode.childNodes; i < c.length; i++){
- dojo.removeClass(c[i], "mblItemSelected");
- }
- }else{
- setTimeout(function(){
- dojo.removeClass(li, "mblItemSelected");
- }, 1000);
- }
- dojo.addClass(li, "mblItemSelected");
- this.transitionTo(this.moveTo, this.href, this.url, this.scene);
- },
- onAnchorLabelClicked: function(e){
- },
- _setRightTextAttr: function(/*String*/text){
- this.rightText = text;
- if(!this._rightTextNode){
- this._rightTextNode = dojo.create("DIV", {className:"mblRightText"}, this.anchorNode);
- }
- this._rightTextNode.innerHTML = text;
- }
- });
- dojo.declare(
- "dojox.mobile.Switch",
- dijit._WidgetBase,
- {
- value: "on",
- leftLabel: "ON",
- rightLabel: "OFF",
- _width: 53,
- buildRendering: function(){
- this.domNode = this.srcNodeRef || dojo.doc.createElement("DIV");
- this.domNode.className = "mblSwitch";
- this.domNode.innerHTML =
- '<div class="mblSwitchInner">'
- + '<div class="mblSwitchBg mblSwitchBgLeft">'
- + '<div class="mblSwitchText mblSwitchTextLeft">'+this.leftLabel+'</div>'
- + '</div>'
- + '<div class="mblSwitchBg mblSwitchBgRight">'
- + '<div class="mblSwitchText mblSwitchTextRight">'+this.rightLabel+'</div>'
- + '</div>'
- + '<div class="mblSwitchKnob"></div>'
- + '</div>';
- var n = this.inner = this.domNode.firstChild;
- this.left = n.childNodes[0];
- this.right = n.childNodes[1];
- this.knob = n.childNodes[2];
- dojo.addClass(this.domNode, (this.value == "on") ? "mblSwitchOn" : "mblSwitchOff");
- this[this.value == "off" ? "left" : "right"].style.display = "none";
- },
- postCreate: function(){
- this.connect(this.knob, "onclick", "onClick");
- this.connect(this.knob, "touchstart", "onTouchStart");
- this.connect(this.knob, "mousedown", "onTouchStart");
- },
- _changeState: function(/*String*/state){
- this.inner.style.left = "";
- dojo.addClass(this.domNode, "mblSwitchAnimation");
- dojo.removeClass(this.domNode, (state == "on") ? "mblSwitchOff" : "mblSwitchOn");
- dojo.addClass(this.domNode, (state == "on") ? "mblSwitchOn" : "mblSwitchOff");
- var _this = this;
- setTimeout(function(){
- _this[state == "off" ? "left" : "right"].style.display = "none";
- dojo.removeClass(_this.domNode, "mblSwitchAnimation");
- }, 300);
- },
- onClick: function(e){
- if(this._moved){ return; }
- this.value = (this.value == "on") ? "off" : "on";
- this._changeState(this.value);
- this.onStateChanged(this.value);
- },
- onTouchStart: function(e){
- this._moved = false;
- this.innerStartX = this.inner.offsetLeft;
- if(e.targetTouches){
- this.touchStartX = e.targetTouches[0].clientX;
- this._conn1 = dojo.connect(this.inner, "touchmove", this, "onTouchMove");
- this._conn2 = dojo.connect(this.inner, "touchend", this, "onTouchEnd");
- }
- this.left.style.display = "block";
- this.right.style.display = "block";
- dojo.stopEvent(e);
- },
- onTouchMove: function(e){
- e.preventDefault();
- var dx;
- if(e.targetTouches){
- if(e.targetTouches.length != 1){ return false; }
- dx = e.targetTouches[0].clientX - this.touchStartX;
- }else{
- dx = e.clientX - this.touchStartX;
- }
- var pos = this.innerStartX + dx;
- var d = 10;
- if(pos <= -(this._width-d)){ pos = -this._width; }
- if(pos >= -d){ pos = 0; }
- this.inner.style.left = pos + "px";
- this._moved = true;
- },
- onTouchEnd: function(e){
- dojo.disconnect(this._conn1);
- dojo.disconnect(this._conn2);
- if(this.innerStartX == this.inner.offsetLeft){
- if(dojo.isWebKit){
- var ev = dojo.doc.createEvent("MouseEvents");
- ev.initEvent("click", true, true);
- this.knob.dispatchEvent(ev);
- }
- return;
- }
- var newState = (this.inner.offsetLeft < -(this._width/2)) ? "off" : "on";
- this._changeState(newState);
- if(newState != this.value){
- this.value = newState;
- this.onStateChanged(this.value);
- }
- },
- onStateChanged: function(/*String*/newState){
- }
- });
- dojo.declare(
- "dojox.mobile.Button",
- dijit._WidgetBase,
- {
- btnClass: "mblBlueButton",
- duration: 1000,
- label: null,
- buildRendering: function(){
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("BUTTON");
- this.domNode.className = "mblButton "+this.btnClass;
- if(this.label){
- this.domNode.innerHTML = this.label;
- }
- this.connect(this.domNode, "onclick", "onClick");
- },
- onClick: function(e){
- var button = this.domNode;
- var c = "mblButtonSelected "+this.btnClass+"Selected";
- dojo.addClass(button, c);
- setTimeout(function(){
- dojo.removeClass(button, c);
- }, this.duration);
- }
- });
- dojo.declare(
- "dojox.mobile.ToolBarButton",
- dojox.mobile.AbstractItem,
- {
- selected: false,
- _defaultColor: "mblColorDefault",
- _selColor: "mblColorDefaultSel",
- buildRendering: function(){
- this.inheritParams();
- this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("div");
- dojo.addClass(this.domNode, "mblToolbarButton mblArrowButtonText");
- var color;
- if(this.selected){
- color = this._selColor;
- }else if(this.domNode.className.indexOf("mblColor") == -1){
- color = this._defaultColor;
- }
- dojo.addClass(this.domNode, color);
- if(this.label){
- this.domNode.innerHTML = this.label;
- }else{
- this.label = this.domNode.innerHTML;
- }
- if(this.icon && this.icon != "none"){
- var img;
- if(this.iconPos){
- var iconDiv = dojo.create("DIV", null, this.domNode);
- img = dojo.create("IMG", null, iconDiv);
- img.style.position = "absolute";
- var arr = this.iconPos.split(/[ ,]/);
- dojo.style(iconDiv, {
- position: "relative",
- width: arr[2] + "px",
- height: arr[3] + "px"
- });
- }else{
- img = dojo.create("IMG", null, this.domNode);
- }
- img.src = this.icon;
- dojox.mobile.setupIcon(img, this.iconPos);
- this.iconNode = img;
- }
- this.createDomButton(this.domNode);
- this.connect(this.domNode, "onclick", "onClick");
- },
- select: function(/*Boolean?*/deselect){
- dojo.toggleClass(this.domNode, this._selColor, !deselect);
- this.selected = !deselect;
- },
- onClick: function(e){
- this.defaultClickAction();
- }
- });
- dojo.declare(
- "dojox.mobile.ProgressIndicator",
- null,
- {
- interval: 100,
- colors: [
- "#C0C0C0", "#C0C0C0", "#C0C0C0", "#C0C0C0",
- "#C0C0C0", "#C0C0C0", "#B8B9B8", "#AEAFAE",
- "#A4A5A4", "#9A9A9A", "#8E8E8E", "#838383"
- ],
- _bars: [],
- constructor: function(){
- this.domNode = dojo.create("DIV");
- this.domNode.className = "mblProgContainer";
- for(var i = 0; i < 12; i++){
- var div = dojo.create("DIV");
- div.className = "mblProg mblProg"+i;
- this.domNode.appendChild(div);
- this._bars.push(div);
- }
- },
- start: function(){
- var cntr = 0;
- var _this = this;
- this.timer = setInterval(function(){
- cntr--;
- cntr = cntr < 0 ? 11 : cntr;
- var c = _this.colors;
- for(var i = 0; i < 12; i++){
- var idx = (cntr + i) % 12;
- _this._bars[i].style.backgroundColor = c[idx];
- }
- }, this.interval);
- },
- stop: function(){
- if(this.timer){
- clearInterval(this.timer);
- }
- this.timer = null;
- if(this.domNode.parentNode){
- this.domNode.parentNode.removeChild(this.domNode);
- }
- }
- });
- dojox.mobile.ProgressIndicator._instance = null;
- dojox.mobile.ProgressIndicator.getInstance = function(){
- if(!dojox.mobile.ProgressIndicator._instance){
- dojox.mobile.ProgressIndicator._instance = new dojox.mobile.ProgressIndicator();
- }
- return dojox.mobile.ProgressIndicator._instance;
- };
- dojox.mobile.addClass = function(){
-
-
-
-
-
- var elems = document.getElementsByTagName("link");
- for(var i = 0, len = elems.length; i < len; i++){
- if(elems[i].href.match(/dojox\/mobile\/themes\/(\w+)\//)){
- dojox.mobile.theme = RegExp.$1;
- dojo.addClass(dojo.body(), dojox.mobile.theme);
- break;
- }
- }
- };
- dojox.mobile.setupIcon = function(/*DomNode*/iconNode, /*String*/iconPos){
- if(iconNode && iconPos){
- var arr = dojo.map(iconPos.split(/[ ,]/),
- function(item){ return item - 0; });
- var t = arr[0];
- var r = arr[1] + arr[2];
- var b = arr[0] + arr[3];
- var l = arr[1];
- iconNode.style.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
- iconNode.style.top = dojo.style(iconNode, "top") - t + "px";
- iconNode.style.left = dojo.style(iconNode.parentNode, "paddingLeft") - l + "px";
- }
- };
- dojox.mobile.hideAddressBar = function(){
- dojo.body().style.minHeight = "1000px";
- setTimeout(function(){ scrollTo(0, 1); }, 100);
- setTimeout(function(){ scrollTo(0, 1); }, 400);
- setTimeout(function(){
- scrollTo(0, 1);
-
- dojo.body().style.minHeight = (dojo.global.innerHeight||dojo.doc.documentElement.clientHeight) + "px";
- }, 1000);
- };
- dojox.mobile.openWindow = function(url, target){
- dojo.global.open(url, target || "_blank");
- };
- dojo._loaders.unshift(function(){
-
-
- var nodes = dojo.body().getElementsByTagName("*");
- var i, len, s;
- len = nodes.length;
- for(i = 0; i < len; i++){
- s = nodes[i].getAttribute("dojoType");
- if(s){
- if(nodes[i].parentNode.getAttribute("lazy") == "true"){
- nodes[i].setAttribute("__dojoType", s);
- nodes[i].removeAttribute("dojoType");
- }
- }
- }
- });
- dojo.addOnLoad(function(){
- dojox.mobile.addClass();
- if(dojo.config["mblApplyPageStyles"] !== false){
- dojo.addClass(dojo.doc.documentElement, "mobile");
- }
-
-
- if(dojo.config["mblHideAddressBar"] !== false){
- dojox.mobile.hideAddressBar();
- if(dojo.config["mblAlwaysHideAddressBar"] == true){
- if(dojo.global.onorientationchange !== undefined){
- dojo.connect(dojo.global, "onorientationchange", dojox.mobile.hideAddressBar);
- }else{
- dojo.connect(dojo.global, "onresize", dojox.mobile.hideAddressBar);
- }
- }
- }
-
-
- var nodes = dojo.body().getElementsByTagName("*");
- var i, len = nodes.length, s;
- for(i = 0; i < len; i++){
- s = nodes[i].getAttribute("__dojoType");
- if(s){
- nodes[i].setAttribute("dojoType", s);
- nodes[i].removeAttribute("__dojoType");
- }
- }
- if(dojo.hash){
-
- var findWidgets = function(root){
- var arr;
- arr = dijit.findWidgets(root);
- var widgets = arr;
- for(var i = 0; i < widgets.length; i++){
- arr = arr.concat(findWidgets(widgets[i].containerNode));
- }
- return arr;
- };
- dojo.subscribe("/dojo/hashchange", null, function(value){
- var view = dojox.mobile.currentView;
- if(!view){ return; }
- var params = dojox.mobile._params;
- if(!params){
- var moveTo = value ? value : dojox.mobile._defaultView.id;
- var widgets = findWidgets(view.domNode);
- var dir = 1, transition = "slide";
- for(i = 0; i < widgets.length; i++){
- var w = widgets[i];
- if("#"+moveTo == w.moveTo){
-
- transition = w.transition;
- dir = (w instanceof dojox.mobile.Heading) ? -1 : 1;
- break;
- }
- }
- params = [ moveTo, dir, transition ];
- }
- view.performTransition.apply(view, params);
- dojox.mobile._params = null;
- });
- }
- dojo.body().style.visibility = "visible";
- });
- dijit.getEnclosingWidget = function(node){
- while(node && node.tagName !== "BODY"){
- if(node.getAttribute && node.getAttribute("widgetId")){
- return dijit.registry.byId(node.getAttribute("widgetId"));
- }
- node = node._parentNode || node.parentNode;
- }
- return null;
- };
- }
- if(!dojo._hasResource["dojox.mobile"]){
- dojo._hasResource["dojox.mobile"] = true;
- dojo.provide("dojox.mobile");
- dojo.experimental("dojox.mobile");
- }
- if(!dojo._hasResource["dojox.mobile.parser"]){
- dojo._hasResource["dojox.mobile.parser"] = true;
- dojo.provide("dojox.mobile.parser");
- dojo.provide("dojo.parser");
- dojox.mobile.parser = new function(){
- this.instantiate = function(list, defaultParams){
-
-
-
-
- var ws = [];
- if(list){
- var i, len;
- len = list.length;
- for(i = 0; i < len; i++){
- var node = list[i];
- var cls = dojo.getObject(dojo.attr(node, "dojoType"));
- var proto = cls.prototype;
- var params = {};
- if(defaultParams){
- for(var name in defaultParams){
- params[name] = defaultParams[name];
- }
- }
- for(var prop in proto){
- var val = dojo.attr(node, prop);
- if(!val){ continue; }
- if(typeof proto[prop] == "string"){
- params[prop] = val;
- }else if(typeof proto[prop] == "number"){
- params[prop] = val - 0;
- }else if(typeof proto[prop] == "boolean"){
- params[prop] = (val != "false");
- }else if(typeof proto[prop] == "object"){
- params[prop] = eval("(" + val + ")");
- }
- }
- params["class"] = node.className;
- params["style"] = node.style && node.style.cssText;
- var instance = new cls(params, node);
- ws.push(instance);
- var jsId = node.getAttribute("jsId");
- if(jsId){
- dojo.setObject(jsId, instance);
- }
- }
- len = ws.length;
- for(i = 0; i < len; i++){
- var w = ws[i];
- w.startup && !w._started && (!w.getParent || !w.getParent()) && w.startup();
- }
- }
- return ws;
- };
- this.parse = function(rootNode, defaultParams){
-
-
-
-
-
-
- if(!rootNode){
- rootNode = dojo.body();
- }else if(!defaultParams && rootNode.rootNode){
-
- rootNode = rootNode.rootNode;
- }
- var nodes = rootNode.getElementsByTagName("*");
- var list = [];
- for(var i = 0, len = nodes.length; i < len; i++){
- if(nodes[i].getAttribute("dojoType")){
- list.push(nodes[i]);
- }
- }
- return this.instantiate(list, defaultParams);
- };
- }();
- dojo._loaders.unshift(function(){
- if(dojo.config.parseOnLoad){
- dojox.mobile.parser.parse();
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app._event"]){
- dojo._hasResource["dojox.mobile.app._event"] = true;
- dojo.provide("dojox.mobile.app._event");
- dojo.experimental("dojox.mobile.app._event.js");
- dojo.mixin(dojox.mobile.app, {
- eventMap: {},
- connectFlick: function(target, context, method){
-
-
-
-
-
-
-
-
-
-
-
-
- var startX;
- var startY;
- var isFlick = false;
- var currentX;
- var currentY;
- var connMove;
- var connUp;
- var direction;
- var time;
-
- var connDown = dojo.connect("onmousedown", target, function(event){
- isFlick = false;
- startX = event.targetTouches ? event.targetTouches[0].clientX : event.clientX;
- startY = event.targetTouches ? event.targetTouches[0].clientY : event.clientY;
- time = (new Date()).getTime();
- connMove = dojo.connect(target, "onmousemove", onMove);
- connUp = dojo.connect(target, "onmouseup", onUp);
- });
-
- var onMove = function(event){
- dojo.stopEvent(event);
- currentX = event.targetTouches ? event.targetTouches[0].clientX : event.clientX;
- currentY = event.targetTouches ? event.targetTouches[0].clientY : event.clientY;
- if(Math.abs(Math.abs(currentX) - Math.abs(startX)) > 15){
- isFlick = true;
- direction = (currentX > startX) ? "ltr" : "rtl";
- }else if(Math.abs(Math.abs(currentY) - Math.abs(startY)) > 15){
- isFlick = true;
- direction = (currentY > startY) ? "ttb" : "btt";
- }
- };
- var onUp = function(event){
- dojo.stopEvent(event);
- connMove && dojo.disconnect(connMove);
- connUp && dojo.disconnect(connUp);
- if(isFlick){
- var flickEvt = {
- target: target,
- direction: direction,
- duration: (new Date()).getTime() - time
- };
- if(context && method){
- context[method](flickEvt);
- }else{
- method(flickEvt);
- }
- }
- };
- }
- });
- dojox.mobile.app.isIPhone = (dojo.isSafari
- && (navigator.userAgent.indexOf("iPhone") > -1 ||
- navigator.userAgent.indexOf("iPod") > -1
- ));
- dojox.mobile.app.isWebOS = (navigator.userAgent.indexOf("webOS") > -1);
- dojox.mobile.app.isAndroid = (navigator.userAgent.toLowerCase().indexOf("android") > -1);
- if(dojox.mobile.app.isIPhone || dojox.mobile.app.isAndroid){
-
-
- dojox.mobile.app.eventMap = {
- onmousedown: "ontouchstart",
- mousedown: "ontouchstart",
- onmouseup: "ontouchend",
- mouseup: "ontouchend",
- onmousemove: "ontouchmove",
- mousemove: "ontouchmove"
- };
- }
- dojo._oldConnect = dojo._connect;
- dojo._connect = function(obj, event, context, method, dontFix){
- event = dojox.mobile.app.eventMap[event] || event;
- if(event == "flick" || event == "onflick"){
- if(dojo.global["Mojo"]){
- event = Mojo.Event.flick;
- }else{
- return dojox.mobile.app.connectFlick(obj, context, method);
- }
- }
- return dojo._oldConnect(obj, event, context, method, dontFix);
- }
- }
- if(!dojo._hasResource["dojox.mobile.app._Widget"]){
- dojo._hasResource["dojox.mobile.app._Widget"] = true;
- dojo.provide("dojox.mobile.app._Widget");
- dojo.experimental("dojox.mobile.app._Widget");
- dojo.declare("dojox.mobile.app._Widget", dijit._WidgetBase, {
-
-
- getScroll: function(){
-
-
- return {
- x: dojo.global.scrollX,
- y: dojo.global.scrollY
- };
- },
- connect: function(target, event, fn){
- if(event.toLowerCase() == "dblclick"
- || event.toLowerCase() == "ondblclick"){
- if(dojo.global["Mojo"]){
-
- return this.connect(target, Mojo.Event.tap, fn);
- }
- }
- return this.inherited(arguments);
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app.SceneController"]){
- dojo._hasResource["dojox.mobile.app.SceneController"] = true;
- dojo.provide("dojox.mobile.app.SceneController");
- dojo.experimental("dojox.mobile.app.SceneController");
- (function(){
- var app = dojox.mobile.app;
- var templates = {};
- dojo.declare("dojox.mobile.app.SceneController", dojox.mobile.View, {
- stageController: null,
- keepScrollPos: false,
- init: function(sceneName, params){
-
-
-
- this.sceneName = sceneName;
- this.params = params;
- var templateUrl = app.resolveTemplate(sceneName);
- this._deferredInit = new dojo.Deferred();
- if(templates[sceneName]){
-
- this._setContents(templates[sceneName]);
- }else{
-
- dojo.xhrGet({
- url: templateUrl,
- handleAs: "text"
- }).addCallback(dojo.hitch(this, this._setContents));
- }
- return this._deferredInit;
- },
- _setContents: function(templateHtml){
-
-
-
- templates[this.sceneName] = templateHtml;
- this.domNode.innerHTML = "<div>" + templateHtml + "</div>";
- var sceneAssistantName = "";
- var nameParts = this.sceneName.split("-");
- for(var i = 0; i < nameParts.length; i++){
- sceneAssistantName += nameParts[i].substring(0, 1).toUpperCase()
- + nameParts[i].substring(1);
- }
- sceneAssistantName += "Assistant";
- this.sceneAssistantName = sceneAssistantName;
- var _this = this;
- dojox.mobile.app.loadResourcesForScene(this.sceneName, function(){
- console.log("All resources for ",_this.sceneName," loaded");
- var assistant;
- if(typeof(dojo.global[sceneAssistantName]) != "undefined"){
- _this._initAssistant();
- }else{
- var assistantUrl = app.resolveAssistant(_this.sceneName);
- dojo.xhrGet({
- url: assistantUrl,
- handleAs: "text"
- }).addCallback(function(text){
- try{
- dojo.eval(text);
- }catch(e){
- console.log("Error initializing code for scene " + _this.sceneName
- + '. Please check for syntax errors');
- throw e;
- }
- _this._initAssistant();
- });
- }
- });
- },
- _initAssistant: function(){
-
-
-
-
- console.log("Instantiating the scene assistant " + this.sceneAssistantName);
- var cls = dojo.getObject(this.sceneAssistantName);
- if(!cls){
- throw Error("Unable to resolve scene assistant "
- + this.sceneAssistantName);
- }
- this.assistant = new cls(this.params);
- this.assistant.controller = this;
- this.assistant.domNode = this.domNode.firstChild;
- this.assistant.setup();
- this._deferredInit.callback();
- },
- query: function(selector, node){
-
-
-
- return dojo.query(selector, node || this.domNode)
- },
- parse: function(node){
- var widgets = this._widgets =
- dojox.mobile.parser.parse(node || this.domNode, {
- controller: this
- });
-
- for(var i = 0; i < widgets.length; i++){
- widgets[i].set("controller", this);
- }
- },
- getWindowSize: function(){
-
- return {
- w: dojo.global.innerWidth,
- h: dojo.global.innerHeight
- }
- },
- showAlertDialog: function(props){
- var size = dojo.marginBox(this.assistant.domNode);
- var dialog = new dojox.mobile.app.AlertDialog(
- dojo.mixin(props, {controller: this}));
- this.assistant.domNode.appendChild(dialog.domNode);
- console.log("Appended " , dialog.domNode, " to ", this.assistant.domNode);
- dialog.show();
- },
- popupSubMenu: function(info){
- var widget = new dojox.mobile.app.ListSelector({
- controller: this,
- destroyOnHide: true,
- onChoose: info.onChoose
- });
- this.assistant.domNode.appendChild(widget.domNode);
- widget.set("data", info.choices);
- widget.show(info.fromNode);
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.mobile.app.StageController"]){
- dojo._hasResource["dojox.mobile.app.StageController"] = true;
- dojo.provide("dojox.mobile.app.StageController");
- dojo.experimental("dojox.mobile.app.StageController");
- dojo.declare("dojox.mobile.app.StageController", null,{
-
-
- scenes: null,
- effect: "fade",
- constructor: function(node){
- this.domNode = node;
- this.scenes = [];
- if(dojo.config.mobileAnim){
- this.effect = dojo.config.mobileAnim;
- }
- },
- getActiveSceneController: function(){
- return this.scenes[this.scenes.length - 1];
- },
- pushScene: function(sceneName, params){
- if(this._opInProgress){
- return;
- }
- this._opInProgress = true;
-
- var node = dojo.create("div", {
- "class": "scene-wrapper",
- style: {
- visibility: "hidden"
- }
- }, this.domNode);
- var controller = new dojox.mobile.app.SceneController({}, node);
- if(this.scenes.length > 0){
- this.scenes[this.scenes.length -1].assistant.deactivate();
- }
- this.scenes.push(controller);
- var _this = this;
- dojo.forEach(this.scenes, this.setZIndex);
- controller.stageController = this;
- controller.init(sceneName, params).addCallback(function(){
- if(_this.scenes.length == 1){
- controller.domNode.style.visibility = "visible";
- _this.scenes[_this.scenes.length - 1].assistant.activate(params);
- _this._opInProgress = false;
- }else{
- _this.scenes[_this.scenes.length - 2]
- .performTransition(
- _this.scenes[_this.scenes.length - 1].domNode,
- 1,
- _this.effect,
- null,
- function(){
-
- _this.scenes[_this.scenes.length - 1].assistant.activate(params);
- _this._opInProgress = false;
- });
- }
- });
- },
- setZIndex: function(controller, idx){
- dojo.style(controller.domNode, "zIndex", idx + 1);
- },
- popScene: function(data){
-
-
- if(this._opInProgress){
- return;
- }
- var _this = this;
- if(this.scenes.length > 1){
- this._opInProgress = true;
- this.scenes[_this.scenes.length - 2].assistant.activate(data);
- this.scenes[_this.scenes.length - 1]
- .performTransition(
- _this.scenes[this.scenes.length - 2].domNode,
- -1,
- this.effect,
- null,
- function(){
-
- _this._destroyScene(_this.scenes[_this.scenes.length - 1]);
- _this.scenes.splice(_this.scenes.length - 1, 1);
- _this._opInProgress = false;
- });
- }else{
- console.log("cannot pop the scene if there is just one");
- }
- },
- popScenesTo: function(sceneName, data){
- if(this._opInProgress){
- return;
- }
- while(this.scenes.length > 2 &&
- this.scenes[this.scenes.length - 2].sceneName != sceneName){
- this._destroyScene(this.scenes[this.scenes.length - 2]);
- this.scenes.splice(this.scenes.length - 2, 1);
- }
- this.popScene(data);
- },
- _destroyScene: function(scene){
- scene.assistant.deactivate();
- scene.assistant.destroy();
- scene.destroyRecursive();
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app.SceneAssistant"]){
- dojo._hasResource["dojox.mobile.app.SceneAssistant"] = true;
- dojo.provide("dojox.mobile.app.SceneAssistant");
- dojo.experimental("dojox.mobile.app.SceneAssistant");
- dojo.declare("dojox.mobile.app.SceneAssistant", null, {
-
-
- constructor: function(){
- },
- setup: function(){
-
-
- },
- activate: function(params){
-
-
-
-
-
-
-
- },
- deactivate: function(){
-
-
-
-
- },
- destroy: function(){
-
- var children =
- dojo.query("> [widgetId]", this.containerNode).map(dijit.byNode);
- dojo.forEach(children, function(child){ child.destroyRecursive(); });
-
- this.disconnect();
- },
- connect: function(obj, method, callback){
- if(!this._connects){
- this._connects = [];
- }
- this._connects.push(dojo.connect(obj, method, callback));
- },
- disconnect: function(){
- dojo.forEach(this._connects, dojo.disconnect);
- this._connects = [];
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app.AlertDialog"]){
- dojo._hasResource["dojox.mobile.app.AlertDialog"] = true;
- dojo.provide("dojox.mobile.app.AlertDialog");
- dojo.experimental("dojox.mobile.app.AlertDialog");
- dojo.declare("dojox.mobile.app.AlertDialog", dijit._WidgetBase, {
-
-
- title: "",
-
-
- text: "",
-
-
- controller: null,
-
- buttons: null,
- defaultButtonLabel: "OK",
-
-
-
- onChoose: null,
- constructor: function(){
- this.onClick = dojo.hitch(this, this.onClick);
- this._handleSelect = dojo.hitch(this, this._handleSelect);
- },
- buildRendering: function(){
- this.domNode = dojo.create("div",{
- "class": "alertDialog"
- });
-
- var dlgBody = dojo.create("div", {"class": "alertDialogBody"}, this.domNode);
-
- dojo.create("div", {"class": "alertTitle", innerHTML: this.title || ""}, dlgBody);
-
- dojo.create("div", {"class": "alertText", innerHTML: this.text || ""}, dlgBody);
-
- var btnContainer = dojo.create("div", {"class": "alertBtns"}, dlgBody);
-
- if(!this.buttons || this.buttons.length == 0){
- this.buttons = [{
- label: this.defaultButtonLabel,
- value: "ok",
- "class": "affirmative"
- }];
- }
- var _this = this;
-
- dojo.forEach(this.buttons, function(btnInfo){
- var btn = new dojox.mobile.Button({
- btnClass: btnInfo["class"] || "",
- label: btnInfo.label
- });
- btn._dialogValue = btnInfo.value;
- dojo.place(btn.domNode, btnContainer);
- _this.connect(btn, "onClick", _this._handleSelect);
- });
- var viewportSize = this.controller.getWindowSize();
-
- this.mask = dojo.create("div", {"class": "dialogUnderlayWrapper",
- innerHTML: "<div class=\"dialogUnderlay\"></div>",
- style: {
- width: viewportSize.w + "px",
- height: viewportSize.h + "px"
- }
- }, this.controller.assistant.domNode);
- this.connect(this.mask, "onclick", function(){
- _this.onChoose && _this.onChoose();
- _this.hide();
- });
- },
- postCreate: function(){
- this.subscribe("/dojox/mobile/app/goback", this._handleSelect);
- },
- _handleSelect: function(event){
-
-
- var node;
- console.log("handleSelect");
- if(event && event.target){
- node = event.target;
-
- while(!dijit.byNode(node)){
- node - node.parentNode;
- }
- }
-
-
- if(this.onChoose){
- this.onChoose(node ? dijit.byNode(node)._dialogValue: undefined);
- }
-
- this.hide();
- },
- show: function(){
-
-
- this._doTransition(1);
- },
- hide: function(){
-
-
- this._doTransition(-1);
- },
- _doTransition: function(dir){
-
-
-
-
-
-
- var anim;
- var h = dojo.marginBox(this.domNode.firstChild).h;
- var bodyHeight = this.controller.getWindowSize().h;
- console.log("dialog height = " + h, " body height = " + bodyHeight);
- var high = bodyHeight - h;
- var low = bodyHeight;
- var anim1 = dojo.fx.slideTo({
- node: this.domNode,
- duration: 400,
- top: {start: dir < 0 ? high : low, end: dir < 0 ? low: high}
- });
- var anim2 = dojo[dir < 0 ? "fadeOut" : "fadeIn"]({
- node: this.mask,
- duration: 400
- });
- var anim = dojo.fx.combine([anim1, anim2]);
- var _this = this;
- dojo.connect(anim, "onEnd", this, function(){
- if(dir < 0){
- _this.domNode.style.display = "none";
- dojo.destroy(_this.domNode);
- dojo.destroy(_this.mask);
- }
- });
- anim.play();
- },
- destroy: function(){
- this.inherited(arguments);
- dojo.destroy(this.mask);
- },
- onClick: function(){
- }
- });
- }
- if(!dojo._hasResource["dojo.string"]){
- dojo._hasResource["dojo.string"] = true;
- dojo.provide("dojo.string");
- dojo.getObject("string", true, dojo);
- dojo.string.rep = function(/*String*/str, /*Integer*/num){
-
-
-
-
-
-
-
- if(num <= 0 || !str){ return ""; }
-
- var buf = [];
- for(;;){
- if(num & 1){
- buf.push(str);
- }
- if(!(num >>= 1)){ break; }
- str += str;
- }
- return buf.join("");
- };
- dojo.string.pad = function(/*String*/text, /*Integer*/size, /*String?*/ch, /*Boolean?*/end){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(!ch){
- ch = '0';
- }
- var out = String(text),
- pad = dojo.string.rep(ch, Math.ceil((size - out.length) / ch.length));
- return end ? out + pad : pad + out;
- };
- dojo.string.substitute = function( /*String*/ template,
- /*Object|Array*/map,
- /*Function?*/ transform,
- /*Object?*/ thisObject){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- thisObject = thisObject || dojo.global;
- transform = transform ?
- dojo.hitch(thisObject, transform) : function(v){ return v; };
- return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g,
- function(match, key, format){
- var value = dojo.getObject(key, false, map);
- if(format){
- value = dojo.getObject(format, false, thisObject).call(thisObject, value, key);
- }
- return transform(value, key).toString();
- });
- };
- dojo.string.trim = String.prototype.trim ?
- dojo.trim :
- function(str){
- str = str.replace(/^\s+/, '');
- for(var i = str.length - 1; i >= 0; i--){
- if(/\S/.test(str.charAt(i))){
- str = str.substring(0, i + 1);
- break;
- }
- }
- return str;
- };
- }
- if(!dojo._hasResource["dojox.mobile.app.List"]){
- dojo._hasResource["dojox.mobile.app.List"] = true;
- dojo.provide("dojox.mobile.app.List");
- dojo.experimental("dojox.mobile.app.List");
- (function(){
- var templateCache = {};
- dojo.declare("dojox.mobile.app.List", dijit._WidgetBase, {
-
-
-
-
-
-
-
- items: null,
-
-
-
- itemTemplate: "",
-
-
-
- emptyTemplate: "",
-
-
-
- dividerTemplate: "",
-
-
-
- dividerFunction: null,
-
-
- labelDelete: "Delete",
-
-
- labelCancel: "Cancel",
-
-
- controller: null,
-
- autoDelete: true,
-
- enableDelete: true,
-
- enableHold: true,
-
-
- formatters: null,
-
-
- _templateLoadCount: 0,
-
-
- _mouseDownPos: null,
- baseClass: "list",
- constructor: function(){
- this._checkLoadComplete = dojo.hitch(this, this._checkLoadComplete);
- this._replaceToken = dojo.hitch(this, this._replaceToken);
- this._postDeleteAnim = dojo.hitch(this, this._postDeleteAnim);
- },
- postCreate: function(){
- var _this = this;
- if(this.emptyTemplate){
- this._templateLoadCount++;
- }
- if(this.itemTemplate){
- this._templateLoadCount++;
- }
- if(this.dividerTemplate){
- this._templateLoadCount++;
- }
- this.connect(this.domNode, "onmousedown", function(event){
- var touch = event;
- if(event.targetTouches && event.targetTouches.length > 0){
- touch = event.targetTouches[0];
- }
-
- var rowNode = _this._getRowNode(event.target);
- if(rowNode){
-
-
- _this._setDataInfo(rowNode, event);
-
- _this._selectRow(rowNode);
-
- _this._mouseDownPos = {
- x: touch.pageX,
- y: touch.pageY
- };
- _this._dragThreshold = null;
- }
- });
- this.connect(this.domNode, "onmouseup", function(event){
-
-
- if(event.targetTouches && event.targetTouches.length > 0){
- event = event.targetTouches[0];
- }
- var rowNode = _this._getRowNode(event.target);
- if(rowNode){
- _this._setDataInfo(rowNode, event);
- if(_this._selectedRow){
- _this.onSelect(rowNode._data, rowNode._idx, rowNode);
- }
- this._deselectRow();
- }
- });
-
- if(this.enableDelete){
- this.connect(this.domNode, "mousemove", function(event){
- dojo.stopEvent(event);
- if(!_this._selectedRow){
- return;
- }
- var rowNode = _this._getRowNode(event.target);
-
-
- if(_this.enableDelete && rowNode && !_this._deleting){
- _this.handleDrag(event);
- }
- });
- }
-
- this.connect(this.domNode, "onclick", function(event){
- if(event.touches && event.touches.length > 0){
- event = event.touches[0];
- }
- var rowNode = _this._getRowNode(event.target, true);
- if(rowNode){
- _this._setDataInfo(rowNode, event);
- }
- });
-
-
- this.connect(this.domNode, "mouseout", function(event){
- if(event.touches && event.touches.length > 0){
- event = event.touches[0];
- }
- if(event.target == _this._selectedRow){
- _this._deselectRow();
- }
- });
-
- if(!this.itemTemplate){
- throw Error("An item template must be provided to " + this.declaredClass);
- }
-
- this._loadTemplate(this.itemTemplate, "itemTemplate", this._checkLoadComplete);
- if(this.emptyTemplate){
-
- this._loadTemplate(this.emptyTemplate, "emptyTemplate", this._checkLoadComplete);
- }
- if(this.dividerTemplate){
- this._loadTemplate(this.dividerTemplate, "dividerTemplate", this._checkLoadComplete);
- }
- },
- handleDrag: function(event){
-
-
- var touch = event;
- if(event.targetTouches && event.targetTouches.length > 0){
- touch = event.targetTouches[0];
- }
-
-
- var diff = touch.pageX - this._mouseDownPos.x;
- var absDiff = Math.abs(diff);
- if(absDiff > 10 && !this._dragThreshold){
-
- this._dragThreshold = dojo.marginBox(this._selectedRow).w * 0.6;
- if(!this.autoDelete){
- this.createDeleteButtons(this._selectedRow);
- }
- }
- this._selectedRow.style.left = (absDiff > 10 ? diff : 0) + "px";
-
-
- if(this._dragThreshold && this._dragThreshold < absDiff){
- this.preDelete(diff);
- }
- },
- handleDragCancel: function(){
-
-
-
- if(this._deleting){
- return;
- }
- dojo.removeClass(this._selectedRow, "hold");
- this._selectedRow.style.left = 0;
- this._mouseDownPos = null;
- this._dragThreshold = null;
- this._deleteBtns && dojo.style(this._deleteBtns, "display", "none");
- },
- preDelete: function(currentLeftPos){
-
-
-
- var self = this;
- this._deleting = true;
- dojo.animateProperty({
- node: this._selectedRow,
- duration: 400,
- properties: {
- left: {
- end: currentLeftPos +
- ((currentLeftPos > 0 ? 1 : -1) * this._dragThreshold * 0.8)
- }
- },
- onEnd: dojo.hitch(this, function(){
- if(this.autoDelete){
- this.deleteRow(this._selectedRow);
- }
- })
- }).play();
- },
- deleteRow: function(row){
-
-
- dojo.style(row, {
- visibility: "hidden",
- minHeight: "0px"
- });
- dojo.removeClass(row, "hold");
- this._deleteAnimConn =
- this.connect(row, "webkitAnimationEnd", this._postDeleteAnim);
- dojo.addClass(row, "collapsed");
- },
- _postDeleteAnim: function(event){
-
-
- if(this._deleteAnimConn){
- this.disconnect(this._deleteAnimConn);
- this._deleteAnimConn = null;
- }
- var row = this._selectedRow;
- var sibling = row.nextSibling;
- var prevSibling = row.previousSibling;
-
-
-
- if(prevSibling && prevSibling._isDivider){
- if(!sibling || sibling._isDivider){
- prevSibling.parentNode.removeChild(prevSibling);
- }
- }
- row.parentNode.removeChild(row);
- this.onDelete(row._data, row._idx, this.items);
-
- while(sibling){
- if(sibling._idx){
- sibling._idx--;
- }
- sibling = sibling.nextSibling;
- }
- dojo.destroy(row);
-
- dojo.query("> *:not(.buttons)", this.domNode).forEach(this.applyClass);
- this._deleting = false;
- this._deselectRow();
- },
- createDeleteButtons: function(aroundNode){
-
-
-
-
-
- var mb = dojo.marginBox(aroundNode);
- var pos = dojo._abs(aroundNode, true);
- if(!this._deleteBtns){
-
- this._deleteBtns = dojo.create("div",{
- "class": "buttons"
- }, this.domNode);
- this.buttons = [];
- this.buttons.push(new dojox.mobile.Button({
- btnClass: "mblRedButton",
- label: this.labelDelete
- }));
- this.buttons.push(new dojox.mobile.Button({
- btnClass: "mblBlueButton",
- label: this.labelCancel
- }));
- dojo.place(this.buttons[0].domNode, this._deleteBtns);
- dojo.place(this.buttons[1].domNode, this._deleteBtns);
- dojo.addClass(this.buttons[0].domNode, "deleteBtn");
- dojo.addClass(this.buttons[1].domNode, "cancelBtn");
- this._handleButtonClick = dojo.hitch(this._handleButtonClick);
- this.connect(this._deleteBtns, "onclick", this._handleButtonClick);
- }
- dojo.removeClass(this._deleteBtns, "fade out fast");
- dojo.style(this._deleteBtns, {
- display: "",
- width: mb.w + "px",
- height: mb.h + "px",
- top: (aroundNode.offsetTop) + "px",
- left: "0px"
- });
- },
- onDelete: function(data, index, array){
-
-
-
-
-
-
-
-
- array.splice(index, 1);
-
-
- if(array.length < 1){
- this.render();
- }
- },
- cancelDelete: function(){
-
-
- this._deleting = false;
- this.handleDragCancel();
- },
- _handleButtonClick: function(event){
-
-
-
- if(event.touches && event.touches.length > 0){
- event = event.touches[0];
- }
- var node = event.target;
- if(dojo.hasClass(node, "deleteBtn")){
- this.deleteRow(this._selectedRow);
- }else if(dojo.hasClass(node, "cancelBtn")){
- this.cancelDelete();
- }else{
- return;
- }
- dojo.addClass(this._deleteBtns, "fade out");
- },
- applyClass: function(node, idx, array){
-
-
-
- dojo.removeClass(node, "first last");
- if(idx == 0){
- dojo.addClass(node, "first");
- }
- if(idx == array.length - 1){
- dojo.addClass(node, "last");
- }
- },
- _setDataInfo: function(rowNode, event){
-
-
-
- event.item = rowNode._data;
- event.index = rowNode._idx;
- },
- onSelect: function(data, index, rowNode){
-
-
- },
- _selectRow: function(row){
-
-
- if(this._deleting && this._selectedRow && row != this._selectedRow){
- this.cancelDelete();
- }
- if(!dojo.hasClass(row, "row")){
- return;
- }
- if(this.enableHold || this.enableDelete){
- dojo.addClass(row, "hold");
- }
- this._selectedRow = row;
- },
- _deselectRow: function(){
-
-
-
- if(!this._selectedRow || this._deleting){
- return;
- }
- this.handleDragCancel();
- dojo.removeClass(this._selectedRow, "hold");
- this._selectedRow = null;
- },
- _getRowNode: function(fromNode, ignoreNoClick){
-
-
-
- while(fromNode && !fromNode._data && fromNode != this.domNode){
- if(!ignoreNoClick && dojo.hasClass(fromNode, "noclick")){
- return null;
- }
- fromNode = fromNode.parentNode;
- }
- return fromNode == this.domNode ? null : fromNode;
- },
- applyTemplate: function(template, data){
- return dojo._toDom(dojo.string.substitute(
- template, data, this._replaceToken, this.formatters || this));
- },
- render: function(){
-
-
-
- dojo.query("> *:not(.buttons)", this.domNode).forEach(dojo.destroy);
-
-
- if(this.items.length < 1 && this.emptyTemplate){
- dojo.place(dojo._toDom(this.emptyTemplate), this.domNode, "first");
- }else{
- this.domNode.appendChild(this._renderRange(0, this.items.length));
- }
- if(dojo.hasClass(this.domNode.parentNode, "mblRoundRect")){
- dojo.addClass(this.domNode.parentNode, "mblRoundRectList")
- }
- var divs = dojo.query("> .row", this.domNode);
- if(divs.length > 0){
- dojo.addClass(divs[0], "first");
- dojo.addClass(divs[divs.length - 1], "last");
- }
- },
- _renderRange: function(startIdx, endIdx){
- var rows = [];
- var row, i;
- var frag = document.createDocumentFragment();
- startIdx = Math.max(0, startIdx);
- endIdx = Math.min(endIdx, this.items.length);
- for(i = startIdx; i < endIdx; i++){
-
- row = this.applyTemplate(this.itemTemplate, this.items[i]);
- dojo.addClass(row, 'row');
- row._data = this.items[i];
- row._idx = i;
- rows.push(row);
- }
- if(!this.dividerFunction || !this.dividerTemplate){
- for(i = startIdx; i < endIdx; i++){
- rows[i]._data = this.items[i];
- rows[i]._idx = i;
- frag.appendChild(rows[i]);
- }
- }else{
- var prevDividerValue = null;
- var dividerValue;
- var divider;
- for(i = startIdx; i < endIdx; i++){
- rows[i]._data = this.items[i];
- rows[i]._idx = i;
- dividerValue = this.dividerFunction(this.items[i]);
- if(dividerValue && dividerValue != prevDividerValue){
- divider = this.applyTemplate(this.dividerTemplate, {
- label: dividerValue,
- item: this.items[i]
- });
- divider._isDivider = true;
- frag.appendChild(divider);
- prevDividerValue = dividerValue;
- }
- frag.appendChild(rows[i]);
- }
- }
- return frag;
- },
- _replaceToken: function(value, key){
- if(key.charAt(0) == '!'){ value = dojo.getObject(key.substr(1), false, _this); }
- if(typeof value == "undefined"){ return ""; }
- if(value == null){ return ""; }
-
-
- return key.charAt(0) == "!" ? value :
-
-
- value.toString().replace(/"/g,""");
- },
- _checkLoadComplete: function(){
-
-
- this._templateLoadCount--;
- if(this._templateLoadCount < 1 && this.get("items")){
- this.render();
- }
- },
- _loadTemplate: function(url, thisAttr, callback){
-
-
- if(!url){
- callback();
- return;
- }
- if(templateCache[url]){
- this.set(thisAttr, templateCache[url]);
- callback();
- }else{
- var _this = this;
- dojo.xhrGet({
- url: url,
- sync: false,
- handleAs: "text",
- load: function(text){
- templateCache[url] = dojo.trim(text);
- _this.set(thisAttr, templateCache[url]);
- callback();
- }
- });
- }
- },
- _setFormattersAttr: function(formatters){
-
-
- this.formatters = formatters;
- },
- _setItemsAttr: function(items){
-
-
- this.items = items || [];
- if(this._templateLoadCount < 1 && items){
- this.render();
- }
- },
- destroy: function(){
- if(this.buttons){
- dojo.forEach(this.buttons, function(button){
- button.destroy();
- });
- this.buttons = null;
- }
- this.inherited(arguments);
- }
- });
- })();
- }
- if(!dojo._hasResource["dojo.fx.Toggler"]){
- dojo._hasResource["dojo.fx.Toggler"] = true;
- dojo.provide("dojo.fx.Toggler");
- dojo.declare("dojo.fx.Toggler", null, {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- node: null,
-
-
- showFunc: dojo.fadeIn,
-
-
- hideFunc: dojo.fadeOut,
-
-
- showDuration: 200,
-
-
- hideDuration: 200,
-
-
-
-
-
-
-
- constructor: function(args){
- var _t = this;
- dojo.mixin(_t, args);
- _t.node = args.node;
- _t._showArgs = dojo.mixin({}, args);
- _t._showArgs.node = _t.node;
- _t._showArgs.duration = _t.showDuration;
- _t.showAnim = _t.showFunc(_t._showArgs);
- _t._hideArgs = dojo.mixin({}, args);
- _t._hideArgs.node = _t.node;
- _t._hideArgs.duration = _t.hideDuration;
- _t.hideAnim = _t.hideFunc(_t._hideArgs);
- dojo.connect(_t.showAnim, "beforeBegin", dojo.hitch(_t.hideAnim, "stop", true));
- dojo.connect(_t.hideAnim, "beforeBegin", dojo.hitch(_t.showAnim, "stop", true));
- },
- show: function(delay){
-
-
-
- return this.showAnim.play(delay || 0);
- },
- hide: function(delay){
-
-
-
- return this.hideAnim.play(delay || 0);
- }
- });
- }
- if(!dojo._hasResource["dojo.fx"]){
- dojo._hasResource["dojo.fx"] = true;
- dojo.provide("dojo.fx");
- (function(){
-
- var d = dojo,
- _baseObj = {
- _fire: function(evt, args){
- if(this[evt]){
- this[evt].apply(this, args||[]);
- }
- return this;
- }
- };
- var _chain = function(animations){
- this._index = -1;
- this._animations = animations||[];
- this._current = this._onAnimateCtx = this._onEndCtx = null;
- this.duration = 0;
- d.forEach(this._animations, function(a){
- this.duration += a.duration;
- if(a.delay){ this.duration += a.delay; }
- }, this);
- };
- d.extend(_chain, {
- _onAnimate: function(){
- this._fire("onAnimate", arguments);
- },
- _onEnd: function(){
- d.disconnect(this._onAnimateCtx);
- d.disconnect(this._onEndCtx);
- this._onAnimateCtx = this._onEndCtx = null;
- if(this._index + 1 == this._animations.length){
- this._fire("onEnd");
- }else{
-
- this._current = this._animations[++this._index];
- this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
- this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
- this._current.play(0, true);
- }
- },
- play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
- if(!this._current){ this._current = this._animations[this._index = 0]; }
- if(!gotoStart && this._current.status() == "playing"){ return this; }
- var beforeBegin = d.connect(this._current, "beforeBegin", this, function(){
- this._fire("beforeBegin");
- }),
- onBegin = d.connect(this._current, "onBegin", this, function(arg){
- this._fire("onBegin", arguments);
- }),
- onPlay = d.connect(this._current, "onPlay", this, function(arg){
- this._fire("onPlay", arguments);
- d.disconnect(beforeBegin);
- d.disconnect(onBegin);
- d.disconnect(onPlay);
- });
- if(this._onAnimateCtx){
- d.disconnect(this._onAnimateCtx);
- }
- this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
- if(this._onEndCtx){
- d.disconnect(this._onEndCtx);
- }
- this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
- this._current.play.apply(this._current, arguments);
- return this;
- },
- pause: function(){
- if(this._current){
- var e = d.connect(this._current, "onPause", this, function(arg){
- this._fire("onPause", arguments);
- d.disconnect(e);
- });
- this._current.pause();
- }
- return this;
- },
- gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
- this.pause();
- var offset = this.duration * percent;
- this._current = null;
- d.some(this._animations, function(a){
- if(a.duration <= offset){
- this._current = a;
- return true;
- }
- offset -= a.duration;
- return false;
- });
- if(this._current){
- this._current.gotoPercent(offset / this._current.duration, andPlay);
- }
- return this;
- },
- stop: function(/*boolean?*/ gotoEnd){
- if(this._current){
- if(gotoEnd){
- for(; this._index + 1 < this._animations.length; ++this._index){
- this._animations[this._index].stop(true);
- }
- this._current = this._animations[this._index];
- }
- var e = d.connect(this._current, "onStop", this, function(arg){
- this._fire("onStop", arguments);
- d.disconnect(e);
- });
- this._current.stop();
- }
- return this;
- },
- status: function(){
- return this._current ? this._current.status() : "stopped";
- },
- destroy: function(){
- if(this._onAnimateCtx){ d.disconnect(this._onAnimateCtx); }
- if(this._onEndCtx){ d.disconnect(this._onEndCtx); }
- }
- });
- d.extend(_chain, _baseObj);
- dojo.fx.chain = function(/*dojo.Animation[]*/ animations){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return new _chain(animations)
- };
- var _combine = function(animations){
- this._animations = animations||[];
- this._connects = [];
- this._finished = 0;
- this.duration = 0;
- d.forEach(animations, function(a){
- var duration = a.duration;
- if(a.delay){ duration += a.delay; }
- if(this.duration < duration){ this.duration = duration; }
- this._connects.push(d.connect(a, "onEnd", this, "_onEnd"));
- }, this);
-
- this._pseudoAnimation = new d.Animation({curve: [0, 1], duration: this.duration});
- var self = this;
- d.forEach(["beforeBegin", "onBegin", "onPlay", "onAnimate", "onPause", "onStop", "onEnd"],
- function(evt){
- self._connects.push(d.connect(self._pseudoAnimation, evt,
- function(){ self._fire(evt, arguments); }
- ));
- }
- );
- };
- d.extend(_combine, {
- _doAction: function(action, args){
- d.forEach(this._animations, function(a){
- a[action].apply(a, args);
- });
- return this;
- },
- _onEnd: function(){
- if(++this._finished > this._animations.length){
- this._fire("onEnd");
- }
- },
- _call: function(action, args){
- var t = this._pseudoAnimation;
- t[action].apply(t, args);
- },
- play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
- this._finished = 0;
- this._doAction("play", arguments);
- this._call("play", arguments);
- return this;
- },
- pause: function(){
- this._doAction("pause", arguments);
- this._call("pause", arguments);
- return this;
- },
- gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
- var ms = this.duration * percent;
- d.forEach(this._animations, function(a){
- a.gotoPercent(a.duration < ms ? 1 : (ms / a.duration), andPlay);
- });
- this._call("gotoPercent", arguments);
- return this;
- },
- stop: function(/*boolean?*/ gotoEnd){
- this._doAction("stop", arguments);
- this._call("stop", arguments);
- return this;
- },
- status: function(){
- return this._pseudoAnimation.status();
- },
- destroy: function(){
- d.forEach(this._connects, dojo.disconnect);
- }
- });
- d.extend(_combine, _baseObj);
- dojo.fx.combine = function(/*dojo.Animation[]*/ animations){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return new _combine(animations);
- };
- dojo.fx.wipeIn = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node), s = node.style, o;
- var anim = d.animateProperty(d.mixin({
- properties: {
- height: {
-
- start: function(){
-
-
- o = s.overflow;
- s.overflow = "hidden";
- if(s.visibility == "hidden" || s.display == "none"){
- s.height = "1px";
- s.display = "";
- s.visibility = "";
- return 1;
- }else{
- var height = d.style(node, "height");
- return Math.max(height, 1);
- }
- },
- end: function(){
- return node.scrollHeight;
- }
- }
- }
- }, args));
- d.connect(anim, "onEnd", function(){
- s.height = "auto";
- s.overflow = o;
- });
- return anim;
- };
- dojo.fx.wipeOut = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node), s = node.style, o;
-
- var anim = d.animateProperty(d.mixin({
- properties: {
- height: {
- end: 1
- }
- }
- }, args));
- d.connect(anim, "beforeBegin", function(){
- o = s.overflow;
- s.overflow = "hidden";
- s.display = "";
- });
- d.connect(anim, "onEnd", function(){
- s.overflow = o;
- s.height = "auto";
- s.display = "none";
- });
- return anim;
- };
- dojo.fx.slideTo = function(/*Object*/ args){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var node = args.node = d.byId(args.node),
- top = null, left = null;
- var init = (function(n){
- return function(){
- var cs = d.getComputedStyle(n);
- var pos = cs.position;
- top = (pos == 'absolute' ? n.offsetTop : parseInt(cs.top) || 0);
- left = (pos == 'absolute' ? n.offsetLeft : parseInt(cs.left) || 0);
- if(pos != 'absolute' && pos != 'relative'){
- var ret = d.position(n, true);
- top = ret.y;
- left = ret.x;
- n.style.position="absolute";
- n.style.top=top+"px";
- n.style.left=left+"px";
- }
- };
- })(node);
- init();
- var anim = d.animateProperty(d.mixin({
- properties: {
- top: args.top || 0,
- left: args.left || 0
- }
- }, args));
- d.connect(anim, "beforeBegin", anim, init);
- return anim;
- };
- })();
- }
- if(!dojo._hasResource["dojox.mobile.app.ListSelector"]){
- dojo._hasResource["dojox.mobile.app.ListSelector"] = true;
- dojo.provide("dojox.mobile.app.ListSelector");
- dojo.experimental("dojox.mobile.app.ListSelector");
- dojo.declare("dojox.mobile.app.ListSelector", dojox.mobile.app._Widget, {
-
-
-
-
- data: null,
-
-
- controller: null,
-
-
- onChoose: null,
- destroyOnHide: false,
- _setDataAttr: function(data){
- this.data = data;
-
- if(this.data){
- this.render();
- }
- },
- postCreate: function(){
- dojo.addClass(this.domNode, "listSelector");
-
- var _this = this;
-
- this.connect(this.domNode, "onclick", function(event){
- if(!dojo.hasClass(event.target, "listSelectorRow")){
- return;
- }
-
- if(_this.onChoose){
- _this.onChoose(_this.data[event.target._idx].value);
- }
- _this.hide();
- });
- this.connect(this.domNode, "onmousedown", function(event){
- if(!dojo.hasClass(event.target, "listSelectorRow")){
- return;
- }
- dojo.addClass(event.target, "listSelectorRow-selected");
- });
- this.connect(this.domNode, "onmouseup", function(event){
- if(!dojo.hasClass(event.target, "listSelectorRow")){
- return;
- }
- dojo.removeClass(event.target, "listSelectorRow-selected");
- });
- this.connect(this.domNode, "onmouseout", function(event){
- if(!dojo.hasClass(event.target, "listSelectorRow")){
- return;
- }
- dojo.removeClass(event.target, "listSelectorRow-selected");
- });
-
- var viewportSize = this.controller.getWindowSize();
-
- this.mask = dojo.create("div", {"class": "dialogUnderlayWrapper",
- innerHTML: "<div class=\"dialogUnderlay\"></div>"
- }, this.controller.assistant.domNode);
-
- this.connect(this.mask, "onclick", function(){
- _this.onChoose && _this.onChoose();
- _this.hide();
- });
- },
- show: function(fromNode){
-
- var startPos;
-
- var windowSize = this.controller.getWindowSize();
- var fromNodePos;
- if(fromNode){
- fromNodePos = dojo._abs(fromNode);
- startPos = fromNodePos;
- }else{
- startPos.x = windowSize.w / 2;
- startPos.y = 200;
- }
- console.log("startPos = ", startPos);
-
- dojo.style(this.domNode, {
- opacity: 0,
- display: "",
- width: Math.floor(windowSize.w * 0.8) + "px"
- });
-
- var maxWidth = 0;
- dojo.query(">", this.domNode).forEach(function(node){
- dojo.style(node, {
- "float": "left"
- });
- maxWidth = Math.max(maxWidth, dojo.marginBox(node).w);
- dojo.style(node, {
- "float": "none"
- });
- });
- maxWidth = Math.min(maxWidth, Math.round(windowSize.w * 0.8))
- + dojo.style(this.domNode, "paddingLeft")
- + dojo.style(this.domNode, "paddingRight")
- + 1;
-
- dojo.style(this.domNode, "width", maxWidth + "px");
- var targetHeight = dojo.marginBox(this.domNode).h;
-
- var _this = this;
-
-
- var targetY = fromNodePos ?
- Math.max(30, fromNodePos.y - targetHeight - 10) :
- this.getScroll().y + 30;
-
- console.log("fromNodePos = ", fromNodePos, " targetHeight = ", targetHeight,
- " targetY = " + targetY, " startPos ", startPos);
-
-
- var anim1 = dojo.animateProperty({
- node: this.domNode,
- duration: 400,
- properties: {
- width: {start: 1, end: maxWidth},
- height: {start: 1, end: targetHeight},
- top: {start: startPos.y, end: targetY},
- left: {start: startPos.x, end: (windowSize.w/2 - maxWidth/2)},
- opacity: {start: 0, end: 1},
- fontSize: {start: 1}
- },
- onEnd: function(){
- dojo.style(_this.domNode, "width", "inherit");
- }
- });
- var anim2 = dojo.fadeIn({
- node: this.mask,
- duration: 400
- });
- dojo.fx.combine([anim1, anim2]).play();
- },
- hide: function(){
-
-
- var _this = this;
-
- var anim1 = dojo.animateProperty({
- node: this.domNode,
- duration: 500,
- properties: {
- width: {end: 1},
- height: {end: 1},
- opacity: {end: 0},
- fontSize: {end: 1}
- },
- onEnd: function(){
- if(_this.get("destroyOnHide")){
- _this.destroy();
- }
- }
- });
-
- var anim2 = dojo.fadeOut({
- node: this.mask,
- duration: 400
- });
- dojo.fx.combine([anim1, anim2]).play();
- },
- render: function(){
-
-
-
- dojo.empty(this.domNode);
- dojo.style(this.domNode, "opacity", 0);
-
- var row;
-
- for(var i = 0; i < this.data.length; i++){
-
- row = dojo.create("div", {
- "class": "listSelectorRow " + (this.data[i].className || ""),
- innerHTML: this.data[i].label
- }, this.domNode);
-
- row._idx = i;
-
- if(i == 0){
- dojo.addClass(row, "first");
- }
- if(i == this.data.length - 1){
- dojo.addClass(row, "last");
- }
-
- }
- },
- destroy: function(){
- this.inherited(arguments);
- dojo.destroy(this.mask);
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app._FormWidget"]){
- dojo._hasResource["dojox.mobile.app._FormWidget"] = true;
- dojo.provide("dojox.mobile.app._FormWidget");
- dojo.experimental("dojox.mobile.app._FormWidget");
- dojo.declare("dojox.mobile.app._FormWidget", dijit._WidgetBase, {
-
-
-
-
-
-
-
-
-
-
-
-
- name: "",
-
-
- alt: "",
-
-
- value: "",
-
-
- type: "text",
-
-
-
- disabled: false,
-
-
- intermediateChanges: false,
-
-
- scrollOnFocus: false,
-
- attributeMap: dojo.delegate(dijit._WidgetBase.prototype.attributeMap, {
- value: "focusNode",
- id: "focusNode",
- alt: "focusNode",
- title: "focusNode"
- }),
- postMixInProperties: function(){
-
-
-
-
- this.nameAttrSetting = this.name ? ('name="' + this.name.replace(/'/g, """) + '"') : '';
- this.inherited(arguments);
- },
- postCreate: function(){
- this.inherited(arguments);
- this.connect(this.domNode, "onmousedown", "_onMouseDown");
- },
- _setDisabledAttr: function(/*Boolean*/ value){
- this.disabled = value;
- dojo.attr(this.focusNode, 'disabled', value);
- if(this.valueNode){
- dojo.attr(this.valueNode, 'disabled', value);
- }
- },
- _onFocus: function(e){
- if(this.scrollOnFocus){
- dojo.window.scrollIntoView(this.domNode);
- }
- this.inherited(arguments);
- },
- isFocusable: function(){
-
-
-
-
- return !this.disabled && !this.readOnly
- && this.focusNode && (dojo.style(this.domNode, "display") != "none");
- },
- focus: function(){
-
-
- this.focusNode.focus();
- },
- compare: function(/*anything*/val1, /*anything*/val2){
-
-
-
-
- if(typeof val1 == "number" && typeof val2 == "number"){
- return (isNaN(val1) && isNaN(val2)) ? 0 : val1 - val2;
- }else if(val1 > val2){
- return 1;
- }else if(val1 < val2){
- return -1;
- }else{
- return 0;
- }
- },
- onChange: function(newValue){
-
-
-
-
- },
-
-
-
-
- _onChangeActive: false,
- _handleOnChange: function(/*anything*/ newValue, /* Boolean? */ priorityChange){
-
-
-
-
-
-
-
-
-
-
- this._lastValue = newValue;
- if(this._lastValueReported == undefined && (priorityChange === null || !this._onChangeActive)){
-
-
- this._resetValue = this._lastValueReported = newValue;
- }
- if((this.intermediateChanges || priorityChange || priorityChange === undefined) &&
- ((typeof newValue != typeof this._lastValueReported) ||
- this.compare(newValue, this._lastValueReported) != 0)){
- this._lastValueReported = newValue;
- if(this._onChangeActive){
- if(this._onChangeHandle){
- clearTimeout(this._onChangeHandle);
- }
-
-
- this._onChangeHandle = setTimeout(dojo.hitch(this,
- function(){
- this._onChangeHandle = null;
- this.onChange(newValue);
- }), 0);
- }
- }
- },
- create: function(){
-
- this.inherited(arguments);
- this._onChangeActive = true;
- },
- destroy: function(){
- if(this._onChangeHandle){
- clearTimeout(this._onChangeHandle);
- this.onChange(this._lastValueReported);
- }
- this.inherited(arguments);
- },
- _onMouseDown: function(e){
-
-
-
-
- if(this.isFocusable()){
-
-
- var mouseUpConnector = this.connect(dojo.body(), "onmouseup", function(){
- if(this.isFocusable()){
- this.focus();
- }
- this.disconnect(mouseUpConnector);
- });
- }
- },
- selectInputText: function(/*DomNode*/element, /*Number?*/ start, /*Number?*/ stop){
-
-
-
- var _window = dojo.global;
- var _document = dojo.doc;
- element = dojo.byId(element);
- if(isNaN(start)){ start = 0; }
- if(isNaN(stop)){ stop = element.value ? element.value.length : 0; }
- dijit.focus(element);
- if(_window["getSelection"] && element.setSelectionRange){
- element.setSelectionRange(start, stop);
- }
- }
- });
- dojo.declare("dojox.mobile.app._FormValueWidget", dojox.mobile.app._FormWidget,
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- readOnly: false,
- attributeMap: dojo.delegate(dojox.mobile.app._FormWidget.prototype.attributeMap, {
- value: "",
- readOnly: "focusNode"
- }),
- _setReadOnlyAttr: function(/*Boolean*/ value){
- this.readOnly = value;
- dojo.attr(this.focusNode, 'readOnly', value);
- },
- postCreate: function(){
- this.inherited(arguments);
-
-
- if(this._resetValue === undefined){
- this._resetValue = this.value;
- }
- },
- _setValueAttr: function(/*anything*/ newValue, /*Boolean, optional*/ priorityChange){
-
-
-
-
-
-
- this.value = newValue;
- this._handleOnChange(newValue, priorityChange);
- },
- _getValueAttr: function(){
-
-
- return this._lastValue;
- },
- undo: function(){
-
-
- this._setValueAttr(this._lastValueReported, false);
- },
- reset: function(){
-
-
- this._hasBeenBlurred = false;
- this._setValueAttr(this._resetValue, true);
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app.TextBox"]){
- dojo._hasResource["dojox.mobile.app.TextBox"] = true;
- dojo.provide("dojox.mobile.app.TextBox");
- dojo.experimental("dojox.mobile.app.TextBox");
- dojo.declare(
- "dojox.mobile.app.TextBox",
- dojox.mobile.app._FormValueWidget, {
-
-
-
-
- trim: false,
-
-
- uppercase: false,
-
-
- lowercase: false,
-
-
- propercase: false,
-
-
- maxLength: "",
-
-
- selectOnClick: false,
-
-
-
- placeHolder: "",
- baseClass: "mblTextBox",
- attributeMap: dojo.delegate(dojox.mobile.app._FormValueWidget.prototype.attributeMap, {
- maxLength: "focusNode"
- }),
- buildRendering: function(){
- var node = this.srcNodeRef;
-
- if(!node || node.tagName != "INPUT"){
- node = dojo.create("input", {});
- }
- dojo.attr(node, {
- type: "text",
- value: dojo.attr(node, "value") || "",
- placeholder: this.placeHolder || null
- });
- this.domNode = this.textbox = this.focusNode = node;
- },
- _setPlaceHolderAttr: function(v){
- this.placeHolder = v;
- if(this.textbox){
- dojo.attr(this.textbox, "placeholder", v);
- }
- },
- _getValueAttr: function(){
-
-
-
-
-
-
-
-
-
- return this.parse(this.get('displayedValue'), this.constraints);
- },
- _setValueAttr: function(value, /*Boolean?*/ priorityChange, /*String?*/ formattedValue){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var filteredValue;
- if(value !== undefined){
-
-
- filteredValue = this.filter(value);
- if(typeof formattedValue != "string"){
- if(filteredValue !== null
- && ((typeof filteredValue != "number") || !isNaN(filteredValue))){
- formattedValue = this.filter(this.format(filteredValue, this.constraints));
- }else{ formattedValue = ''; }
- }
- }
- if(formattedValue != null && formattedValue != undefined
- && ((typeof formattedValue) != "number" || !isNaN(formattedValue))
- && this.textbox.value != formattedValue){
- this.textbox.value = formattedValue;
- }
- this.inherited(arguments, [filteredValue, priorityChange]);
- },
-
-
-
-
-
-
-
-
-
-
-
-
- displayedValue: "",
- _getDisplayedValueAttr: function(){
-
-
-
-
-
-
-
-
-
- return this.filter(this.textbox.value);
- },
- _setDisplayedValueAttr: function(/*String*/value){
-
-
-
-
-
-
- if(value === null || value === undefined){ value = '' }
- else if(typeof value != "string"){ value = String(value) }
- this.textbox.value = value;
- this._setValueAttr(this.get('value'), undefined, value);
- },
- format: function(/* String */ value, /* Object */ constraints){
-
-
-
-
- return ((value == null || value == undefined) ? "" : (value.toString ? value.toString() : value));
- },
- parse: function(/* String */ value, /* Object */ constraints){
-
-
-
-
- return value;
- },
- _refreshState: function(){
-
-
-
-
-
-
- },
- _onInput: function(e){
- if(e && e.type && /key/i.test(e.type) && e.keyCode){
- switch(e.keyCode){
- case dojo.keys.SHIFT:
- case dojo.keys.ALT:
- case dojo.keys.CTRL:
- case dojo.keys.TAB:
- return;
- }
- }
- if(this.intermediateChanges){
- var _this = this;
-
- setTimeout(function(){ _this._handleOnChange(_this.get('value'), false); }, 0);
- }
- this._refreshState();
- },
- postCreate: function(){
-
-
- this.textbox.setAttribute("value", this.textbox.value);
- this.inherited(arguments);
- if(dojo.isMoz || dojo.isOpera){
- this.connect(this.textbox, "oninput", this._onInput);
- }else{
- this.connect(this.textbox, "onkeydown", this._onInput);
- this.connect(this.textbox, "onkeyup", this._onInput);
- this.connect(this.textbox, "onpaste", this._onInput);
- this.connect(this.textbox, "oncut", this._onInput);
- }
- },
- _blankValue: '',
- filter: function(val){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(val === null){ return this._blankValue; }
- if(typeof val != "string"){ return val; }
- if(this.trim){
- val = dojo.trim(val);
- }
- if(this.uppercase){
- val = val.toUpperCase();
- }
- if(this.lowercase){
- val = val.toLowerCase();
- }
- if(this.propercase){
- val = val.replace(/[^\s]+/g, function(word){
- return word.substring(0,1).toUpperCase() + word.substring(1);
- });
- }
- return val;
- },
- _setBlurValue: function(){
- this._setValueAttr(this.get('value'), true);
- },
- _onBlur: function(e){
- if(this.disabled){ return; }
- this._setBlurValue();
- this.inherited(arguments);
- if(this._selectOnClickHandle){
- this.disconnect(this._selectOnClickHandle);
- }
- if(this.selectOnClick && dojo.isMoz){
- this.textbox.selectionStart = this.textbox.selectionEnd = undefined;
- }
- },
- _onFocus: function(/*String*/ by){
- if(this.disabled || this.readOnly){ return; }
-
-
-
- if(this.selectOnClick && by == "mouse"){
- this._selectOnClickHandle = this.connect(this.domNode, "onmouseup", function(){
-
-
- this.disconnect(this._selectOnClickHandle);
-
-
- var textIsNotSelected;
- textIsNotSelected = this.textbox.selectionStart == this.textbox.selectionEnd;
- if(textIsNotSelected){
- this.selectInputText(this.textbox);
- }
- });
- }
- this._refreshState();
- this.inherited(arguments);
- },
- reset: function(){
-
-
- this.textbox.value = '';
- this.inherited(arguments);
- }
- }
- );
- }
- if(!dojo._hasResource["dojo.fx.easing"]){
- dojo._hasResource["dojo.fx.easing"] = true;
- dojo.provide("dojo.fx.easing");
- dojo.getObject("fx.easing", true, dojo);
- dojo.fx.easing = {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- linear: function(/* Decimal? */n){
-
- return n;
- },
- quadIn: function(/* Decimal? */n){
- return Math.pow(n, 2);
- },
- quadOut: function(/* Decimal? */n){
- return n * (n - 2) * -1;
- },
- quadInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 2) / 2; }
- return -1 * ((--n) * (n - 2) - 1) / 2;
- },
- cubicIn: function(/* Decimal? */n){
- return Math.pow(n, 3);
- },
- cubicOut: function(/* Decimal? */n){
- return Math.pow(n - 1, 3) + 1;
- },
- cubicInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 3) / 2; }
- n -= 2;
- return (Math.pow(n, 3) + 2) / 2;
- },
- quartIn: function(/* Decimal? */n){
- return Math.pow(n, 4);
- },
- quartOut: function(/* Decimal? */n){
- return -1 * (Math.pow(n - 1, 4) - 1);
- },
- quartInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 4) / 2; }
- n -= 2;
- return -1 / 2 * (Math.pow(n, 4) - 2);
- },
- quintIn: function(/* Decimal? */n){
- return Math.pow(n, 5);
- },
- quintOut: function(/* Decimal? */n){
- return Math.pow(n - 1, 5) + 1;
- },
- quintInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return Math.pow(n, 5) / 2; };
- n -= 2;
- return (Math.pow(n, 5) + 2) / 2;
- },
- sineIn: function(/* Decimal? */n){
- return -1 * Math.cos(n * (Math.PI / 2)) + 1;
- },
- sineOut: function(/* Decimal? */n){
- return Math.sin(n * (Math.PI / 2));
- },
- sineInOut: function(/* Decimal? */n){
- return -1 * (Math.cos(Math.PI * n) - 1) / 2;
- },
- expoIn: function(/* Decimal? */n){
- return (n == 0) ? 0 : Math.pow(2, 10 * (n - 1));
- },
- expoOut: function(/* Decimal? */n){
- return (n == 1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1);
- },
- expoInOut: function(/* Decimal? */n){
- if(n == 0){ return 0; }
- if(n == 1){ return 1; }
- n = n * 2;
- if(n < 1){ return Math.pow(2, 10 * (n - 1)) / 2; }
- --n;
- return (-1 * Math.pow(2, -10 * n) + 2) / 2;
- },
- circIn: function(/* Decimal? */n){
- return -1 * (Math.sqrt(1 - Math.pow(n, 2)) - 1);
- },
- circOut: function(/* Decimal? */n){
- n = n - 1;
- return Math.sqrt(1 - Math.pow(n, 2));
- },
- circInOut: function(/* Decimal? */n){
- n = n * 2;
- if(n < 1){ return -1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) - 1); }
- n -= 2;
- return 1 / 2 * (Math.sqrt(1 - Math.pow(n, 2)) + 1);
- },
- backIn: function(/* Decimal? */n){
-
-
-
-
-
-
- var s = 1.70158;
- return Math.pow(n, 2) * ((s + 1) * n - s);
- },
- backOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
- n = n - 1;
- var s = 1.70158;
- return Math.pow(n, 2) * ((s + 1) * n + s) + 1;
- },
- backInOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
- var s = 1.70158 * 1.525;
- n = n * 2;
- if(n < 1){ return (Math.pow(n, 2) * ((s + 1) * n - s)) / 2; }
- n-=2;
- return (Math.pow(n, 2) * ((s + 1) * n + s) + 2) / 2;
- },
- elasticIn: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
- if(n == 0 || n == 1){ return n; }
- var p = .3;
- var s = p / 4;
- n = n - 1;
- return -1 * Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p);
- },
- elasticOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
-
- if(n==0 || n == 1){ return n; }
- var p = .3;
- var s = p / 4;
- return Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p) + 1;
- },
- elasticInOut: function(/* Decimal? */n){
-
-
-
-
-
-
-
-
-
-
- if(n == 0) return 0;
- n = n * 2;
- if(n == 2) return 1;
- var p = .3 * 1.5;
- var s = p / 4;
- if(n < 1){
- n -= 1;
- return -.5 * (Math.pow(2, 10 * n) * Math.sin((n - s) * (2 * Math.PI) / p));
- }
- n -= 1;
- return .5 * (Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / p)) + 1;
- },
- bounceIn: function(/* Decimal? */n){
-
-
- return (1 - dojo.fx.easing.bounceOut(1 - n));
- },
- bounceOut: function(/* Decimal? */n){
-
-
- var s = 7.5625;
- var p = 2.75;
- var l;
- if(n < (1 / p)){
- l = s * Math.pow(n, 2);
- }else if(n < (2 / p)){
- n -= (1.5 / p);
- l = s * Math.pow(n, 2) + .75;
- }else if(n < (2.5 / p)){
- n -= (2.25 / p);
- l = s * Math.pow(n, 2) + .9375;
- }else{
- n -= (2.625 / p);
- l = s * Math.pow(n, 2) + .984375;
- }
- return l;
- },
- bounceInOut: function(/* Decimal? */n){
-
-
- if(n < 0.5){ return dojo.fx.easing.bounceIn(n * 2) / 2; }
- return (dojo.fx.easing.bounceOut(n * 2 - 1) / 2) + 0.5;
- }
- };
- }
- if(!dojo._hasResource["dojox.mobile.app.ImageView"]){
- dojo._hasResource["dojox.mobile.app.ImageView"] = true;
- dojo.provide("dojox.mobile.app.ImageView");
- dojo.experimental("dojox.mobile.app.ImageView");
- dojo.declare("dojox.mobile.app.ImageView", dojox.mobile.app._Widget, {
-
-
- zoom: 1,
-
-
- zoomCenterX: 0,
-
-
- zoomCenterY: 0,
-
-
-
- maxZoom: 5,
-
-
-
- autoZoomLevel: 3,
-
-
- disableAutoZoom: false,
-
-
- disableSwipe: false,
-
-
- autoZoomEvent: null,
-
-
- _leftImg: null,
-
-
- _centerImg: null,
-
-
- _rightImg: null,
-
-
- _leftSmallImg: null,
-
-
- _centerSmallImg: null,
-
-
- _rightSmallImg: null,
- constructor: function(){
- this.panX = 0;
- this.panY = 0;
- this.handleLoad = dojo.hitch(this, this.handleLoad);
- this._updateAnimatedZoom = dojo.hitch(this, this._updateAnimatedZoom);
- this._updateAnimatedPan = dojo.hitch(this, this._updateAnimatedPan);
- this._onAnimPanEnd = dojo.hitch(this, this._onAnimPanEnd);
- },
- buildRendering: function(){
- this.inherited(arguments);
- this.canvas = dojo.create("canvas", {}, this.domNode);
- dojo.addClass(this.domNode, "mblImageView");
- },
- postCreate: function(){
- this.inherited(arguments);
- this.size = dojo.marginBox(this.domNode);
- dojo.style(this.canvas, {
- width: this.size.w + "px",
- height: this.size.h + "px"
- });
- this.canvas.height = this.size.h;
- this.canvas.width = this.size.w;
- var _this = this;
-
-
- this.connect(this.domNode, "onmousedown", function(event){
- if(_this.isAnimating()){
- return;
- }
- if(_this.panX){
- _this.handleDragEnd();
- }
- _this.downX = event.targetTouches ? event.targetTouches[0].clientX : event.clientX;
- _this.downY = event.targetTouches ? event.targetTouches[0].clientY : event.clientY;
- });
-
- this.connect(this.domNode, "onmousemove", function(event){
- if(_this.isAnimating()){
- return;
- }
- if((!_this.downX && _this.downX !== 0) || (!_this.downY && _this.downY !== 0)){
-
- return;
- }
- if((!_this.disableSwipe && _this.zoom == 1)
- || (!_this.disableAutoZoom && _this.zoom != 1)){
- var x = event.targetTouches ?
- event.targetTouches[0].clientX : event.pageX;
- var y = event.targetTouches ?
- event.targetTouches[0].clientY : event.pageY;
- _this.panX = x - _this.downX;
- _this.panY = y - _this.downY;
- if(_this.zoom == 1){
-
-
-
- if(Math.abs(_this.panX) > 10){
- _this.render();
- }
- }else{
-
-
- if(Math.abs(_this.panX) > 10 || Math.abs(_this.panY) > 10){
- _this.render();
- }
- }
- }
- });
- this.connect(this.domNode, "onmouseout", function(event){
- if(!_this.isAnimating() && _this.panX){
- _this.handleDragEnd();
- }
- });
- this.connect(this.domNode, "onmouseover", function(event){
- _this.downX = _this.downY = null;
- });
-
-
- this.connect(this.domNode, "onclick", function(event){
- if(_this.isAnimating()){
- return;
- }
- if(_this.downX == null || _this.downY == null){
- return;
- }
- var x = (event.targetTouches ?
- event.targetTouches[0].clientX : event.pageX);
- var y = (event.targetTouches ?
- event.targetTouches[0].clientY : event.pageY);
-
-
- if(Math.abs(_this.panX) > 14 || Math.abs(_this.panY) > 14){
- _this.downX = _this.downY = null;
- _this.handleDragEnd();
- return;
- }
- _this.downX = _this.downY = null;
- if(!_this.disableAutoZoom){
- if(!_this._centerImg || !_this._centerImg._loaded){
-
- return;
- }
- if(_this.zoom != 1){
- _this.set("animatedZoom", 1);
- return;
- }
- var pos = dojo._abs(_this.domNode);
-
- var xRatio = _this.size.w / _this._centerImg.width;
- var yRatio = _this.size.h / _this._centerImg.height;
-
- _this.zoomTo(
- ((x - pos.x) / xRatio) - _this.panX,
- ((y - pos.y) / yRatio) - _this.panY,
- _this.autoZoomLevel);
- }
- });
-
- dojo.connect(this.domNode, "flick", this, "handleFlick");
- },
- isAnimating: function(){
-
-
- return this._anim && this._anim.status() == "playing";
- },
- handleDragEnd: function(){
-
-
-
-
- this.downX = this.downY = null;
- console.log("handleDragEnd");
- if(this.zoom == 1){
- if(!this.panX){
- return;
- }
- var leftLoaded = (this._leftImg && this._leftImg._loaded)
- || (this._leftSmallImg && this._leftSmallImg._loaded);
- var rightLoaded = (this._rightImg && this._rightImg._loaded)
- || (this._rightSmallImg && this._rightSmallImg._loaded);
-
-
- var doMove =
- !(Math.abs(this.panX) < this._centerImg._baseWidth / 2) &&
- (
- (this.panX > 0 && leftLoaded ? 1 : 0) ||
- (this.panX < 0 && rightLoaded ? 1 : 0)
- );
- if(!doMove){
-
-
- this._animPanTo(0, dojo.fx.easing.expoOut, 700);
- }else{
-
- this.moveTo(this.panX);
- }
- }else{
- if(!this.panX && !this.panY){
- return;
- }
-
-
- this.zoomCenterX -= (this.panX / this.zoom);
- this.zoomCenterY -= (this.panY / this.zoom);
- this.panX = this.panY = 0;
- }
- },
- handleFlick: function(event){
-
-
- if(this.zoom == 1 && event.duration < 500){
-
-
-
- if(event.direction == "ltr"){
- this.moveTo(1);
- }else if(event.direction == "rtl"){
- this.moveTo(-1);
- }
-
- this.downX = this.downY = null;
- }
- },
- moveTo: function(direction){
- direction = direction > 0 ? 1 : -1;
- var toImg;
- if(direction < 1){
- if(this._rightImg && this._rightImg._loaded){
- toImg = this._rightImg;
- }else if(this._rightSmallImg && this._rightSmallImg._loaded){
- toImg = this._rightSmallImg;
- }
- }else{
- if(this._leftImg && this._leftImg._loaded){
- toImg = this._leftImg;
- }else if(this._leftSmallImg && this._leftSmallImg._loaded){
- toImg = this._leftSmallImg;
- }
- }
- this._moveDir = direction;
- var _this = this;
- if(toImg && toImg._loaded){
-
- this._animPanTo(this.size.w * direction, null, 500, function(){
- _this.panX = 0;
- _this.panY = 0;
- if(direction < 0){
-
- _this._switchImage("left", "right");
- }else{
-
- _this._switchImage("right", "left");
- }
- _this.render();
- _this.onChange(direction * -1);
- });
- }else{
-
-
-
- console.log("moveTo image not loaded!", toImg);
- this._animPanTo(0, dojo.fx.easing.expoOut, 700);
- }
- },
- _switchImage: function(toImg, fromImg){
- var toSmallImgName = "_" + toImg + "SmallImg";
- var toImgName = "_" + toImg + "Img";
- var fromSmallImgName = "_" + fromImg + "SmallImg";
- var fromImgName = "_" + fromImg + "Img";
- this[toImgName] = this._centerImg;
- this[toSmallImgName] = this._centerSmallImg;
- this[toImgName]._type = toImg;
- if(this[toSmallImgName]){
- this[toSmallImgName]._type = toImg;
- }
- this._centerImg = this[fromImgName];
- this._centerSmallImg = this[fromSmallImgName];
- this._centerImg._type = "center";
- if(this._centerSmallImg){
- this._centerSmallImg._type = "center";
- }
- this[fromImgName] = this[fromSmallImgName] = null;
- },
- _animPanTo: function(to, easing, duration, callback){
- this._animCallback = callback;
- this._anim = new dojo.Animation({
- curve: [this.panX, to],
- onAnimate: this._updateAnimatedPan,
- duration: duration || 500,
- easing: easing,
- onEnd: this._onAnimPanEnd
- });
- this._anim.play();
- return this._anim;
- },
- onChange: function(direction){
-
-
-
- },
- _updateAnimatedPan: function(amount){
- this.panX = amount;
- this.render();
- },
- _onAnimPanEnd: function(){
- this.panX = this.panY = 0;
- if(this._animCallback){
- this._animCallback();
- }
- },
- zoomTo: function(centerX, centerY, zoom){
- this.set("zoomCenterX", centerX);
- this.set("zoomCenterY", centerY);
- this.set("animatedZoom", zoom);
- },
- render: function(){
- var cxt = this.canvas.getContext('2d');
- cxt.clearRect(0, 0, this.canvas.width, this.canvas.height);
-
- this._renderImg(
- this._centerSmallImg,
- this._centerImg,
- this.zoom == 1 ? (this.panX < 0 ? 1 : this.panX > 0 ? -1 : 0) : 0);
- if(this.zoom == 1 && this.panX != 0){
- if(this.panX > 0){
-
- this._renderImg(this._leftSmallImg, this._leftImg, 1);
- }else{
-
- this._renderImg(this._rightSmallImg, this._rightImg, -1);
- }
- }
- },
- _renderImg: function(smallImg, largeImg, panDir){
-
-
-
- var img = (largeImg && largeImg._loaded) ? largeImg : smallImg;
- if(!img || !img._loaded){
-
- return;
- }
- var cxt = this.canvas.getContext('2d');
- var baseWidth = img._baseWidth;
- var baseHeight = img._baseHeight;
-
- var desiredWidth = baseWidth * this.zoom;
- var desiredHeight = baseHeight * this.zoom;
-
- var destWidth = Math.min(this.size.w, desiredWidth);
- var destHeight = Math.min(this.size.h, desiredHeight);
-
- var sourceWidth = this.dispWidth = img.width * (destWidth / desiredWidth);
- var sourceHeight = this.dispHeight = img.height * (destHeight / desiredHeight);
- var zoomCenterX = this.zoomCenterX - (this.panX / this.zoom);
- var zoomCenterY = this.zoomCenterY - (this.panY / this.zoom);
-
- var centerX = Math.floor(Math.max(sourceWidth / 2,
- Math.min(img.width - sourceWidth / 2, zoomCenterX)));
- var centerY = Math.floor(Math.max(sourceHeight / 2,
- Math.min(img.height - sourceHeight / 2, zoomCenterY)));
- var sourceX = Math.max(0,
- Math.round((img.width - sourceWidth)/2 + (centerX - img._centerX)) );
- var sourceY = Math.max(0,
- Math.round((img.height - sourceHeight) / 2 + (centerY - img._centerY))
- );
- var destX = Math.round(Math.max(0, this.canvas.width - destWidth)/2);
- var destY = Math.round(Math.max(0, this.canvas.height - destHeight)/2);
- var oldDestWidth = destWidth;
- var oldSourceWidth = sourceWidth;
- if(this.zoom == 1 && panDir && this.panX){
- if(this.panX < 0){
- if(panDir > 0){
-
-
-
- destWidth -= Math.abs(this.panX);
- destX = 0;
- }else if(panDir < 0){
-
-
-
-
- destWidth = Math.max(1, Math.abs(this.panX) - 5);
- destX = this.size.w - destWidth;
- }
- }else{
- if(panDir > 0){
-
-
-
-
- destWidth = Math.max(1, Math.abs(this.panX) - 5);
- destX = 0;
- }else if(panDir < 0){
-
-
-
- destWidth -= Math.abs(this.panX);
- destX = this.size.w - destWidth;
- }
- }
- sourceWidth = Math.max(1,
- Math.floor(sourceWidth * (destWidth / oldDestWidth)));
- if(panDir > 0){
-
-
-
- sourceX = (sourceX + oldSourceWidth) - (sourceWidth);
- }
- sourceX = Math.floor(sourceX);
- }
- try{
-
- cxt.drawImage(
- img,
- Math.max(0, sourceX),
- sourceY,
- Math.min(oldSourceWidth, sourceWidth),
- sourceHeight,
- destX,
- destY,
- Math.min(oldDestWidth, destWidth),
- destHeight
- );
- }catch(e){
- console.log("Caught Error",e,
- "type=", img._type,
- "oldDestWidth = ", oldDestWidth,
- "destWidth", destWidth,
- "destX", destX
- , "oldSourceWidth=",oldSourceWidth,
- "sourceWidth=", sourceWidth,
- "sourceX = " + sourceX
- );
- }
- },
- _setZoomAttr: function(amount){
- this.zoom = Math.min(this.maxZoom, Math.max(1, amount));
- if(this.zoom == 1
- && this._centerImg
- && this._centerImg._loaded){
- if(!this.isAnimating()){
- this.zoomCenterX = this._centerImg.width / 2;
- this.zoomCenterY = this._centerImg.height / 2;
- }
- this.panX = this.panY = 0;
- }
- this.render();
- },
- _setZoomCenterXAttr: function(value){
- if(value != this.zoomCenterX){
- if(this._centerImg && this._centerImg._loaded){
- value = Math.min(this._centerImg.width, value);
- }
- this.zoomCenterX = Math.max(0, Math.round(value));
- }
- },
- _setZoomCenterYAttr: function(value){
- if(value != this.zoomCenterY){
- if(this._centerImg && this._centerImg._loaded){
- value = Math.min(this._centerImg.height, value);
- }
- this.zoomCenterY = Math.max(0, Math.round(value));
- }
- },
- _setZoomCenterAttr: function(value){
- if(value.x != this.zoomCenterX || value.y != this.zoomCenterY){
- this.set("zoomCenterX", value.x);
- this.set("zoomCenterY", value.y);
- this.render();
- }
- },
- _setAnimatedZoomAttr: function(amount){
- if(this._anim && this._anim.status() == "playing"){
- return;
- }
- this._anim = new dojo.Animation({
- curve: [this.zoom, amount],
- onAnimate: this._updateAnimatedZoom,
- onEnd: this._onAnimEnd
- });
- this._anim.play();
- },
- _updateAnimatedZoom: function(amount){
- this._setZoomAttr(amount);
- },
- _setCenterUrlAttr: function(urlOrObj){
- this._setImage("center", urlOrObj);
- },
- _setLeftUrlAttr: function(urlOrObj){
- this._setImage("left", urlOrObj);
- },
- _setRightUrlAttr: function(urlOrObj){
- this._setImage("right", urlOrObj);
- },
- _setImage: function(name, urlOrObj){
- var smallUrl = null;
- var largeUrl = null;
- if(dojo.isString(urlOrObj)){
-
- largeUrl = urlOrObj;
- }else{
- largeUrl = urlOrObj.large;
- smallUrl = urlOrObj.small;
- }
- if(this["_" + name + "Img"] && this["_" + name + "Img"]._src == largeUrl){
-
- return;
- }
-
- var largeImg = this["_" + name + "Img"] = new Image();
- largeImg._type = name;
- largeImg._loaded = false;
- largeImg._src = largeUrl;
- largeImg._conn = dojo.connect(largeImg, "onload", this.handleLoad);
- if(smallUrl){
-
-
- var smallImg = this["_" + name + "SmallImg"] = new Image();
- smallImg._type = name;
- smallImg._loaded = false;
- smallImg._conn = dojo.connect(smallImg, "onload", this.handleLoad);
- smallImg._isSmall = true;
- smallImg._src = smallUrl;
- smallImg.src = smallUrl;
- }
-
-
- largeImg.src = largeUrl;
- },
- handleLoad: function(evt){
-
-
-
- var img = evt.target;
- img._loaded = true;
- dojo.disconnect(img._conn);
- var type = img._type;
- switch(type){
- case "center":
- this.zoomCenterX = img.width / 2;
- this.zoomCenterY = img.height / 2;
- break;
- }
- var height = img.height;
- var width = img.width;
- if(width / this.size.w < height / this.size.h){
-
- img._baseHeight = this.canvas.height;
- img._baseWidth = width / (height / this.size.h);
- }else{
-
- img._baseWidth = this.canvas.width;
- img._baseHeight = height / (width / this.size.w);
- }
- img._centerX = width / 2;
- img._centerY = height / 2;
- this.render();
- this.onLoad(img._type, img._src, img._isSmall);
- },
- onLoad: function(type, url, isSmall){
-
-
-
-
-
-
-
-
-
-
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app.ImageThumbView"]){
- dojo._hasResource["dojox.mobile.app.ImageThumbView"] = true;
- dojo.provide("dojox.mobile.app.ImageThumbView");
- dojo.experimental("dojox.mobile.app.ImageThumbView");
- dojo.declare("dojox.mobile.app.ImageThumbView", dijit._WidgetBase, {
-
-
-
-
-
-
-
- items: [],
-
-
- urlParam: "url",
- labelParam: null,
- itemTemplate: '<div class="mblThumbInner">' +
- '<div class="mblThumbOverlay"></div>' +
- '<div class="mblThumbMask">' +
- '<div class="mblThumbSrc" style="background-image:url(${url})"></div>' +
- '</div>' +
- '</div>',
- minPadding: 4,
- maxPerRow: 3,
- maxRows: -1,
- baseClass: "mblImageThumbView",
- thumbSize: "medium",
- animationEnabled: true,
- selectedIndex: -1,
- cache: null,
- cacheMustMatch: false,
- clickEvent: "onclick",
- cacheBust: false,
- disableHide: false,
- constructor: function(params, node){
- },
- postCreate: function(){
- this.inherited(arguments);
- var _this = this;
- var hoverCls = "mblThumbHover";
- this.addThumb = dojo.hitch(this, this.addThumb);
- this.handleImgLoad = dojo.hitch(this, this.handleImgLoad);
- this.hideCached = dojo.hitch(this, this.hideCached);
- this._onLoadImages = {};
- this.cache = [];
- this.visibleImages = [];
- this._cacheCounter = 0;
- this.connect(this.domNode, this.clickEvent, function(event){
- var itemNode = _this._getItemNodeFromEvent(event);
- if(itemNode && !itemNode._cached){
- _this.onSelect(itemNode._item, itemNode._index, _this.items);
- dojo.query(".selected", this.domNode).removeClass("selected");
- dojo.addClass(itemNode, "selected");
- }
- });
- dojo.addClass(this.domNode, this.thumbSize);
- this.resize();
- this.render();
- },
- onSelect: function(item, index, items){
-
-
- },
- _setAnimationEnabledAttr: function(value){
- this.animationEnabled = value;
- dojo[value ? "addClass" : "removeClass"](this.domNode, "animated");
- },
- _setItemsAttr: function(items){
- this.items = items || [];
- var urls = {};
- var i;
- for(i = 0; i < this.items.length; i++){
- urls[this.items[i][this.urlParam]] = 1;
- }
- var clearedUrls = [];
- for(var url in this._onLoadImages){
- if(!urls[url] && this._onLoadImages[url]._conn){
- dojo.disconnect(this._onLoadImages[url]._conn);
- this._onLoadImages[url].src = null;
- clearedUrls.push(url);
- }
- }
- for(i = 0; i < clearedUrls.length; i++){
- delete this._onLoadImages[url];
- }
- this.render();
- },
- _getItemNode: function(node){
- while(node && !dojo.hasClass(node, "mblThumb") && node != this.domNode){
- node = node.parentNode;
- }
- return (node == this.domNode) ? null : node;
- },
- _getItemNodeFromEvent: function(event){
- if(event.touches && event.touches.length > 0){
- event = event.touches[0];
- }
- return this._getItemNode(event.target);
- },
- resize: function(){
- this._thumbSize = null;
- this._size = dojo.contentBox(this.domNode);
- this.disableHide = true;
- this.render();
- this.disableHide = false;
- },
- hideCached: function(){
-
-
-
- for(var i = 0; i < this.cache.length; i++){
- if (this.cache[i]) {
- dojo.style(this.cache[i], "display", "none");
- }
- }
- },
- render: function(){
- var i;
- var url;
- var item;
- var thumb;
- while(this.visibleImages && this.visibleImages.length > 0){
- thumb = this.visibleImages.pop();
- this.cache.push(thumb);
- if (!this.disableHide) {
- dojo.addClass(thumb, "hidden");
- }
- thumb._cached = true;
- }
- if(this.cache && this.cache.length > 0){
- setTimeout(this.hideCached, 1000);
- }
- if(!this.items || this.items.length == 0){
- return;
- }
- for(i = 0; i < this.items.length; i++){
- item = this.items[i];
- url = (dojo.isString(item) ? item : item[this.urlParam]);
- this.addThumb(item, url, i);
- if(this.maxRows > 0 && (i + 1) / this.maxPerRow >= this.maxRows){
- break;
- }
- }
- if(!this._thumbSize){
- return;
- }
- var column = 0;
- var row = -1;
- var totalThumbWidth = this._thumbSize.w + (this.padding * 2);
- var totalThumbHeight = this._thumbSize.h + (this.padding * 2);
- var nodes = this.thumbNodes =
- dojo.query(".mblThumb", this.domNode);
- var pos = 0;
- nodes = this.visibleImages;
- for(i = 0; i < nodes.length; i++){
- if(nodes[i]._cached){
- continue;
- }
- if(pos % this.maxPerRow == 0){
- row ++;
- }
- column = pos % this.maxPerRow;
- this.place(
- nodes[i],
- (column * totalThumbWidth) + this.padding,
- (row * totalThumbHeight) + this.padding
- );
- if(!nodes[i]._loading){
- dojo.removeClass(nodes[i], "hidden");
- }
- if(pos == this.selectedIndex){
- dojo[pos == this.selectedIndex ? "addClass" : "removeClass"]
- (nodes[i], "selected");
- }
- pos++;
- }
- var numRows = Math.ceil(pos / this.maxPerRow);
- this._numRows = numRows;
- this.setContainerHeight((numRows * (this._thumbSize.h + this.padding * 2)));
- },
- setContainerHeight: function(amount){
- dojo.style(this.domNode, "height", amount + "px");
- },
- addThumb: function(item, url, index){
- var thumbDiv;
- var cacheHit = false;
- if(this.cache.length > 0){
-
- var found = false;
-
- for(var i = 0; i < this.cache.length; i++){
- if(this.cache[i]._url == url){
- thumbDiv = this.cache.splice(i, 1)[0];
- found = true;
- break
- }
- }
-
- if(!thumbDiv && !this.cacheMustMatch){
- thumbDiv = this.cache.pop();
- dojo.removeClass(thumbDiv, "selected");
- } else {
- cacheHit = true;
- }
- }
- if(!thumbDiv){
-
- thumbDiv = dojo.create("div", {
- "class": "mblThumb hidden",
- innerHTML: dojo.string.substitute(this.itemTemplate, {
- url: url
- }, null, this)
- }, this.domNode);
- }
- if(this.labelParam) {
- var labelNode = dojo.query(".mblThumbLabel", thumbDiv)[0];
- if(!labelNode) {
- labelNode = dojo.create("div", {
- "class": "mblThumbLabel"
- }, thumbDiv);
- }
- labelNode.innerHTML = item[this.labelParam] || "";
- }
- dojo.style(thumbDiv, "display", "");
- if (!this.disableHide) {
- dojo.addClass(thumbDiv, "hidden");
- }
- if (!cacheHit) {
- var loader = dojo.create("img", {});
- loader._thumbDiv = thumbDiv;
- loader._conn = dojo.connect(loader, "onload", this.handleImgLoad);
- loader._url = url;
- thumbDiv._loading = true;
- this._onLoadImages[url] = loader;
- if (loader) {
- loader.src = url;
- }
- }
- this.visibleImages.push(thumbDiv);
- thumbDiv._index = index;
- thumbDiv._item = item;
- thumbDiv._url = url;
- thumbDiv._cached = false;
- if(!this._thumbSize){
- this._thumbSize = dojo.marginBox(thumbDiv);
- if(this._thumbSize.h == 0){
- this._thumbSize.h = 100;
- this._thumbSize.w = 100;
- }
- if(this.labelParam){
- this._thumbSize.h += 8;
- }
- this.calcPadding();
- }
- },
- handleImgLoad: function(event){
- var img = event.target;
- dojo.disconnect(img._conn);
- dojo.removeClass(img._thumbDiv, "hidden");
- img._thumbDiv._loading = false;
- img._conn = null;
- var url = img._url;
- if(this.cacheBust){
- url += (url.indexOf("?") > -1 ? "&" : "?")
- + "cacheBust=" + (new Date()).getTime() + "_" + (this._cacheCounter++);
- }
- dojo.query(".mblThumbSrc", img._thumbDiv)
- .style("backgroundImage", "url(" + url + ")");
- delete this._onLoadImages[img._url];
- },
- calcPadding: function(){
- var width = this._size.w;
- var thumbWidth = this._thumbSize.w;
- var imgBounds = thumbWidth + this.minPadding;
- this.maxPerRow = Math.floor(width / imgBounds);
- this.padding = Math.floor((width - (thumbWidth * this.maxPerRow)) / (this.maxPerRow * 2));
- },
- place: function(node, x, y){
- dojo.style(node, {
- "-webkit-transform" :"translate(" + x + "px," + y + "px)"
- });
- },
- destroy: function(){
-
- var img;
- var counter = 0;
- for (var url in this._onLoadImages){
- img = this._onLoadImages[url];
- if (img) {
- img.src = null;
- counter++;
- }
- }
- this.inherited(arguments);
- }
- });
- }
- if(!dojo._hasResource["dojox.mobile.app._base"]){
- dojo._hasResource["dojox.mobile.app._base"] = true;
- dojo.provide("dojox.mobile.app._base");
- dojo.experimental("dojox.mobile.app._base");
- (function(){
- var stageController;
- var appInfo;
- var jsDependencies = [
- "dojox.mobile",
- "dojox.mobile.parser"
- ];
- var loadedResources = {};
- var loadingDependencies;
- var rootNode;
- var sceneResources = [];
-
-
- function loadResources(resources, callback){
-
-
-
-
-
- var resource;
- var url;
- do {
- resource = resources.pop();
- if (resource.source) {
- url = resource.source;
- }else if (resource.module) {
- url = dojo.baseUrl + dojo._getModuleSymbols(resource.module).join("/") + '.js';
- }else {
- alert("Error: invalid JavaScript resource " + dojo.toJson(resource));
- return;
- }
- }while (resources.length > 0 && loadedResources[url]);
- if(resources.length < 1 && loadedResources[url]){
-
- callback();
- return;
- }
- dojo.xhrGet({
- url: url,
- sync: false
- }).addCallbacks(function(text){
- dojo["eval"](text);
- loadedResources[url] = true;
- if(resources.length > 0){
- loadResources(resources, callback);
- }else{
- callback();
- }
- },
- function(){
- alert("Failed to load resource " + url);
- });
- }
- var pushFirstScene = function(){
-
-
- stageController = new dojox.mobile.app.StageController(rootNode);
- var defaultInfo = {
- id: "com.test.app",
- version: "1.0.0",
- initialScene: "main"
- };
-
-
- if(dojo.global["appInfo"]){
- dojo.mixin(defaultInfo, dojo.global["appInfo"]);
- }
- appInfo = dojox.mobile.app.info = defaultInfo;
-
- if(appInfo.title){
- var titleNode = dojo.query("head title")[0] ||
- dojo.create("title", {},dojo.query("head")[0]);
- document.title = appInfo.title;
- }
- stageController.pushScene(appInfo.initialScene);
- };
- var initBackButton = function(){
- var hasNativeBack = false;
- if(dojo.global.BackButton){
-
- BackButton.override();
- dojo.connect(document, 'backKeyDown', function(e) {
- dojo.publish("/dojox/mobile/app/goback");
- });
- hasNativeBack = true;
- }else if(dojo.global.Mojo){
-
- }
- if(hasNativeBack){
- dojo.addClass(dojo.body(), "mblNativeBack");
- }
- };
- dojo.mixin(dojox.mobile.app, {
- init: function(node){
-
-
- rootNode = node || dojo.body();
- dojox.mobile.app.STAGE_CONTROLLER_ACTIVE = true;
- dojo.subscribe("/dojox/mobile/app/goback", function(){
- stageController.popScene();
- });
- dojo.subscribe("/dojox/mobile/app/alert", function(params){
- dojox.mobile.app.getActiveSceneController().showAlertDialog(params);
- });
- dojo.subscribe("/dojox/mobile/app/pushScene", function(sceneName, params){
- stageController.pushScene(sceneName, params || {});
- });
-
- dojo.xhrGet({
- url: "view-resources.json",
- load: function(data){
- var resources = [];
- if(data){
-
- sceneResources = data = dojo.fromJson(data);
-
-
-
- for(var i = 0; i < data.length; i++){
- if(!data[i].scene){
- resources.push(data[i]);
- }
- }
- }
- if(resources.length > 0){
- loadResources(resources, pushFirstScene);
- }else{
- pushFirstScene();
- }
- },
- error: pushFirstScene
- });
- initBackButton();
- },
- getActiveSceneController: function(){
-
-
- return stageController.getActiveSceneController();
- },
- getStageController: function(){
-
-
- return stageController;
- },
- loadResources: function(resources, callback){
- loadResources(resources, callback);
- },
- loadResourcesForScene: function(sceneName, callback){
- var resources = [];
-
-
-
- for(var i = 0; i < sceneResources.length; i++){
- if(sceneResources[i].scene == sceneName){
- resources.push(sceneResources[i]);
- }
- }
- if(resources.length > 0){
- loadResources(resources, callback);
- }else{
- callback();
- }
- },
- resolveTemplate: function(sceneName){
-
-
-
-
-
-
- return "app/views/" + sceneName + "/" + sceneName + "-scene.html";
- },
- resolveAssistant: function(sceneName){
-
-
-
-
-
-
- return "app/assistants/" + sceneName + "-assistant.js";
- }
- });
- })();
- }
- if(!dojo._hasResource["dojox.mobileApp"]){
- dojo._hasResource["dojox.mobileApp"] = true;
- dojo.provide("dojox.mobileApp");
- }
|