//>>built define("dojox/mobile/pageTurningUtils",["dojo/_base/kernel","dojo/_base/array","dojo/_base/connect","dojo/_base/event","dojo/dom-class","dojo/dom-construct","dojo/dom-style"],function(_1,_2,_3,_4,_5,_6,_7){ _1.experimental("dojox.mobile.pageTurningUtils"); return function(){ this.w=0; this.h=0; this.turnfrom="top"; this.page=1; this.dogear=1; this.duration=2; this.alwaysDogeared=false; this._styleParams={}; this._catalogNode=null; this._currentPageNode=null; this._transitionEndHandle=null; this.init=function(w,h,_8,_9,_a,_b,_c){ this.w=w; this.h=h; this.turnfrom=_8?_8:this.turnfrom; this.page=_9?_9:this.page; this.dogear=typeof _a!=="undefined"?_a:this.dogear; this.duration=typeof _b!=="undefined"?_b:this.duration; this.alwaysDogeared=typeof _c!=="undefined"?_c:this.alwaysDogeared; if(this.turnfrom==="bottom"){ this.alwaysDogeared=true; } this._calcStyleParams(); }; this._calcStyleParams=function(){ var _d=Math.tan(58*Math.PI/180),_e=Math.cos(32*Math.PI/180),_f=Math.sin(32*Math.PI/180),_10=Math.tan(32*Math.PI/180),w=this.w,h=this.h,_11=this.page,_12=this.turnfrom,_13=this._styleParams; var Q=fold=w*_d,fw=Q*_f+Q*_e*_d,fh=fold+w+w/_d,dw=w*0.11*this.dogear,pw=w-dw,_14=pw*_e,cx,cy,dx,dy,fy; switch(this.turnfrom){ case "top": cx=fw-_14; cy=_14*_d; dx=fw-dw; dy=cy+pw/_d-7; fy=cy/_e; _13.init={page:{top:-fy+"px",left:(-fw+(_11===2?w:0))+"px",width:fw+"px",height:fh+"px",webkitTransformOrigin:"100% 0%"},front:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},back:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},shadow:{display:"",left:fw+"px",height:h*1.5+"px"}}; _13.turnForward={page:{webkitTransform:"rotate(0deg)"},front:{webkitTransform:"translate("+fw+"px,"+fy+"px) rotate(0deg)",webkitTransformOrigin:"-110px -18px"},back:{webkitTransform:"translate("+(fw-w)+"px,"+fy+"px) rotate(0deg)",webkitTransformOrigin:"0px 0px"}}; _13.turnBackward={page:{webkitTransform:"rotate(-32deg)"},front:{webkitTransform:"translate("+cx+"px,"+cy+"px) rotate(32deg)",webkitTransformOrigin:"0px 0px"},back:{webkitTransform:"translate("+dx+"px,"+dy+"px) rotate(-32deg)",webkitTransformOrigin:"0px 0px"}}; break; case "bottom": cx=fw-(h*_f+w*_e)-2; cy=fh-(h+w/_10)*_e; dx=fw; dy=fh-w/_f-h; fy=fh-w/_10-h; _13.init={page:{top:(-fy+50)+"px",left:(-fw+(_11===2?w:0))+"px",width:fw+"px",height:fh+"px",webkitTransformOrigin:"100% 100%"},front:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},back:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},shadow:{display:"none"}}; _13.turnForward={page:{webkitTransform:"rotate(0deg)"},front:{webkitTransform:"translate("+fw+"px,"+fy+"px) rotate(0deg)",webkitTransformOrigin:"-220px 35px"},back:{webkitTransform:"translate("+(w*2)+"px,"+fy+"px) rotate(0deg)",webkitTransformOrigin:"0px 0px"}}; _13.turnBackward={page:{webkitTransform:"rotate(32deg)"},front:{webkitTransform:"translate("+cx+"px,"+cy+"px) rotate(-32deg)",webkitTransformOrigin:"0px 0px"},back:{webkitTransform:"translate("+dx+"px,"+dy+"px) rotate(0deg)",webkitTransformOrigin:"0px 0px"}}; break; case "left": cx=-w; cy=pw/_10-2; dx=-pw; dy=fy=pw/_f+dw*_f; _13.init={page:{top:-cy+"px",left:w+"px",width:fw+"px",height:fh+"px",webkitTransformOrigin:"0% 0%"},front:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},back:{width:w+"px",height:h+"px",webkitBoxShadow:"0 0"},shadow:{display:"",left:"-4px",height:((_11===2?h*1.5:h)+50)+"px"}}; _13.turnForward={page:{webkitTransform:"rotate(0deg)"},front:{webkitTransform:"translate("+cx+"px,"+cy+"px) rotate(0deg)",webkitTransformOrigin:"160px 68px"},back:{webkitTransform:"translate(0px,"+cy+"px) rotate(0deg)",webkitTransformOrigin:"0px 0px"}}; _13.turnBackward={page:{webkitTransform:"rotate(32deg)"},front:{webkitTransform:"translate("+(-dw)+"px,"+dy+"px) rotate(-32deg)",webkitTransformOrigin:"0px 0px"},back:{webkitTransform:"translate("+dx+"px,"+dy+"px) rotate(32deg)",webkitTransformOrigin:"top right"}}; break; } _13.init.catalog={width:(_11===2?w*2:w)+"px",height:((_11===2?h*1.5:h)+(_12=="top"?0:50))+"px"}; }; this.getChildren=function(_15){ return _2.filter(_15.childNodes,function(n){ return n.nodeType===1; }); }; this.getPages=function(){ return this._catalogNode?this.getChildren(this._catalogNode):null; }; this.getCurrentPage=function(){ return this._currentPageNode; }; this.getIndexOfPage=function(_16,_17){ if(!_17){ _17=this.getPages(); } for(var i=0;i<_17.length;i++){ if(_16===_17[i]){ return i; } } return -1; }; this.getNextPage=function(_18){ for(var n=_18.nextSibling;n;n=n.nextSibling){ if(n.nodeType===1){ return n; } } return null; }; this.getPreviousPage=function(_19){ for(var n=_19.previousSibling;n;n=n.previousSibling){ if(n.nodeType===1){ return n; } } return null; }; this.isPageTurned=function(_1a){ return _1a.style.webkitTransform=="rotate(0deg)"; }; this._onPageTurned=function(e){ _4.stop(e); if(_5.contains(e.target,"mblPageTurningPage")){ this.onPageTurned(e.target); } }; this.onPageTurned=function(){ }; this.initCatalog=function(_1b){ if(this._catalogNode!=_1b){ if(this._transitionEndHandle){ _3.disconnect(this._transitionEndHandle); } this._transitionEndHandle=_3.connect(_1b,"webkitTransitionEnd",this,"_onPageTurned"); this._catalogNode=_1b; } _5.add(_1b,"mblPageTurningCatalog"); _7.set(_1b,this._styleParams.init.catalog); var _1c=this.getPages(); _2.forEach(_1c,function(_1d){ this.initPage(_1d); },this); this.resetCatalog(); }; this._getBaseZIndex=function(){ return this._catalogNode.style.zIndex||0; }; this.resetCatalog=function(){ var _1e=this.getPages(),len=_1e.length,_1f=this._getBaseZIndex(); for(var i=len-1;i>=0;i--){ var _20=_1e[i]; this.showDogear(_20); if(this.isPageTurned(_20)){ _20.style.zIndex=_1f+len+1; }else{ _20.style.zIndex=_1f+len-i; !this.alwaysDogeared&&this.hideDogear(_20); this._currentPageNode=_20; } } if(!this.alwaysDogeared&&this._currentPageNode!=_1e[len-1]){ this.showDogear(this._currentPageNode); } }; this.initPage=function(_21,dir){ var _22=this.getChildren(_21); while(_22.length<3){ _21.appendChild(_6.create("div",null)); _22=this.getChildren(_21); } var _23=!_5.contains(_21,"mblPageTurningPage"); _5.add(_21,"mblPageTurningPage"); _5.add(_22[0],"mblPageTurningFront"); _5.add(_22[1],"mblPageTurningBack"); _5.add(_22[2],"mblPageTurningShadow"); var p=this._styleParams.init; _7.set(_21,p.page); _7.set(_22[0],p.front); _7.set(_22[1],p.back); p.shadow&&_7.set(_22[2],p.shadow); if(!dir){ if(_23&&this._currentPageNode){ var _24=this.getPages(); dir=this.getIndexOfPage(_21)