root / trunk / web / dojo / dojox / mobile / _base.js @ 13
History | View | Annotate | Download (28.4 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.mobile._base"]){ |
||
9 | dojo._hasResource["dojox.mobile._base"]=true; |
||
10 | dojo.provide("dojox.mobile._base");
|
||
11 | dojo.require("dijit._Widget");
|
||
12 | dojo.declare("dojox.mobile.View",dijit._Widget,{selected:false,keepScrollPos:true,_started:false,constructor:function(_1,_2){ |
||
13 | if(_2){
|
||
14 | dojo.byId(_2).style.visibility="hidden";
|
||
15 | } |
||
16 | },buildRendering:function(){ |
||
17 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("DIV"); |
||
18 | this.domNode.className="mblView"; |
||
19 | this.connect(this.domNode,"webkitAnimationEnd","onAnimationEnd"); |
||
20 | this.connect(this.domNode,"webkitAnimationStart","onAnimationStart"); |
||
21 | var id=location.href.match(/#(\w+)([^\w=]|$)/)?RegExp.$1:null; |
||
22 | this._visible=this.selected&&!id||this.id==id; |
||
23 | if(this.selected){ |
||
24 | dojox.mobile._defaultView=this;
|
||
25 | } |
||
26 | },startup:function(){ |
||
27 | if(this._started){ |
||
28 | return;
|
||
29 | } |
||
30 | var _3=this; |
||
31 | setTimeout(function(){
|
||
32 | if(!_3._visible){
|
||
33 | _3.domNode.style.display="none";
|
||
34 | }else{
|
||
35 | dojox.mobile._currentView=_3; |
||
36 | _3.onStartView(); |
||
37 | } |
||
38 | _3.domNode.style.visibility="visible";
|
||
39 | },dojo.isIE?100:0); |
||
40 | this._started=true; |
||
41 | },onStartView:function(){ |
||
42 | },onBeforeTransitionIn:function(_4,_5,_6,_7,_8){ |
||
43 | },onAfterTransitionIn:function(_9,_a,_b,_c,_d){ |
||
44 | },onBeforeTransitionOut:function(_e,_f,_10,_11,_12){ |
||
45 | },onAfterTransitionOut:function(_13,dir,_14,_15,_16){ |
||
46 | },_saveState:function(_17,dir,_18,_19,_1a){ |
||
47 | this._context=_19;
|
||
48 | this._method=_1a;
|
||
49 | if(_18=="none"||!dojo.isWebKit){ |
||
50 | _18=null;
|
||
51 | } |
||
52 | this._moveTo=_17;
|
||
53 | this._dir=dir;
|
||
54 | this._transition=_18;
|
||
55 | this._arguments=[];
|
||
56 | var i;
|
||
57 | for(i=0;i<arguments.length;i++){ |
||
58 | this._arguments.push(arguments[i]); |
||
59 | } |
||
60 | this._args=[];
|
||
61 | if(_19||_1a){
|
||
62 | for(i=5;i<arguments.length;i++){ |
||
63 | this._args.push(arguments[i]); |
||
64 | } |
||
65 | } |
||
66 | },performTransition:function(_1b,dir,_1c,_1d,_1e){ |
||
67 | if(dojo.hash){
|
||
68 | if(typeof (_1b)=="string"&&_1b.charAt(0)=="#"&&!dojox.mobile._params){ |
||
69 | dojox.mobile._params=[]; |
||
70 | for(var i=0;i<arguments.length;i++){ |
||
71 | dojox.mobile._params.push(arguments[i]);
|
||
72 | } |
||
73 | dojo.hash(_1b); |
||
74 | return;
|
||
75 | } |
||
76 | } |
||
77 | this._saveState.apply(this,arguments); |
||
78 | var _1f;
|
||
79 | if(_1b){
|
||
80 | if(typeof (_1b)=="string"){ |
||
81 | _1b.match(/(\w+)/);
|
||
82 | _1f=RegExp.$1;
|
||
83 | }else{
|
||
84 | _1f=_1b; |
||
85 | } |
||
86 | }else{
|
||
87 | if(!this._dummyNode){ |
||
88 | this._dummyNode=dojo.doc.createElement("DIV"); |
||
89 | dojo.body().appendChild(this._dummyNode);
|
||
90 | } |
||
91 | _1f=this._dummyNode;
|
||
92 | } |
||
93 | var _20=this.domNode; |
||
94 | _1f=this.toNode=dojo.byId(_1f);
|
||
95 | if(!_1f){
|
||
96 | alert("dojox.mobile.View#performTransition: destination view not found: "+_1f);
|
||
97 | } |
||
98 | _1f.style.visibility="hidden";
|
||
99 | _1f.style.display="";
|
||
100 | this.onBeforeTransitionOut.apply(this,arguments); |
||
101 | var _21=dijit.byNode(_1f);
|
||
102 | if(_21&&_21.onBeforeTransitionIn){
|
||
103 | if(this.keepScrollPos&&!dijit.getEnclosingWidget(this.domNode.parentNode)){ |
||
104 | var _22=dojo.body().scrollTop||dojo.doc.documentElement.scrollTop||window.pageYOffset||0; |
||
105 | if(dir==1){ |
||
106 | _1f.style.top="0px";
|
||
107 | if(_22>1){ |
||
108 | _20.style.top=-_22+"px";
|
||
109 | if(dojo.config["mblHideAddressBar"]!==false){ |
||
110 | setTimeout(function(){
|
||
111 | window.scrollTo(0,1); |
||
112 | },0);
|
||
113 | } |
||
114 | } |
||
115 | }else{
|
||
116 | if(_22>1||_1f.offsetTop!==0){ |
||
117 | var _23=-_1f.offsetTop;
|
||
118 | _1f.style.top="0px";
|
||
119 | _20.style.top=_23-_22+"px";
|
||
120 | if(dojo.config["mblHideAddressBar"]!==false&&_23>0){ |
||
121 | setTimeout(function(){
|
||
122 | window.scrollTo(0,_23+1); |
||
123 | },0);
|
||
124 | } |
||
125 | } |
||
126 | } |
||
127 | }else{
|
||
128 | _1f.style.top="0px";
|
||
129 | } |
||
130 | _21.onBeforeTransitionIn.apply(this,arguments); |
||
131 | } |
||
132 | _1f.style.display="none";
|
||
133 | _1f.style.visibility="visible";
|
||
134 | this._doTransition(_20,_1f,_1c,dir);
|
||
135 | },_doTransition:function(_24,_25,_26,dir){ |
||
136 | var rev=(dir==-1)?" reverse":""; |
||
137 | _25.style.display="";
|
||
138 | if(_26){
|
||
139 | dojo.addClass(_24,_26+" out"+rev);
|
||
140 | dojo.addClass(_25,_26+" in"+rev);
|
||
141 | }else{
|
||
142 | this.domNode.style.display="none"; |
||
143 | this.invokeCallback();
|
||
144 | } |
||
145 | },onAnimationStart:function(e){ |
||
146 | },onAnimationEnd:function(e){ |
||
147 | var _27=false; |
||
148 | if(dojo.hasClass(this.domNode,"out")){ |
||
149 | _27=true;
|
||
150 | this.domNode.style.display="none"; |
||
151 | dojo.forEach([this._transition,"in","out","reverse"],function(s){ |
||
152 | dojo.removeClass(this.domNode,s);
|
||
153 | },this);
|
||
154 | } |
||
155 | if(e.animationName.indexOf("shrink")===0){ |
||
156 | var li=e.target;
|
||
157 | li.style.display="none";
|
||
158 | dojo.removeClass(li,"mblCloseContent");
|
||
159 | } |
||
160 | if(_27){
|
||
161 | this.invokeCallback();
|
||
162 | } |
||
163 | this.domNode&&(this.domNode.className="mblView"); |
||
164 | },invokeCallback:function(){ |
||
165 | this.onAfterTransitionOut.apply(this,this._arguments); |
||
166 | var _28=dijit.byNode(this.toNode); |
||
167 | if(_28&&_28.onAfterTransitionIn){
|
||
168 | _28.onAfterTransitionIn.apply(this,this._arguments); |
||
169 | } |
||
170 | if(dojo.hash){
|
||
171 | dojox.mobile._currentView=_28; |
||
172 | } |
||
173 | var c=this._context,m=this._method; |
||
174 | if(!c&&!m){
|
||
175 | return;
|
||
176 | } |
||
177 | if(!m){
|
||
178 | m=c; |
||
179 | c=null;
|
||
180 | } |
||
181 | c=c||dojo.global; |
||
182 | if(typeof (m)=="string"){ |
||
183 | c[m].apply(c,this._args);
|
||
184 | }else{
|
||
185 | m.apply(c,this._args);
|
||
186 | } |
||
187 | },addChild:function(_29){ |
||
188 | this.containerNode.appendChild(_29.domNode);
|
||
189 | }}); |
||
190 | dojo.declare("dojox.mobile.Heading",dijit._Widget,{back:"",href:"",moveTo:"",transition:"slide",label:"",buildRendering:function(){ |
||
191 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("H1"); |
||
192 | this.domNode.className="mblHeading"; |
||
193 | this._view=this.domNode.parentNode&&dijit.byNode(this.domNode.parentNode); |
||
194 | if(this.label){ |
||
195 | this.domNode.innerHTML=this.label; |
||
196 | }else{
|
||
197 | this.label=this.domNode.innerHTML; |
||
198 | } |
||
199 | if(this.back){ |
||
200 | var _2a=dojo.doc.createElement("DIV"); |
||
201 | _2a.className="mblArrowButtonHead";
|
||
202 | var _2b=this._body=dojo.doc.createElement("DIV"); |
||
203 | _2b.className="mblArrowButtonBody mblArrowButtonText";
|
||
204 | _2b.innerHTML=this.back;
|
||
205 | this.connect(_2b,"onclick","onClick"); |
||
206 | var _2c=dojo.doc.createElement("DIV"); |
||
207 | _2c.className="mblArrowButtonNeck";
|
||
208 | this.domNode.appendChild(_2a);
|
||
209 | this.domNode.appendChild(_2b);
|
||
210 | this.domNode.appendChild(_2c);
|
||
211 | this.setLabel(this.label); |
||
212 | } |
||
213 | },onClick:function(e){ |
||
214 | var h1=this.domNode; |
||
215 | dojo.addClass(h1,"mblArrowButtonSelected");
|
||
216 | setTimeout(function(){
|
||
217 | dojo.removeClass(h1,"mblArrowButtonSelected");
|
||
218 | },1000);
|
||
219 | this.goTo(this.moveTo,this.href); |
||
220 | },setLabel:function(_2d){ |
||
221 | if(_2d!=this.label){ |
||
222 | this.label=_2d;
|
||
223 | this.domNode.firstChild.nodeValue=_2d;
|
||
224 | } |
||
225 | var s=this.domNode.style; |
||
226 | if(this.label.length>12){ |
||
227 | var h=this.domNode.cloneNode(true); |
||
228 | h.style.visibility="hidden";
|
||
229 | dojo.body().appendChild(h); |
||
230 | var b=h.childNodes[2]; |
||
231 | s.paddingLeft=b.offsetWidth+30+"px"; |
||
232 | s.textAlign="left";
|
||
233 | dojo.body().removeChild(h); |
||
234 | h=null;
|
||
235 | }else{
|
||
236 | s.paddingLeft="";
|
||
237 | s.textAlign="";
|
||
238 | } |
||
239 | },goTo:function(_2e,_2f){ |
||
240 | if(!this._view){ |
||
241 | this._view=dijit.byNode(this.domNode.parentNode); |
||
242 | } |
||
243 | if(_2f){
|
||
244 | this._view.performTransition(null,-1,this.transition,this,function(){ |
||
245 | location.href=_2f; |
||
246 | }); |
||
247 | }else{
|
||
248 | if(dojox.mobile.app){
|
||
249 | dojo.publish("/dojox/mobile/app/goback");
|
||
250 | }else{
|
||
251 | this._view.performTransition(_2e,-1,this.transition); |
||
252 | } |
||
253 | } |
||
254 | }}); |
||
255 | dojo.declare("dojox.mobile.RoundRect",dijit._Widget,{shadow:false,buildRendering:function(){ |
||
256 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("DIV"); |
||
257 | this.domNode.className=this.shadow?"mblRoundRect mblShadow":"mblRoundRect"; |
||
258 | }}); |
||
259 | dojo.declare("dojox.mobile.RoundRectCategory",dijit._Widget,{label:"",buildRendering:function(){ |
||
260 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("H2"); |
||
261 | this.domNode.className="mblRoundRectCategory"; |
||
262 | if(this.label){ |
||
263 | this.domNode.innerHTML=this.label; |
||
264 | }else{
|
||
265 | this.label=this.domNode.innerHTML; |
||
266 | } |
||
267 | }}); |
||
268 | dojo.declare("dojox.mobile.EdgeToEdgeCategory",dojox.mobile.RoundRectCategory,{buildRendering:function(){ |
||
269 | this.inherited(arguments); |
||
270 | this.domNode.className="mblEdgeToEdgeCategory"; |
||
271 | }}); |
||
272 | dojo.declare("dojox.mobile.RoundRectList",dijit._Widget,{transition:"slide",iconBase:"",iconPos:"",buildRendering:function(){ |
||
273 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("UL"); |
||
274 | this.domNode.className="mblRoundRectList"; |
||
275 | },addChild:function(_30){ |
||
276 | this.containerNode.appendChild(_30.domNode);
|
||
277 | _30.inheritParams(); |
||
278 | _30.setIcon(); |
||
279 | }}); |
||
280 | dojo.declare("dojox.mobile.EdgeToEdgeList",dojox.mobile.RoundRectList,{buildRendering:function(){ |
||
281 | this.inherited(arguments); |
||
282 | this.domNode.className="mblEdgeToEdgeList"; |
||
283 | }}); |
||
284 | dojo.declare("dojox.mobile.AbstractItem",dijit._Widget,{icon:"",iconPos:"",href:"",moveTo:"",clickable:false,url:"",transition:"",callback:null,sync:true,label:"",inheritParams:function(){ |
||
285 | var _31=this.getParentWidget(); |
||
286 | if(_31){
|
||
287 | if(!this.transition){ |
||
288 | this.transition=_31.transition;
|
||
289 | } |
||
290 | if(!this.icon){ |
||
291 | this.icon=_31.iconBase;
|
||
292 | } |
||
293 | if(!this.iconPos){ |
||
294 | this.iconPos=_31.iconPos;
|
||
295 | } |
||
296 | } |
||
297 | },transitionTo:function(_32,_33,url){ |
||
298 | var n=this.domNode.parentNode; |
||
299 | var w;
|
||
300 | while(true){ |
||
301 | w=dijit.getEnclosingWidget(n); |
||
302 | if(!w){
|
||
303 | return;
|
||
304 | } |
||
305 | if(w.performTransition){
|
||
306 | break;
|
||
307 | } |
||
308 | n=w.domNode.parentNode; |
||
309 | } |
||
310 | if(_33){
|
||
311 | w.performTransition(null,1,this.transition,this,function(){ |
||
312 | location.href=_33; |
||
313 | }); |
||
314 | return;
|
||
315 | } |
||
316 | if(url){
|
||
317 | var id;
|
||
318 | if(dojox.mobile._viewMap&&dojox.mobile._viewMap[url]){
|
||
319 | id=dojox.mobile._viewMap[url]; |
||
320 | }else{
|
||
321 | var _34=this._text; |
||
322 | if(!_34){
|
||
323 | if(this.sync){ |
||
324 | _34=dojo.trim(dojo._getText(url)); |
||
325 | }else{
|
||
326 | var _35=dojox.mobile.ProgressIndicator.getInstance();
|
||
327 | dojo.body().appendChild(_35.domNode); |
||
328 | _35.start(); |
||
329 | var xhr=dojo.xhrGet({url:url,handleAs:"text"}); |
||
330 | xhr.addCallback(dojo.hitch(this,function(_36,_37){ |
||
331 | _35.stop(); |
||
332 | if(_36){
|
||
333 | this._text=_36;
|
||
334 | this.transitionTo(_32,_33,url);
|
||
335 | } |
||
336 | })); |
||
337 | xhr.addErrback(function(_38){
|
||
338 | _35.stop(); |
||
339 | alert("Failed to load "+url+"\n"+(_38.description||_38)); |
||
340 | }); |
||
341 | return;
|
||
342 | } |
||
343 | } |
||
344 | this._text=null; |
||
345 | id=this._parse(_34);
|
||
346 | if(!dojox.mobile._viewMap){
|
||
347 | dojox.mobile._viewMap=[]; |
||
348 | } |
||
349 | dojox.mobile._viewMap[url]=id; |
||
350 | } |
||
351 | _32=id; |
||
352 | } |
||
353 | w.performTransition(_32,1,this.transition,this.callback&&this,this.callback); |
||
354 | },_parse:function(_39){ |
||
355 | var _3a=dojo.create("DIV"); |
||
356 | var _3b;
|
||
357 | if(_39.charAt(0)=="<"){ |
||
358 | _3a.innerHTML=_39; |
||
359 | _3b=_3a.firstChild; |
||
360 | if(!_3b&&_3b.nodeType!=1){ |
||
361 | alert("dojox.mobile.AbstractItem#transitionTo: invalid view content");
|
||
362 | return;
|
||
363 | } |
||
364 | _3b.setAttribute("_started","true"); |
||
365 | _3b.style.visibility="hidden";
|
||
366 | dojo.body().appendChild(_3a); |
||
367 | (dojox.mobile.parser||dojo.parser).parse(_3a); |
||
368 | }else{
|
||
369 | if(_39.charAt(0)=="{"){ |
||
370 | dojo.body().appendChild(_3a); |
||
371 | this._ws=[];
|
||
372 | _3b=this._instantiate(eval("("+_39+")"),_3a); |
||
373 | for(var i=0;i<this._ws.length;i++){ |
||
374 | var w=this._ws[i]; |
||
375 | w.startup&&!w._started&&(!w.getParent||!w.getParent())&&w.startup(); |
||
376 | } |
||
377 | this._ws=null; |
||
378 | } |
||
379 | } |
||
380 | _3b.style.display="none";
|
||
381 | _3b.style.visibility="visible";
|
||
382 | var id=_3b.id;
|
||
383 | return dojo.hash?"#"+id:id; |
||
384 | },_instantiate:function(obj,_3c,_3d){ |
||
385 | var _3e;
|
||
386 | for(var key in obj){ |
||
387 | if(key.charAt(0)=="@"){ |
||
388 | continue;
|
||
389 | } |
||
390 | var cls=dojo.getObject(key);
|
||
391 | if(!cls){
|
||
392 | continue;
|
||
393 | } |
||
394 | var _3f={};
|
||
395 | var _40=cls.prototype;
|
||
396 | var _41=dojo.isArray(obj[key])?obj[key]:[obj[key]];
|
||
397 | for(var i=0;i<_41.length;i++){ |
||
398 | for(var _42 in _41[i]){ |
||
399 | if(_42.charAt(0)=="@"){ |
||
400 | var val=_41[i][_42];
|
||
401 | _42=_42.substring(1);
|
||
402 | if(typeof _40[_42]=="string"){ |
||
403 | _3f[_42]=val; |
||
404 | }else{
|
||
405 | if(typeof _40[_42]=="number"){ |
||
406 | _3f[_42]=val-0;
|
||
407 | }else{
|
||
408 | if(typeof _40[_42]=="boolean"){ |
||
409 | _3f[_42]=(val!="false");
|
||
410 | }else{
|
||
411 | if(typeof _40[_42]=="object"){ |
||
412 | _3f[_42]=eval("("+val+")"); |
||
413 | } |
||
414 | } |
||
415 | } |
||
416 | } |
||
417 | } |
||
418 | } |
||
419 | _3e=new cls(_3f,_3c);
|
||
420 | if(!_3c){
|
||
421 | this._ws.push(_3e);
|
||
422 | } |
||
423 | if(_3d&&_3d.addChild){
|
||
424 | _3d.addChild(_3e); |
||
425 | } |
||
426 | this._instantiate(_41[i],null,_3e); |
||
427 | } |
||
428 | } |
||
429 | return _3e&&_3e.domNode;
|
||
430 | },getParentWidget:function(){ |
||
431 | var ref=this.srcNodeRef||this.domNode; |
||
432 | return ref&&ref.parentNode?dijit.getEnclosingWidget(ref.parentNode):null; |
||
433 | }}); |
||
434 | dojo.declare("dojox.mobile.ListItem",dojox.mobile.AbstractItem,{rightText:"",btnClass:"",anchorLabel:false,buildRendering:function(){ |
||
435 | this.inheritParams();
|
||
436 | var a=this.anchorNode=dojo.create("A"); |
||
437 | a.className="mblListItemAnchor";
|
||
438 | var box=dojo.create("DIV"); |
||
439 | box.className="mblListItemTextBox";
|
||
440 | if(this.anchorLabel){ |
||
441 | box.style.cursor="pointer";
|
||
442 | } |
||
443 | var r=this.srcNodeRef; |
||
444 | if(r){
|
||
445 | for(var i=0,len=r.childNodes.length;i<len;i++){ |
||
446 | box.appendChild(r.removeChild(r.firstChild)); |
||
447 | } |
||
448 | } |
||
449 | if(this.label){ |
||
450 | box.appendChild(dojo.doc.createTextNode(this.label));
|
||
451 | } |
||
452 | a.appendChild(box); |
||
453 | if(this.rightText){ |
||
454 | var txt=dojo.create("DIV"); |
||
455 | txt.className="mblRightText";
|
||
456 | txt.innerHTML=this.rightText;
|
||
457 | a.appendChild(txt); |
||
458 | } |
||
459 | if(this.moveTo||this.href||this.url||this.clickable){ |
||
460 | var _43=dojo.create("DIV"); |
||
461 | _43.className="mblArrow";
|
||
462 | a.appendChild(_43); |
||
463 | this.connect(a,"onclick","onClick"); |
||
464 | }else{
|
||
465 | if(this.btnClass){ |
||
466 | var div=this.btnNode=dojo.create("DIV"); |
||
467 | div.className=this.btnClass+" mblRightButton"; |
||
468 | div.appendChild(dojo.create("DIV"));
|
||
469 | div.appendChild(dojo.create("P"));
|
||
470 | var _44=dojo.create("DIV"); |
||
471 | _44.className="mblRightButtonContainer";
|
||
472 | _44.appendChild(div); |
||
473 | a.appendChild(_44); |
||
474 | dojo.addClass(a,"mblListItemAnchorHasRightButton");
|
||
475 | setTimeout(function(){
|
||
476 | _44.style.width=div.offsetWidth+"px";
|
||
477 | _44.style.height=div.offsetHeight+"px";
|
||
478 | if(dojo.isIE){
|
||
479 | a.parentNode.style.height=a.parentNode.offsetHeight+"px";
|
||
480 | } |
||
481 | }); |
||
482 | } |
||
483 | } |
||
484 | if(this.anchorLabel){ |
||
485 | box.style.display="inline";
|
||
486 | } |
||
487 | var li=this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("LI"); |
||
488 | li.className="mblListItem";
|
||
489 | li.appendChild(a); |
||
490 | this.setIcon();
|
||
491 | },setIcon:function(){ |
||
492 | if(this.iconNode){ |
||
493 | return;
|
||
494 | } |
||
495 | var a=this.anchorNode; |
||
496 | if(this.icon&&this.icon!="none"){ |
||
497 | var img=this.iconNode=dojo.create("IMG"); |
||
498 | img.className="mblListItemIcon";
|
||
499 | img.src=this.icon;
|
||
500 | this.domNode.insertBefore(img,a);
|
||
501 | dojox.mobile.setupIcon(this.iconNode,this.iconPos); |
||
502 | dojo.removeClass(a,"mblListItemAnchorNoIcon");
|
||
503 | }else{
|
||
504 | dojo.addClass(a,"mblListItemAnchorNoIcon");
|
||
505 | } |
||
506 | },onClick:function(e){ |
||
507 | if(this.anchorLabel){ |
||
508 | for(var p=e.target;p.tagName!="LI";p=p.parentNode){ |
||
509 | if(p.className=="mblListItemTextBox"){ |
||
510 | dojo.addClass(p,"mblListItemTextBoxSelected");
|
||
511 | setTimeout(function(){
|
||
512 | dojo.removeClass(p,"mblListItemTextBoxSelected");
|
||
513 | },1000);
|
||
514 | this.onAnchorLabelClicked(e);
|
||
515 | return;
|
||
516 | } |
||
517 | } |
||
518 | } |
||
519 | var a=e.currentTarget;
|
||
520 | var li=a.parentNode;
|
||
521 | dojo.addClass(li,"mblItemSelected");
|
||
522 | setTimeout(function(){
|
||
523 | dojo.removeClass(li,"mblItemSelected");
|
||
524 | },1000);
|
||
525 | this.transitionTo(this.moveTo,this.href,this.url); |
||
526 | },onAnchorLabelClicked:function(e){ |
||
527 | }}); |
||
528 | dojo.declare("dojox.mobile.Switch",dijit._Widget,{value:"on",leftLabel:"ON",rightLabel:"OFF",_width:53,buildRendering:function(){ |
||
529 | this.domNode=this.srcNodeRef||dojo.doc.createElement("DIV"); |
||
530 | this.domNode.className="mblSwitch"; |
||
531 | 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>"; |
||
532 | var n=this.inner=this.domNode.firstChild; |
||
533 | this.left=n.childNodes[0]; |
||
534 | this.right=n.childNodes[1]; |
||
535 | this.knob=n.childNodes[2]; |
||
536 | dojo.addClass(this.domNode,(this.value=="on")?"mblSwitchOn":"mblSwitchOff"); |
||
537 | this[this.value=="off"?"left":"right"].style.display="none"; |
||
538 | },postCreate:function(){ |
||
539 | this.connect(this.knob,"onclick","onClick"); |
||
540 | this.connect(this.knob,"touchstart","onTouchStart"); |
||
541 | this.connect(this.knob,"mousedown","onTouchStart"); |
||
542 | },_changeState:function(_45){ |
||
543 | this.inner.style.left=""; |
||
544 | dojo.addClass(this.domNode,"mblSwitchAnimation"); |
||
545 | dojo.removeClass(this.domNode,(_45=="on")?"mblSwitchOff":"mblSwitchOn"); |
||
546 | dojo.addClass(this.domNode,(_45=="on")?"mblSwitchOn":"mblSwitchOff"); |
||
547 | var _46=this; |
||
548 | setTimeout(function(){
|
||
549 | _46[_45=="off"?"left":"right"].style.display="none"; |
||
550 | dojo.removeClass(_46.domNode,"mblSwitchAnimation");
|
||
551 | },300);
|
||
552 | },onClick:function(e){ |
||
553 | if(this._moved){ |
||
554 | return;
|
||
555 | } |
||
556 | this.value=(this.value=="on")?"off":"on"; |
||
557 | this._changeState(this.value); |
||
558 | this.onStateChanged(this.value); |
||
559 | },onTouchStart:function(e){ |
||
560 | this._moved=false; |
||
561 | this.innerStartX=this.inner.offsetLeft; |
||
562 | if(e.targetTouches){
|
||
563 | this.touchStartX=e.targetTouches[0].clientX; |
||
564 | this._conn1=dojo.connect(this.inner,"touchmove",this,"onTouchMove"); |
||
565 | this._conn2=dojo.connect(this.inner,"touchend",this,"onTouchEnd"); |
||
566 | } |
||
567 | this.left.style.display="block"; |
||
568 | this.right.style.display="block"; |
||
569 | return false; |
||
570 | },onTouchMove:function(e){ |
||
571 | e.preventDefault(); |
||
572 | var dx;
|
||
573 | if(e.targetTouches){
|
||
574 | if(e.targetTouches.length!=1){ |
||
575 | return false; |
||
576 | } |
||
577 | dx=e.targetTouches[0].clientX-this.touchStartX; |
||
578 | }else{
|
||
579 | dx=e.clientX-this.touchStartX;
|
||
580 | } |
||
581 | var pos=this.innerStartX+dx; |
||
582 | var d=10; |
||
583 | if(pos<=-(this._width-d)){ |
||
584 | pos=-this._width;
|
||
585 | } |
||
586 | if(pos>=-d){
|
||
587 | pos=0;
|
||
588 | } |
||
589 | this.inner.style.left=pos+"px"; |
||
590 | this._moved=true; |
||
591 | return true; |
||
592 | },onTouchEnd:function(e){ |
||
593 | dojo.disconnect(this._conn1);
|
||
594 | dojo.disconnect(this._conn2);
|
||
595 | if(this.innerStartX==this.inner.offsetLeft){ |
||
596 | return;
|
||
597 | } |
||
598 | var _47=(this.inner.offsetLeft<-(this._width/2))?"off":"on"; |
||
599 | this._changeState(_47);
|
||
600 | if(_47!=this.value){ |
||
601 | this.value=_47;
|
||
602 | this.onStateChanged(this.value); |
||
603 | } |
||
604 | },onStateChanged:function(_48){ |
||
605 | }}); |
||
606 | dojo.declare("dojox.mobile.IconContainer",dijit._Widget,{defaultIcon:"",transition:"below",pressedIconOpacity:0.4,iconBase:"",iconPos:"",back:"Home",label:"My Application",single:false,buildRendering:function(){ |
||
607 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("UL"); |
||
608 | this.domNode.className="mblIconContainer"; |
||
609 | var t=this._terminator=dojo.create("LI"); |
||
610 | t.className="mblIconItemTerminator";
|
||
611 | t.innerHTML=" ";
|
||
612 | this.domNode.appendChild(t);
|
||
613 | },_setupSubNodes:function(ul){ |
||
614 | var len=this.domNode.childNodes.length-1; |
||
615 | for(i=0;i<len;i++){ |
||
616 | child=this.domNode.childNodes[i];
|
||
617 | if(child.nodeType!=1){ |
||
618 | continue;
|
||
619 | } |
||
620 | w=dijit.byNode(child); |
||
621 | if(this.single){ |
||
622 | w.subNode.firstChild.style.display="none";
|
||
623 | } |
||
624 | ul.appendChild(w.subNode); |
||
625 | } |
||
626 | },startup:function(){ |
||
627 | var ul,i,len,_49,w;
|
||
628 | if(this.transition=="below"){ |
||
629 | this._setupSubNodes(this.domNode); |
||
630 | }else{
|
||
631 | var _4a=new dojox.mobile.View({id:this.id+"_mblApplView"}); |
||
632 | var _4b=this; |
||
633 | _4a.onAfterTransitionIn=function(_4c,dir,_4d,_4e,_4f){ |
||
634 | _4b._opening._open_1(); |
||
635 | }; |
||
636 | _4a.domNode.style.visibility="hidden";
|
||
637 | var _50=_4a._heading=new dojox.mobile.Heading({back:this.back,label:this.label,moveTo:this.domNode.parentNode.id,transition:this.transition}); |
||
638 | _4a.addChild(_50); |
||
639 | ul=dojo.doc.createElement("UL");
|
||
640 | ul.className="mblIconContainer";
|
||
641 | ul.style.marginTop="0px";
|
||
642 | this._setupSubNodes(ul);
|
||
643 | _4a.domNode.appendChild(ul); |
||
644 | dojo.doc.body.appendChild(_4a.domNode); |
||
645 | } |
||
646 | },closeAll:function(){ |
||
647 | var len=this.domNode.childNodes.length; |
||
648 | for(var i=0;i<len;i++){ |
||
649 | child=this.domNode.childNodes[i];
|
||
650 | if(child.nodeType!=1){ |
||
651 | continue;
|
||
652 | } |
||
653 | if(child==this._terminator){ |
||
654 | break;
|
||
655 | } |
||
656 | w=dijit.byNode(child); |
||
657 | w.containerNode.parentNode.style.display="none";
|
||
658 | w.setOpacity(w.iconNode,1);
|
||
659 | } |
||
660 | },addChild:function(_51){ |
||
661 | this.domNode.insertBefore(_51.domNode,this._terminator); |
||
662 | _51.transition=this.transition;
|
||
663 | if(this.transition=="below"){ |
||
664 | this.domNode.appendChild(_51.subNode);
|
||
665 | } |
||
666 | _51.inheritParams(); |
||
667 | _51.setIcon(); |
||
668 | }}); |
||
669 | dojo.declare("dojox.mobile.IconItem",dojox.mobile.AbstractItem,{lazy:false,requires:"",timeout:10,templateString:"<li class=\"mblIconItem\">"+"<div class=\"mblIconArea\" dojoAttachPoint=\"iconDivNode\">"+"<div><img src=\"${icon}\" dojoAttachPoint=\"iconNode\"></div>${label}"+"</div>"+"</li>",templateStringSub:"<li class=\"mblIconItemSub\" lazy=\"${lazy}\" style=\"display:none;\" dojoAttachPoint=\"contentNode\">"+"<h2 class=\"mblIconContentHeading\" dojoAttachPoint=\"closeNode\">"+"<div class=\"mblBlueMinusButton\" style=\"position:absolute;left:4px;top:2px;\" dojoAttachPoint=\"closeIconNode\"><div></div></div>${label}"+"</h2>"+"<div class=\"mblContent\" dojoAttachPoint=\"containerNode\"></div>"+"</li>",createTemplate:function(s){ |
||
670 | dojo.forEach(["lazy","icon","label"],function(v){ |
||
671 | while(s.indexOf("${"+v+"}")!=-1){ |
||
672 | s=s.replace("${"+v+"}",this[v]); |
||
673 | } |
||
674 | },this);
|
||
675 | var div=dojo.doc.createElement("DIV"); |
||
676 | div.innerHTML=s; |
||
677 | var _52=div.getElementsByTagName("*"); |
||
678 | var i,len,s1;
|
||
679 | len=_52.length; |
||
680 | for(i=0;i<len;i++){ |
||
681 | s1=_52[i].getAttribute("dojoAttachPoint");
|
||
682 | if(s1){
|
||
683 | this[s1]=_52[i];
|
||
684 | } |
||
685 | } |
||
686 | var _53=div.removeChild(div.firstChild);
|
||
687 | div=null;
|
||
688 | return _53;
|
||
689 | },buildRendering:function(){ |
||
690 | this.inheritParams();
|
||
691 | this.domNode=this.createTemplate(this.templateString); |
||
692 | this.subNode=this.createTemplate(this.templateStringSub); |
||
693 | this.subNode._parentNode=this.domNode; |
||
694 | if(this.srcNodeRef){ |
||
695 | for(var i=0,len=this.srcNodeRef.childNodes.length;i<len;i++){ |
||
696 | this.containerNode.appendChild(this.srcNodeRef.removeChild(this.srcNodeRef.firstChild)); |
||
697 | } |
||
698 | this.srcNodeRef.parentNode.replaceChild(this.domNode,this.srcNodeRef); |
||
699 | this.srcNodeRef=null; |
||
700 | } |
||
701 | this.setIcon();
|
||
702 | },setIcon:function(){ |
||
703 | this.iconNode.src=this.icon; |
||
704 | dojox.mobile.setupIcon(this.iconNode,this.iconPos); |
||
705 | },postCreate:function(){ |
||
706 | this.connect(this.iconNode,"onmousedown","onMouseDownIcon"); |
||
707 | this.connect(this.iconNode,"onclick","iconClicked"); |
||
708 | this.connect(this.closeIconNode,"onclick","closeIconClicked"); |
||
709 | this.connect(this.iconNode,"onerror","onError"); |
||
710 | },highlight:function(){ |
||
711 | dojo.addClass(this.iconDivNode,"mblVibrate"); |
||
712 | if(this.timeout>0){ |
||
713 | var _54=this; |
||
714 | setTimeout(function(){
|
||
715 | _54.unhighlight(); |
||
716 | },this.timeout*1000); |
||
717 | } |
||
718 | },unhighlight:function(){ |
||
719 | dojo.removeClass(this.iconDivNode,"mblVibrate"); |
||
720 | },setOpacity:function(_55,val){ |
||
721 | _55.style.opacity=val; |
||
722 | _55.style.mozOpacity=val; |
||
723 | _55.style.khtmlOpacity=val; |
||
724 | _55.style.webkitOpacity=val; |
||
725 | },instantiateWidget:function(e){ |
||
726 | var _56=this.containerNode.getElementsByTagName("*"); |
||
727 | var len=_56.length;
|
||
728 | var s;
|
||
729 | for(var i=0;i<len;i++){ |
||
730 | s=_56[i].getAttribute("dojoType");
|
||
731 | if(s){
|
||
732 | dojo["require"](s);
|
||
733 | } |
||
734 | } |
||
735 | if(len>0){ |
||
736 | (dojox.mobile.parser||dojo.parser).parse(this.containerNode);
|
||
737 | } |
||
738 | this.lazy=false; |
||
739 | },isOpen:function(e){ |
||
740 | return this.containerNode.style.display!="none"; |
||
741 | },onMouseDownIcon:function(e){ |
||
742 | this.setOpacity(this.iconNode,this.getParentWidget().pressedIconOpacity); |
||
743 | },iconClicked:function(e){ |
||
744 | if(e){
|
||
745 | setTimeout(dojo.hitch(this,function(d){ |
||
746 | this.iconClicked();
|
||
747 | }),0);
|
||
748 | return;
|
||
749 | } |
||
750 | if(this.moveTo||this.href||this.url){ |
||
751 | this.transitionTo(this.moveTo,this.href,this.url); |
||
752 | setTimeout(dojo.hitch(this,function(d){ |
||
753 | this.setOpacity(this.iconNode,1); |
||
754 | }),1500);
|
||
755 | }else{
|
||
756 | this.open();
|
||
757 | } |
||
758 | },closeIconClicked:function(e){ |
||
759 | if(e){
|
||
760 | setTimeout(dojo.hitch(this,function(d){ |
||
761 | this.closeIconClicked();
|
||
762 | }),0);
|
||
763 | return;
|
||
764 | } |
||
765 | this.close();
|
||
766 | },open:function(){ |
||
767 | var _57=this.getParentWidget(); |
||
768 | if(this.transition=="below"){ |
||
769 | if(_57.single){
|
||
770 | _57.closeAll(); |
||
771 | this.setOpacity(this.iconNode,this.getParentWidget().pressedIconOpacity); |
||
772 | } |
||
773 | this._open_1();
|
||
774 | }else{
|
||
775 | _57._opening=this;
|
||
776 | if(_57.single){
|
||
777 | _57.closeAll(); |
||
778 | var _58=dijit.byId(_57.id+"_mblApplView"); |
||
779 | _58._heading.setLabel(this.label);
|
||
780 | } |
||
781 | this.transitionTo(_57.id+"_mblApplView"); |
||
782 | } |
||
783 | },_open_1:function(){ |
||
784 | this.contentNode.style.display=""; |
||
785 | this.unhighlight();
|
||
786 | if(this.lazy){ |
||
787 | if(this.requires){ |
||
788 | dojo.forEach(this.requires.split(/,/),function(c){ |
||
789 | dojo["require"](c);
|
||
790 | }); |
||
791 | } |
||
792 | this.instantiateWidget();
|
||
793 | } |
||
794 | this.contentNode.scrollIntoView();
|
||
795 | this.onOpen();
|
||
796 | },close:function(){ |
||
797 | if(dojo.isWebKit){
|
||
798 | var t=this.domNode.parentNode.offsetWidth/8; |
||
799 | var y=this.iconNode.offsetLeft; |
||
800 | var pos=0; |
||
801 | for(var i=1;i<=3;i++){ |
||
802 | if(t*(2*i-1)<y&&y<=t*(2*(i+1)-1)){ |
||
803 | pos=i; |
||
804 | break;
|
||
805 | } |
||
806 | } |
||
807 | dojo.addClass(this.containerNode.parentNode,"mblCloseContent mblShrink"+pos); |
||
808 | }else{
|
||
809 | this.containerNode.parentNode.style.display="none"; |
||
810 | } |
||
811 | this.setOpacity(this.iconNode,1); |
||
812 | this.onClose();
|
||
813 | },onOpen:function(){ |
||
814 | },onClose:function(){ |
||
815 | },onError:function(){ |
||
816 | this.iconNode.src=this.getParentWidget().defaultIcon; |
||
817 | }}); |
||
818 | dojo.declare("dojox.mobile.Button",dijit._Widget,{btnClass:"mblBlueButton",duration:1000,label:null,buildRendering:function(){ |
||
819 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("BUTTON"); |
||
820 | this.domNode.className="mblButton "+this.btnClass; |
||
821 | if(this.label){ |
||
822 | this.domNode.innerHTML=this.label; |
||
823 | } |
||
824 | this.connect(this.domNode,"onclick","onClick"); |
||
825 | },onClick:function(e){ |
||
826 | var _59=this.domNode; |
||
827 | var c="mblButtonSelected "+this.btnClass+"Selected"; |
||
828 | dojo.addClass(_59,c); |
||
829 | setTimeout(function(){
|
||
830 | dojo.removeClass(_59,c); |
||
831 | },this.duration);
|
||
832 | }}); |
||
833 | dojo.declare("dojox.mobile.TabContainer",dijit._Widget,{iconBase:"",iconPos:"",buildRendering:function(){ |
||
834 | var _5a=this.domNode=this.srcNodeRef; |
||
835 | _5a.className="mblTabContainer";
|
||
836 | var _5b=this.tabHeaderNode=dojo.doc.createElement("DIV"); |
||
837 | var _5c=this.containerNode=dojo.doc.createElement("DIV"); |
||
838 | for(var i=0,len=_5a.childNodes.length;i<len;i++){ |
||
839 | _5c.appendChild(_5a.removeChild(_5a.firstChild)); |
||
840 | } |
||
841 | _5b.className="mblTabPanelHeader";
|
||
842 | _5b.align="center";
|
||
843 | _5a.appendChild(_5b); |
||
844 | _5c.className="mblTabPanelPane";
|
||
845 | _5a.appendChild(_5c); |
||
846 | },startup:function(){ |
||
847 | this.createTabButtons();
|
||
848 | this.inherited(arguments); |
||
849 | },createTabButtons:function(){ |
||
850 | var div=dojo.doc.createElement("DIV"); |
||
851 | div.align="center";
|
||
852 | var tbl=dojo.doc.createElement("TABLE"); |
||
853 | var _5d=tbl.insertRow(-1).insertCell(-1); |
||
854 | var _5e=this.containerNode.childNodes; |
||
855 | for(var i=0;i<_5e.length;i++){ |
||
856 | var _5f=_5e[i];
|
||
857 | if(_5f.nodeType!=1){ |
||
858 | continue;
|
||
859 | } |
||
860 | var _60=dijit.byNode(_5f);
|
||
861 | if(_60.selected||!this._selectedPane){ |
||
862 | this._selectedPane=_60;
|
||
863 | } |
||
864 | _5f.style.display="none";
|
||
865 | var tab=dojo.doc.createElement("DIV"); |
||
866 | tab.className="mblTabButton";
|
||
867 | if(_60.icon){
|
||
868 | var _61=dojo.create("DIV"); |
||
869 | var img=dojo.create("IMG"); |
||
870 | _61.className="mblTabButtonImgDiv";
|
||
871 | img.src=_60.icon; |
||
872 | dojox.mobile.setupIcon(img,_60.iconPos); |
||
873 | _61.appendChild(img); |
||
874 | tab.appendChild(_61); |
||
875 | } |
||
876 | tab.appendChild(dojo.doc.createTextNode(_60.label)); |
||
877 | tab.pane=_60; |
||
878 | _60.tab=tab; |
||
879 | this.connect(tab,"onclick","onTabClick"); |
||
880 | _5d.appendChild(tab); |
||
881 | } |
||
882 | div.appendChild(tbl); |
||
883 | this.tabHeaderNode.appendChild(div);
|
||
884 | this.selectTab(this._selectedPane.tab); |
||
885 | },selectTab:function(tab){ |
||
886 | this._selectedPane.domNode.style.display="none"; |
||
887 | dojo.removeClass(this._selectedPane.tab,"mblTabButtonSelected"); |
||
888 | this._selectedPane=tab.pane;
|
||
889 | this._selectedPane.domNode.style.display=""; |
||
890 | dojo.addClass(tab,"mblTabButtonSelected");
|
||
891 | },onTabClick:function(e){ |
||
892 | var tab=e.currentTarget;
|
||
893 | dojo.addClass(tab,"mblTabButtonHighlighted");
|
||
894 | setTimeout(function(){
|
||
895 | dojo.removeClass(tab,"mblTabButtonHighlighted");
|
||
896 | },200);
|
||
897 | this.selectTab(tab);
|
||
898 | }}); |
||
899 | dojo.declare("dojox.mobile.TabPane",dijit._Widget,{label:"",icon:"",iconPos:"",selected:false,inheritParams:function(){ |
||
900 | var _62=this.getParentWidget(); |
||
901 | if(_62){
|
||
902 | if(!this.icon){ |
||
903 | this.icon=_62.iconBase;
|
||
904 | } |
||
905 | if(!this.iconPos){ |
||
906 | this.iconPos=_62.iconPos;
|
||
907 | } |
||
908 | } |
||
909 | },buildRendering:function(){ |
||
910 | this.inheritParams();
|
||
911 | this.domNode=this.containerNode=this.srcNodeRef||dojo.doc.createElement("DIV"); |
||
912 | this.domNode.className="mblTabPane"; |
||
913 | },getParentWidget:function(){ |
||
914 | var ref=this.srcNodeRef||this.domNode; |
||
915 | return ref&&ref.parentNode?dijit.getEnclosingWidget(ref.parentNode):null; |
||
916 | }}); |
||
917 | dojo.declare("dojox.mobile.ProgressIndicator",null,{interval:100,colors:["#C0C0C0","#C0C0C0","#C0C0C0","#C0C0C0","#C0C0C0","#C0C0C0","#B8B9B8","#AEAFAE","#A4A5A4","#9A9A9A","#8E8E8E","#838383"],_bars:[],constructor:function(){ |
||
918 | this.domNode=dojo.create("DIV"); |
||
919 | this.domNode.className="mblProgContainer"; |
||
920 | for(var i=0;i<12;i++){ |
||
921 | var div=dojo.create("DIV"); |
||
922 | div.className="mblProg mblProg"+i;
|
||
923 | this.domNode.appendChild(div);
|
||
924 | this._bars.push(div);
|
||
925 | } |
||
926 | },start:function(){ |
||
927 | var _63=0; |
||
928 | var _64=this; |
||
929 | this.timer=setInterval(function(){ |
||
930 | _63--; |
||
931 | _63=_63<0?11:_63; |
||
932 | var c=_64.colors;
|
||
933 | for(var i=0;i<12;i++){ |
||
934 | var idx=(_63+i)%12; |
||
935 | _64._bars[i].style.backgroundColor=c[idx]; |
||
936 | } |
||
937 | },this.interval);
|
||
938 | },stop:function(){ |
||
939 | if(this.timer){ |
||
940 | clearInterval(this.timer);
|
||
941 | } |
||
942 | this.timer=null; |
||
943 | if(this.domNode.parentNode){ |
||
944 | this.domNode.parentNode.removeChild(this.domNode); |
||
945 | } |
||
946 | }}); |
||
947 | dojox.mobile.ProgressIndicator._instance=null;
|
||
948 | dojox.mobile.ProgressIndicator.getInstance=function(){ |
||
949 | if(!dojox.mobile.ProgressIndicator._instance){
|
||
950 | dojox.mobile.ProgressIndicator._instance=new dojox.mobile.ProgressIndicator();
|
||
951 | } |
||
952 | return dojox.mobile.ProgressIndicator._instance;
|
||
953 | }; |
||
954 | dojox.mobile.addClass=function(){ |
||
955 | var _65=document.getElementsByTagName("link"); |
||
956 | for(var i=0,len=_65.length;i<len;i++){ |
||
957 | if(_65[i].href.match(/dojox\/mobile\/themes\/(\w+)\//)){ |
||
958 | dojox.mobile.theme=RegExp.$1;
|
||
959 | dojo.addClass(dojo.body(),dojox.mobile.theme); |
||
960 | break;
|
||
961 | } |
||
962 | } |
||
963 | }; |
||
964 | dojox.mobile.setupIcon=function(_66,_67){ |
||
965 | if(_66&&_67){
|
||
966 | var arr=dojo.map(_67.split(/[ ,]/),function(_68){ |
||
967 | return _68-0; |
||
968 | }); |
||
969 | var t=arr[0]; |
||
970 | var r=arr[1]+arr[2]; |
||
971 | var b=arr[0]+arr[3]; |
||
972 | var l=arr[1]; |
||
973 | _66.style.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)"; |
||
974 | _66.style.top=-t+"px";
|
||
975 | _66.style.left=-l+"px";
|
||
976 | } |
||
977 | }; |
||
978 | dojo._loaders.unshift(function(){
|
||
979 | var _69=dojo.body().getElementsByTagName("*"); |
||
980 | var i,len,s;
|
||
981 | len=_69.length; |
||
982 | for(i=0;i<len;i++){ |
||
983 | s=_69[i].getAttribute("dojoType");
|
||
984 | if(s){
|
||
985 | if(_69[i].parentNode.getAttribute("lazy")=="true"){ |
||
986 | _69[i].setAttribute("__dojoType",s);
|
||
987 | _69[i].removeAttribute("dojoType");
|
||
988 | } |
||
989 | } |
||
990 | } |
||
991 | }); |
||
992 | dojo.addOnLoad(function(){
|
||
993 | dojox.mobile.addClass(); |
||
994 | if(dojo.config["mblApplyPageStyles"]!==false){ |
||
995 | dojo.addClass(dojo.doc.documentElement,"mobile");
|
||
996 | } |
||
997 | if(dojo.config["mblHideAddressBar"]!==false){ |
||
998 | var _6a=function(){ |
||
999 | setTimeout(function(){
|
||
1000 | scrollTo(0,1); |
||
1001 | },100);
|
||
1002 | }; |
||
1003 | _6a(); |
||
1004 | } |
||
1005 | var _6b=dojo.body().getElementsByTagName("*"); |
||
1006 | var i,len=_6b.length,s;
|
||
1007 | for(i=0;i<len;i++){ |
||
1008 | s=_6b[i].getAttribute("__dojoType");
|
||
1009 | if(s){
|
||
1010 | _6b[i].setAttribute("dojoType",s);
|
||
1011 | _6b[i].removeAttribute("__dojoType");
|
||
1012 | } |
||
1013 | } |
||
1014 | if(dojo.hash){
|
||
1015 | var _6c=function(_6d){ |
||
1016 | var arr;
|
||
1017 | arr=dijit.findWidgets(_6d); |
||
1018 | var _6e=arr;
|
||
1019 | for(var i=0;i<_6e.length;i++){ |
||
1020 | arr=arr.concat(_6c(_6e[i].containerNode)); |
||
1021 | } |
||
1022 | return arr;
|
||
1023 | }; |
||
1024 | dojo.subscribe("/dojo/hashchange",null,function(_6f){ |
||
1025 | var _70=dojox.mobile._currentView;
|
||
1026 | if(!_70){
|
||
1027 | return;
|
||
1028 | } |
||
1029 | var _71=dojox.mobile._params;
|
||
1030 | if(!_71){
|
||
1031 | var _72=_6f?_6f:dojox.mobile._defaultView.id;
|
||
1032 | var _73=_6c(_70.domNode);
|
||
1033 | var dir=1,_74="slide"; |
||
1034 | for(i=0;i<_73.length;i++){ |
||
1035 | var w=_73[i];
|
||
1036 | if("#"+_72==w.moveTo){ |
||
1037 | _74=w.transition; |
||
1038 | dir=(w instanceof dojox.mobile.Heading)?-1:1; |
||
1039 | break;
|
||
1040 | } |
||
1041 | } |
||
1042 | _71=[_72,dir,_74]; |
||
1043 | } |
||
1044 | _70.performTransition.apply(_70,_71); |
||
1045 | dojox.mobile._params=null;
|
||
1046 | }); |
||
1047 | } |
||
1048 | dojo.body().style.visibility="visible";
|
||
1049 | }); |
||
1050 | dijit.getEnclosingWidget=function(_75){ |
||
1051 | while(_75&&_75.tagName!=="BODY"){ |
||
1052 | if(_75.getAttribute&&_75.getAttribute("widgetId")){ |
||
1053 | return dijit.registry.byId(_75.getAttribute("widgetId")); |
||
1054 | } |
||
1055 | _75=_75._parentNode||_75.parentNode; |
||
1056 | } |
||
1057 | return null; |
||
1058 | }; |
||
1059 | } |