vendor/assets/javascripts/dojox/mobile/View.js in dojox-rails-0.13.0 vs vendor/assets/javascripts/dojox/mobile/View.js in dojox-rails-0.14.0
- old
+ new
@@ -42,12 +42,14 @@
},this);
(_19||_1a||_1b)._visible=true;
}
if(this._visible){
this.show(true,true);
+this.defer(function(){
this.onStartView();
_3.publish("/dojox/mobile/startView",[this]);
+});
}
if(this.domNode.style.visibility!="visible"){
this.domNode.style.visibility="visible";
}
this.inherited(arguments);
@@ -87,232 +89,238 @@
if(n.nodeType===1&&_a.contains(n,"mblView")){
this._clearClasses(n);
}
}
this._clearClasses(_30);
-},convertToId:function(_32){
-if(typeof (_32)=="string"){
-return _32.replace(/^#?([^&?]+).*/,"$1");
+var _32=_e.byNode(_30);
+if(_32){
+_32._inProgress=false;
}
-return _32;
-},_isBookmarkable:function(_33){
-return _33.moveTo&&(_2["mblForceBookmarkable"]||_33.moveTo.charAt(0)==="#")&&!_33.hashchange;
-},performTransition:function(_34,_35,_36,_37,_38){
-var _39,_3a;
-if(_34&&typeof (_34)==="object"){
-_39=_34;
+},convertToId:function(_33){
+if(typeof (_33)=="string"){
+return _33.replace(/^#?([^&?]+).*/,"$1");
+}
+return _33;
+},_isBookmarkable:function(_34){
+return _34.moveTo&&(_2["mblForceBookmarkable"]||_34.moveTo.charAt(0)==="#")&&!_34.hashchange;
+},performTransition:function(_35,_36,_37,_38,_39){
+if(this._inProgress){
+return;
+}
+this._inProgress=true;
+var _3a,_3b;
+if(_35&&typeof (_35)==="object"){
_3a=_35;
+_3b=_36;
}else{
-_39={moveTo:_34,transitionDir:_35,transition:_36,context:_37,method:_38};
-_3a=[];
+_3a={moveTo:_35,transitionDir:_36,transition:_37,context:_38,method:_39};
+_3b=[];
for(var i=5;i<arguments.length;i++){
-_3a.push(arguments[i]);
+_3b.push(arguments[i]);
}
}
-this._detail=_39;
-this._optArgs=_3a;
-this._arguments=[_39.moveTo,_39.transitionDir,_39.transition,_39.context,_39.method];
-if(_39.moveTo==="#"){
+this._detail=_3a;
+this._optArgs=_3b;
+this._arguments=[_3a.moveTo,_3a.transitionDir,_3a.transition,_3a.context,_3a.method];
+if(_3a.moveTo==="#"){
return;
}
-var _3b;
-if(_39.moveTo){
-_3b=this.convertToId(_39.moveTo);
+var _3c;
+if(_3a.moveTo){
+_3c=this.convertToId(_3a.moveTo);
}else{
if(!this._dummyNode){
this._dummyNode=_7.doc.createElement("div");
_7.body().appendChild(this._dummyNode);
}
-_3b=this._dummyNode;
+_3c=this._dummyNode;
}
-if(this.addTransitionInfo&&typeof (_39.moveTo)=="string"&&this._isBookmarkable(_39)){
-this.addTransitionInfo(this.id,_39.moveTo,{transitionDir:_39.transitionDir,transition:_39.transition});
+if(this.addTransitionInfo&&typeof (_3a.moveTo)=="string"&&this._isBookmarkable(_3a)){
+this.addTransitionInfo(this.id,_3a.moveTo,{transitionDir:_3a.transitionDir,transition:_3a.transition});
}
-var _3c=this.domNode;
-var _3d=_3c.offsetTop;
-_3b=this.toNode=_9.byId(_3b);
-if(!_3b){
+var _3d=this.domNode;
+var _3e=_3d.offsetTop;
+_3c=this.toNode=_9.byId(_3c);
+if(!_3c){
return;
}
-_3b.style.visibility="hidden";
-_3b.style.display="";
-this._fixViewState(_3b);
-var _3e=_e.byNode(_3b);
-if(_3e){
-if(_2["mblAlwaysResizeOnTransition"]||!_3e._resized){
-_13.resizeAll(null,_3e);
-_3e._resized=true;
+_3c.style.visibility="hidden";
+_3c.style.display="";
+this._fixViewState(_3c);
+var _3f=_e.byNode(_3c);
+if(_3f){
+if(_2["mblAlwaysResizeOnTransition"]||!_3f._resized){
+_13.resizeAll(null,_3f);
+_3f._resized=true;
}
-if(_39.transition&&_39.transition!="none"){
-_3e.containerNode.style.paddingTop=_3d+"px";
+if(_3a.transition&&_3a.transition!="none"){
+_3f.containerNode.style.paddingTop=_3e+"px";
}
-_3e.load&&_3e.load();
-_3e.movedFrom=_3c.id;
+_3f.load&&_3f.load();
+_3f.movedFrom=_3d.id;
}
-if(_6("mblAndroidWorkaround")&&!_2["mblCSS3Transition"]&&_39.transition&&_39.transition!="none"){
-_d.set(_3b,"webkitTransformStyle","preserve-3d");
+if(_6("mblAndroidWorkaround")&&!_2["mblCSS3Transition"]&&_3a.transition&&_3a.transition!="none"){
_d.set(_3c,"webkitTransformStyle","preserve-3d");
-_a.add(_3b,"mblAndroidWorkaround");
+_d.set(_3d,"webkitTransformStyle","preserve-3d");
+_a.add(_3c,"mblAndroidWorkaround");
}
this.onBeforeTransitionOut.apply(this,this._arguments);
_3.publish("/dojox/mobile/beforeTransitionOut",[this].concat(_5._toArray(this._arguments)));
-if(_3e){
+if(_3f){
if(this.keepScrollPos&&!this.getParent()){
-var _3f=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
-_3c._scrollTop=_3f;
-var _40=(_39.transitionDir==1)?0:(_3b._scrollTop||0);
-_3b.style.top="0px";
-if(_3f>1||_40!==0){
-_3c.style.top=_40-_3f+"px";
+var _40=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
+_3d._scrollTop=_40;
+var _41=(_3a.transitionDir==1)?0:(_3c._scrollTop||0);
+_3c.style.top="0px";
+if(_40>1||_41!==0){
+_3d.style.top=_41-_40+"px";
if(_2["mblHideAddressBar"]!==false){
setTimeout(function(){
-_7.global.scrollTo(0,(_40||1));
+_7.global.scrollTo(0,(_41||1));
},0);
}
}
}else{
-_3b.style.top="0px";
+_3c.style.top="0px";
}
-_3e.onBeforeTransitionIn.apply(_3e,this._arguments);
-_3.publish("/dojox/mobile/beforeTransitionIn",[_3e].concat(_5._toArray(this._arguments)));
+_3f.onBeforeTransitionIn.apply(_3f,this._arguments);
+_3.publish("/dojox/mobile/beforeTransitionIn",[_3f].concat(_5._toArray(this._arguments)));
}
-_3b.style.display="none";
-_3b.style.visibility="visible";
+_3c.style.display="none";
+_3c.style.visibility="visible";
_13.fromView=this;
-_13.toView=_3e;
-this._doTransition(_3c,_3b,_39.transition,_39.transitionDir);
+_13.toView=_3f;
+this._doTransition(_3d,_3c,_3a.transition,_3a.transitionDir);
},_toCls:function(s){
return "mbl"+s.charAt(0).toUpperCase()+s.substring(1);
-},_doTransition:function(_41,_42,_43,_44){
-var rev=(_44==-1)?" mblReverse":"";
-_42.style.display="";
-if(!_43||_43=="none"){
+},_doTransition:function(_42,_43,_44,_45){
+var rev=(_45==-1)?" mblReverse":"";
+_43.style.display="";
+if(!_44||_44=="none"){
this.domNode.style.display="none";
this.invokeCallback();
}else{
if(_2["mblCSS3Transition"]){
-_8.when(_14,_5.hitch(this,function(_45){
-var _46=_d.get(_42,"position");
-_d.set(_42,"position","absolute");
-_8.when(_45(_41,_42,{transition:_43,reverse:(_44===-1)?true:false}),_5.hitch(this,function(){
-_d.set(_42,"position",_46);
+_8.when(_14,_5.hitch(this,function(_46){
+var _47=_d.get(_43,"position");
+_d.set(_43,"position","absolute");
+_8.when(_46(_42,_43,{transition:_44,reverse:(_45===-1)?true:false}),_5.hitch(this,function(){
+_d.set(_43,"position",_47);
this.invokeCallback();
}));
}));
}else{
-if(_43.indexOf("cube")!=-1){
+if(_44.indexOf("cube")!=-1){
if(_6("ipad")){
-_d.set(_42.parentNode,{webkitPerspective:1600});
+_d.set(_43.parentNode,{webkitPerspective:1600});
}else{
if(_6("iphone")){
-_d.set(_42.parentNode,{webkitPerspective:800});
+_d.set(_43.parentNode,{webkitPerspective:800});
}
}
}
-var s=this._toCls(_43);
+var s=this._toCls(_44);
if(_6("mblAndroidWorkaround")){
setTimeout(function(){
-_a.add(_41,s+" mblOut"+rev);
-_a.add(_42,s+" mblIn"+rev);
-_a.remove(_42,"mblAndroidWorkaround");
+_a.add(_42,s+" mblOut"+rev);
+_a.add(_43,s+" mblIn"+rev);
+_a.remove(_43,"mblAndroidWorkaround");
setTimeout(function(){
-_a.add(_41,"mblTransition");
_a.add(_42,"mblTransition");
+_a.add(_43,"mblTransition");
},30);
},70);
}else{
-_a.add(_41,s+" mblOut"+rev);
-_a.add(_42,s+" mblIn"+rev);
+_a.add(_42,s+" mblOut"+rev);
+_a.add(_43,s+" mblIn"+rev);
setTimeout(function(){
-_a.add(_41,"mblTransition");
_a.add(_42,"mblTransition");
+_a.add(_43,"mblTransition");
},100);
}
-var _47="50% 50%";
var _48="50% 50%";
-var _49,_4a,_4b;
-if(_43.indexOf("swirl")!=-1||_43.indexOf("zoom")!=-1){
+var _49="50% 50%";
+var _4a,_4b,_4c;
+if(_44.indexOf("swirl")!=-1||_44.indexOf("zoom")!=-1){
if(this.keepScrollPos&&!this.getParent()){
-_49=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
+_4a=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
}else{
-_49=-_c.position(_41,true).y;
+_4a=-_c.position(_42,true).y;
}
-_4b=_7.global.innerHeight/2+_49;
-_47="50% "+_4b+"px";
-_48="50% "+_4b+"px";
+_4c=_7.global.innerHeight/2+_4a;
+_48="50% "+_4c+"px";
+_49="50% "+_4c+"px";
}else{
-if(_43.indexOf("scale")!=-1){
-var _4c=_c.position(_41,true);
-_4a=((this.clickedPosX!==undefined)?this.clickedPosX:_7.global.innerWidth/2)-_4c.x;
+if(_44.indexOf("scale")!=-1){
+var _4d=_c.position(_42,true);
+_4b=((this.clickedPosX!==undefined)?this.clickedPosX:_7.global.innerWidth/2)-_4d.x;
if(this.keepScrollPos&&!this.getParent()){
-_49=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
+_4a=_7.body().scrollTop||_7.doc.documentElement.scrollTop||_7.global.pageYOffset||0;
}else{
-_49=-_4c.y;
+_4a=-_4d.y;
}
-_4b=((this.clickedPosY!==undefined)?this.clickedPosY:_7.global.innerHeight/2)+_49;
-_47=_4a+"px "+_4b+"px";
-_48=_4a+"px "+_4b+"px";
+_4c=((this.clickedPosY!==undefined)?this.clickedPosY:_7.global.innerHeight/2)+_4a;
+_48=_4b+"px "+_4c+"px";
+_49=_4b+"px "+_4c+"px";
}
}
-_d.set(_41,{webkitTransformOrigin:_47});
_d.set(_42,{webkitTransformOrigin:_48});
+_d.set(_43,{webkitTransformOrigin:_49});
}
}
},onAnimationStart:function(e){
},onAnimationEnd:function(e){
-var _4d=e.animationName||e.target.className;
-if(_4d.indexOf("Out")===-1&&_4d.indexOf("In")===-1&&_4d.indexOf("Shrink")===-1){
+var _4e=e.animationName||e.target.className;
+if(_4e.indexOf("Out")===-1&&_4e.indexOf("In")===-1&&_4e.indexOf("Shrink")===-1){
return;
}
-var _4e=false;
+var _4f=false;
if(_a.contains(this.domNode,"mblOut")){
-_4e=true;
+_4f=true;
this.domNode.style.display="none";
_a.remove(this.domNode,[this._toCls(this._detail.transition),"mblIn","mblOut","mblReverse"]);
}else{
this.containerNode.style.paddingTop="";
}
_d.set(this.domNode,{webkitTransformOrigin:""});
-if(_4d.indexOf("Shrink")!==-1){
+if(_4e.indexOf("Shrink")!==-1){
var li=e.target;
li.style.display="none";
_a.remove(li,"mblCloseContent");
var p=_15.getEnclosingScrollable(this.domNode);
p&&p.onTouchEnd();
}
-if(_4e){
+if(_4f){
this.invokeCallback();
}
this._clearClasses(this.domNode);
this.clickedPosX=this.clickedPosY=undefined;
-if(_4d.indexOf("Cube")!==-1&&_4d.indexOf("In")!==-1&&_6("iphone")){
+if(_4e.indexOf("Cube")!==-1&&_4e.indexOf("In")!==-1&&_6("iphone")){
this.domNode.parentNode.style.webkitPerspective="";
}
},invokeCallback:function(){
this.onAfterTransitionOut.apply(this,this._arguments);
_3.publish("/dojox/mobile/afterTransitionOut",[this].concat(this._arguments));
-var _4f=_e.byNode(this.toNode);
-if(_4f){
-_4f.onAfterTransitionIn.apply(_4f,this._arguments);
-_3.publish("/dojox/mobile/afterTransitionIn",[_4f].concat(this._arguments));
-_4f.movedFrom=undefined;
+var _50=_e.byNode(this.toNode);
+if(_50){
+_50.onAfterTransitionIn.apply(_50,this._arguments);
+_3.publish("/dojox/mobile/afterTransitionIn",[_50].concat(this._arguments));
+_50.movedFrom=undefined;
if(this.setFragIds&&this._isBookmarkable(this._detail)){
-this.setFragIds(_4f);
+this.setFragIds(_50);
}
}
if(_6("mblAndroidWorkaround")){
setTimeout(_5.hitch(this,function(){
-if(_4f){
+if(_50){
_d.set(this.toNode,"webkitTransformStyle","");
}
_d.set(this.domNode,"webkitTransformStyle","");
}),0);
}
var c=this._detail.context,m=this._detail.method;
-if(!c&&!m){
-return;
-}
+if(c||m){
if(!m){
m=c;
c=null;
}
c=c||_7.global;
@@ -321,28 +329,31 @@
}else{
if(typeof (m)=="function"){
m.apply(c,this._optArgs);
}
}
-},isVisible:function(_50){
-var _51=function(_52){
-return _d.get(_52,"display")!=="none";
+}
+this._detail=this._optArgs=this._arguments=undefined;
+this._inProgress=false;
+},isVisible:function(_51){
+var _52=function(_53){
+return _d.get(_53,"display")!=="none";
};
-if(_50){
+if(_51){
for(var n=this.domNode;n.tagName!=="BODY";n=n.parentNode){
-if(!_51(n)){
+if(!_52(n)){
return false;
}
}
return true;
}else{
-return _51(this.domNode);
+return _52(this.domNode);
}
},getShowingView:function(){
-var _53=this.domNode.parentNode.childNodes;
-for(var i=0;i<_53.length;i++){
-var n=_53[i];
+var _54=this.domNode.parentNode.childNodes;
+for(var i=0;i<_54.length;i++){
+var n=_54[i];
if(n.nodeType===1&&_a.contains(n,"mblView")&&n.style.display!=="none"){
return _e.byNode(n);
}
}
return null;
@@ -353,28 +364,28 @@
return _1.map(_1.filter(this.domNode.parentNode.childNodes,function(n){
return n.nodeType===1&&_a.contains(n,"mblView");
}),function(n){
return _e.byNode(n);
});
-},show:function(_54,_55){
+},show:function(_55,_56){
var out=this.getShowingView();
-if(!_54){
+if(!_55){
if(out){
out.onBeforeTransitionOut(out.id);
_3.publish("/dojox/mobile/beforeTransitionOut",[out,out.id]);
}
this.onBeforeTransitionIn(this.id);
_3.publish("/dojox/mobile/beforeTransitionIn",[this,this.id]);
}
-if(_55){
+if(_56){
this.domNode.style.display="";
}else{
_1.forEach(this.getSiblingViews(),function(v){
v.domNode.style.display=(v===this)?"":"none";
},this);
}
this.load&&this.load();
-if(!_54){
+if(!_55){
if(out){
out.onAfterTransitionOut(out.id);
_3.publish("/dojox/mobile/afterTransitionOut",[out,out.id]);
}
this.onAfterTransitionIn(this.id);