//>>built define("dojox/mobile/ViewController",["dojo/_base/kernel","dojo/_base/array","dojo/_base/connect","dojo/_base/declare","dojo/_base/lang","dojo/_base/window","dojo/dom","dojo/dom-class","dojo/dom-construct","dojo/on","dojo/ready","dijit/registry","./ProgressIndicator","./TransitionEvent"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,on,_a,_b,_c,_d){ var dm=_5.getObject("dojox.mobile",true); var _e=_4("dojox.mobile.ViewController",null,{constructor:function(){ this.viewMap={}; this.currentView=null; this.defaultView=null; _a(_5.hitch(this,function(){ on(_6.body(),"startTransition",_5.hitch(this,"onStartTransition")); })); },findCurrentView:function(_f,src){ if(_f){ var w=_b.byId(_f); if(w&&w.getShowingView){ return w.getShowingView(); } } if(dm.currentView){ return dm.currentView; } w=src; while(true){ w=w.getParent(); if(!w){ return null; } if(_8.contains(w.domNode,"mblView")){ break; } } return w; },onStartTransition:function(evt){ evt.preventDefault(); if(!evt.detail||(evt.detail&&!evt.detail.moveTo&&!evt.detail.href&&!evt.detail.url&&!evt.detail.scene)){ return; } var w=this.findCurrentView(evt.detail.moveTo,(evt.target&&evt.target.id)?_b.byId(evt.target.id):_b.byId(evt.target)); if(!w||(evt.detail&&evt.detail.moveTo&&w===_b.byId(evt.detail.moveTo))){ return; } if(evt.detail.href){ var t=_b.byId(evt.target.id).hrefTarget; if(t){ dm.openWindow(evt.detail.href,t); }else{ w.performTransition(null,evt.detail.transitionDir,evt.detail.transition,evt.target,function(){ location.href=evt.detail.href; }); } return; }else{ if(evt.detail.scene){ _3.publish("/dojox/mobile/app/pushScene",[evt.detail.scene]); return; } } var _10=evt.detail.moveTo; if(evt.detail.url){ var id; if(dm._viewMap&&dm._viewMap[evt.detail.url]){ id=dm._viewMap[evt.detail.url]; }else{ var _11=this._text; if(!_11){ if(_b.byId(evt.target.id).sync){ _1.xhrGet({url:evt.detail.url,sync:true,load:function(_12){ _11=_5.trim(_12); }}); }else{ var s="dojo/_base/xhr"; require([s],_5.hitch(this,function(xhr){ var _13=_c.getInstance(); _6.body().appendChild(_13.domNode); _13.start(); var obj=xhr.get({url:evt.detail.url,handleAs:"text"}); obj.addCallback(_5.hitch(this,function(_14,_15){ _13.stop(); if(_14){ this._text=_14; new _d(evt.target,{transition:evt.detail.transition,transitionDir:evt.detail.transitionDir,moveTo:_10,href:evt.detail.href,url:evt.detail.url,scene:evt.detail.scene},evt.detail).dispatch(); } })); obj.addErrback(function(_16){ _13.stop(); }); })); return; } } this._text=null; id=this._parse(_11,_b.byId(evt.target.id).urlTarget); if(!dm._viewMap){ dm._viewMap=[]; } dm._viewMap[evt.detail.url]=id; } _10=id; w=this.findCurrentView(_10,_b.byId(evt.target.id))||w; } w.performTransition(_10,evt.detail.transitionDir,evt.detail.transition,null,null); },_parse:function(_17,id){ var _18,_19,i,j,len; var _1a=this.findCurrentView(); var _1b=_b.byId(id)&&_b.byId(id).containerNode||_7.byId(id)||_1a&&_1a.domNode.parentNode||_6.body(); var _1c=null; for(j=_1b.childNodes.length-1;j>=0;j--){ var c=_1b.childNodes[j]; if(c.nodeType===1){ if(c.getAttribute("fixed")==="bottom"){ _1c=c; } break; } } if(_17.charAt(0)==="<"){ _18=_9.create("DIV",{innerHTML:_17}); for(i=0;i<_18.childNodes.length;i++){ var n=_18.childNodes[i]; if(n.nodeType===1){ _19=n; break; } } if(!_19){ return; } _19.style.visibility="hidden"; _1b.insertBefore(_18,_1c); var ws=_1.parser.parse(_18); _2.forEach(ws,function(w){ if(w&&!w._started&&w.startup){ w.startup(); } }); for(i=0,len=_18.childNodes.length;i