1 html中引入
<script type="text/javascript" src="js/turn.js"></script>
<script type="text/javascript" src="./js/jquery.min.1.7.js"></script>
2 创建html
<div id="flipbook">
<div class="hard"> Turn.js </div>
<div class="hard"></div>
<div> Page 1 </div>
<div> Page 2 </div>
<div> Page 3 </div>
<div> Page 4 </div>
<div class="hard"></div>
<div class="hard"></div>
</div>
3 javascript 部分
$("#flipbook").turn({
width: 400,
height: 300,
autoCenter: true
});
4.可用选项、属性、方法、事件、css类
选项:
(1)acceleration:设置硬件加速模式,对于触摸设备,此值必须为真。
acceleration:true;
(2)direction:指定flipbook从左到右(DIR=ltr,默认值)或右向左(DIR=rtl)的方向。
a.$("#flipbook").turn({
direction:'rtl'
})
b.<div id="flipbook" dir="rtl"></div>
c.#flipbook{
direction:rtl
}
(3)duration:设置翻页的速度
duration:600 如果设置为0 则不会产生翻页效(4) gradients:翻页过程中显示渐变和阴影
gradients:true
(5) width:页面的宽度 height:页面的高度
width:num height:num
(6) elevation:转换期间页面的高度
elevation:0
(7) page:初始化时设置页面个数
page:1
(8) pages:设置任意数量的页面。如果页面的数量大于#flipbook中元素的数量,使用addPage方法动态地添加这些页面。
$("#flipbook").children().length()
(9) when:事件侦听器。键必须在事件列表中使用
$("#flipbook").turn({
when:{
turned: function(e, page) {
if(page==1){
}
if(page==2){
}
}
}
})
属性:
(1) animating:当折叠的页面显示时返回true,
function isAnimating() {
if ($("#flipbook").turn("animating")) {
alert('Animating a page!');
}
}
(2)direction: 返回当前翻页的方向
$("#flipbook).turn("direction")
(3)display:获取当前显示的是单页还是双页
$("#flipbook).turn("display")
(4)page:获取当前页面为第几页
$("#flipbook).turn("page")
(5)pages:获取总共有多少页
$("#flipbook").turn("pages")
(6)size:获取flipbook的高宽
$("#flipbook").turn("size") 获取出有两个值 size.width 和 size.height
方法:
(1) addpage:将页面添加到flipbook中
例如插入第10页:
element=$("<div />").html("loading");
$("#flipbook").turn("addpagge",element,10)
(2) destroy:删除所有页面
$("#flipbook").turn("destroy").remove();
(3) direction :设置flipbook 的方向
$("#flipbook").turn("direciton","rtl")
(4) display:设置单页还是双页
$("#flipbook").turn("display","single")
(5) next 把视图转到下一个
$("#flipbook").turn("next")
$("#flipbook").turn("next").turn("next")
(6) options:更改选项的值
$("#flipbook").turn("options",{display:"single",duration:})
(7) page:跳到指定的页面
$("#fllipbook").turn("page",10)
(8) previous:转到前面的视图
$("#flipbook").turn("previous")
(9) removepage:删除指定的页面
$("#flipbook").turn("removepage",10)
(10) resize:重新计算页面的大小
$("flipbook").turn("resize")
(11) stop:停止当前的过渡
$("#flipbook").turn("page",10).turn("stop")
(12)version:获取当前发布的版本
$("#flipbook").turn("version")
(13)zoom:flipbook的缩放比例
$("#flipbook").turn("zoom",0.5) 例如当值为0.5时 缩小为原来的一半 当值为1时 则不改变大小
事件:
(1) end:事件在页面停止时触发
$("#flipbook").bind("end",function(event,pageobject,turned){
alert("turn.end:"+pageobject.page)
})
(2)first:当当前页面为1时触发此事件
$("#flipbook").bind("first",function(event){
alert("page1")
})
(3)last:当当前页面为最后一页时触发此事件
$("#flipbook").bind("last",function(event){
alert("page_last")
})
(4)missing:当当前范围需要某些页面时 触发此事件
$("#flipbook").bind("missing",function(event,pages){
for(var i=0;i<pages.length;i++){
$(this).turn("addpage",$("<div/>"),pages[i])
}
})
(10) addpage:将页面插入到flipbook
element=$("<div/>").html("loading...")
$("#flipbook").turn("addpage",element,10) 插入第10页
(11) start:页面启动时触发
$("#flipbook").bind("start",function(event,pageobject,corner){
if(corner=="tl"||corner=="tr"){
event.preventDefault();
}
})
当翻动左角和右角时,禁止启动动画
(12)turning:翻页之前被启动
$("#flipbook").bind("turning",function(event,page,view){
alert("turning the page to"+page)
})
翻页之前 弹出即将翻开的是第几页
(13)turned:翻页完成之后启动
$("#flipbook").bind("turned",function(event,page,view){
alert("page"+page)
})
(14)zooming:当缩放改变时触发此事件
$("#flipbook").bind("zooming", function(event, newZoomValue, currentZoomValue) {
alert("New zoom: "+currentZoomValue);
});
turn.js 代码
/* turn.js 4.1.0 | Copyright (c) 2012 Emmanuel Garcia | turnjs.com | turnjs.com/license.txt */(FUNCTION (f) { FUNCTION I (a,b,c) { IF (! c [ 0 ] || "object"==typeof c [ 0 ]) RETURN b.init.apply (a,c); IF (b [ c [ 0 ]]) RETURN b [ c [ 0 ]].apply (a,Array.prototype.slice.CALL (c,1)); throw p (c [ 0 ]+" is not a method or property"); } FUNCTION l (a,b,c,d) { RETURN { css : { position : "absolute",top : a,LEFT : b,overflow : d || "hidden",zIndex : c || "auto" } } } FUNCTION R (a,b,c,d,e) { var h=1-e,f=h*h*h,g=e*e*e; RETURN j (Math.round(f*a.x+3*e*h*h*b.x+3*e*e*h*c.x+g*d.x),Math.round(f*a.y+3*e*h*h*b.y+3*e*e*h*c.y+g*d.y)) } FUNCTION j (a,b) { RETURN { x : a,y : b } } FUNCTION E (a,b,c) { RETURN y && c ? " translate3d("+a+"px,"+b+"px, 0px) " : " translate("+a+"px, "+b+"px) " } FUNCTION F (a) { RETURN " rotate("+a+"deg) " } FUNCTION n (a,b) { RETURN Object.prototype.hasOwnProperty.CALL (b,a) } FUNCTION S () { FOR (var a=[ "Moz","Webkit","Khtml","O","ms" ],b=a.length,c=""; b--;) a [ b ]+"Transform" IN document.body.style && (c="-"+a [ b ].toLowerCase ()+"-"); RETURN c } FUNCTION O (a,b,c,d,e) { var h,f=[]; IF ("-webkit-"==v) { FOR (h=0; h< e; h++) f.push ("color-stop("+d [ h ][ 0 ]+", "+d [ h ][ 1 ]+")"); a.css ({ "background-image" : "-webkit-gradient(linear, "+b.x+"% "+b.y+"%,"+c.x+"% "+c.y+"%, "+f.JOIN (",")+" )" }) } ELSE { var b={ x : b.x/100*a.width (),y : b.y/100*a.height () },c={ x : c.x/100*a.width (),y : c.y/100*a.height () },g=c.x-b.x; h=c.y-b.y; var i=Math.atan2(h,g),w=i-Math.PI/2,w=Math.abs(a.width ()*Math.sin(w))+Math.abs(a.height ()*Math.cos(w)),g=Math.sqrt(h*h+g*g),c=j (c.x< b.x ? a.width () : 0,c.y< b.y ? a.height () : 0),k=Math.tan(i); h=-1/k; k=(h*c.x-c.y-k*b.x+b.y)/(h-k); c=h*k-h*c.x+c.y; b=Math.sqrt(Math.pow(k-b.x,2)+Math.pow(c-b.y,2)); FOR (h=0; h< e; h++) f.push (" "+d [ h ][ 1 ]+" "+100*(b+g*d [ h ][ 0 ])/w+"%"); a.css ({ "background-image" : v+"linear-gradient("+-i+"rad,"+f.JOIN (",")+")" }) } } FUNCTION s (a,b,c) { a=f.EVENT (a); b.TRIGGER (a,c); RETURN a.isDefaultPrevented () ? "prevented" : a.isPropagationStopped () ? "stopped" : "" } FUNCTION p (a) { FUNCTION b (a) { this.NAME="TurnJsError"; this.message=a } b.prototype=Error (); b.prototype.constructor=b; RETURN new b (a) } FUNCTION C (a) { var b={ top : 0,LEFT : 0 }; DO b.LEFT+=a.offsetLeft,b.top+=a.offsetTop; WHILE (a=a.offsetParent); RETURN b } var y,T,v="",J=Math.PI,K=J/2,t="ontouchstart" IN window,q=t ? { down : "touchstart",move : "touchmove",up : "touchend",over : "touchstart",OUT : "touchend" } : { down : "mousedown",move : "mousemove",up : "mouseup",over : "mouseover",OUT : "mouseout" },o={ backward : [ "bl","tl" ],forward : [ "br","tr" ],ALL : "tl bl tr br l r".split (" ") },U=[ "single","double" ],V=[ "ltr","rtl" ],W={ acceleration : ! 0,display : "double",duration : 600,page : 1,gradients : ! 0,turnCorners : "bl,br",WHEN : NULL },X={ cornerSize : 100 },g={ init : FUNCTION (a) { y="WebKitCSSMatrix" IN window || "MozPerspective" IN document.body.style; var b; T=(b=/AppleWebkit \/([ 0-9 \.]+)/i.exec (navigator.userAgent)) ? 534.3< parseFloat (b [ 1 ]) : ! 0; v=S (); var c; b=0; var d=this.DATA (),e=this.children (),a=f.extend ({ width : this.width (),height : this.height (),direction : this.attr ("dir") || this.css ("direction") || "ltr" },W,a); d.opts=a; d.pageObjs={}; d.pages={}; d.pageWrap={}; d.pageZoom={}; d.pagePlace={}; d.pageMv=[]; d.zoom=1; d.totalPages=a.pages || 0; d.eventHandlers={ touchStart : f.proxy (g._touchStart,this),touchMove : f.proxy (g._touchMove,this),touchEnd : f.proxy (g._touchEnd,this),START : f.proxy (g._eventStart,this) }; IF (a.WHEN) FOR (c IN a.WHEN) n (c,a.WHEN) && this.bind (c,a.WHEN [ c ]); this.css ({ position : "relative",width : a.width,height : a.height }); this.turn ("display",a.display); "" !==a.direction && this.turn ("direction",a.direction); y && (! t && a.acceleration) && this.transform (E (0,0,! 0)); FOR (c=0; c< e.length; c++) "1" !=f (e [ c ]).attr ("ignore") && this.turn ("addPage",e [ c ],++b); f (this).bind (q.down,d.eventHandlers.touchStart).bind ("end",g._eventEnd).bind ("pressed",g._eventPressed).bind ("released",g._eventReleased).bind ("flip",g._flip); f (this).parent ().bind ("start",d.eventHandlers.START); f (document).bind (q.move,d.eventHandlers.touchMove).bind (q.up,d.eventHandlers.touchEnd); this.turn ("page",a.page); d.done=! 0; RETURN this },addPage : FUNCTION (a,b) { var c,d=! 1,e=this.DATA (),h=e.totalPages+1; IF (e.destroying) RETURN ! 1; IF (c=/\ bp ([ 0-9 ]+) \ b/.exec (f (a).attr ("class"))) b=parseInt (c [ 1 ],10); IF (b) IF (b==h) d=! 0; ELSE { IF (b> h) throw p ('Page "'+b+'" cannot be inserted'); } ELSE b=h,d=! 0; 1<=b && b<=h && (c="double"==e.display ? b % 2 ? " odd" : " even" : "",e.done && this.turn ("stop"),b IN e.pageObjs && g._movePages.CALL (this,b,1),d && (e.totalPages=h),e.pageObjs [ b ]=f (a).css ({ "float" : "left" }).addClass ("page p"+b+c),-1 !=navigator.userAgent.indexOf ("MSIE 9.0") && e.pageObjs [ b ].hasClass ("hard") && e.pageObjs [ b ].removeClass ("hard"),g._addPage.CALL (this,b),g._removeFromDOM.CALL (this)); RETURN this },_addPage : FUNCTION (a) { var b=this.DATA (),c=b.pageObjs [ a ]; IF (c) IF (g._necessPage.CALL (this,a)) { IF (! b.pageWrap [ a ]) { b.pageWrap [ a ]=f ("<div/>",{ "class" : "page-wrapper",page : a,css : { position : "absolute",overflow : "hidden" } }); this.append (b.pageWrap [ a ]); b.pagePlace [ a ] || (b.pagePlace [ a ]=a,b.pageObjs [ a ].appendTo (b.pageWrap [ a ])); var d=g._pageSize.CALL (this,a,! 0); c.css ({ width : d.width,height : d.height }); b.pageWrap [ a ].css (d) } b.pagePlace [ a ]==a && g._makeFlip.CALL (this,a) } ELSE b.pagePlace [ a ]=0,b.pageObjs [ a ] && b.pageObjs [ a ].REMOVE () },hasPage : FUNCTION (a) { RETURN n (a,this.DATA ().pageObjs) },center : FUNCTION (a) { var b=this.DATA (),c=f (this).turn ("size"),d=0; b.noCenter || ("double"==b.display && (a=this.turn ("view",a || b.tpage || b.page),"ltr"==b.direction ? a [ 0 ] ? a [ 1 ] || (d+=c.width/4) : d-=c.width/4 : a [ 0 ] ? a [ 1 ] || (d-=c.width/4) : d+=c.width/4),f (this).css ({ marginLeft : d })); RETURN this },destroy : FUNCTION () { var a=this,b=this.DATA (),c="end first flip last pressed released start turning turned zooming missing".split (" "); IF ("prevented" !=s ("destroying",this)) { b.destroying=! 0; f.EACH (c,FUNCTION (b,c) { a.unbind (c) }); this.parent ().unbind ("start",b.eventHandlers.START); FOR (f (document).unbind (q.move,b.eventHandlers.touchMove).unbind (q.up,b.eventHandlers.touchEnd); 0 !==b.totalPages;) this.turn ("removePage",b.totalPages); b.fparent && b.fparent.REMOVE (); b.shadow && b.shadow.REMOVE (); this.removeData (); b=NULL; RETURN this } },IS : FUNCTION () { RETURN "object"==typeof this.DATA ().pages },zoom : FUNCTION (a) { var b=this.DATA (); IF ("number"==typeof a) { IF (0.0010> a || 100< a) throw p (a+" is not a value for zoom"); IF ("prevented"==s ("zooming",this,[ a,b.zoom ])) RETURN this; var c=this.turn ("size"),d=this.turn ("view"),e=1/b.zoom,h=Math.round(c.width*e*a),c=Math.round(c.height*e*a); b.zoom=a; f (this).turn ("stop").turn ("size",h,c); b.opts.autoCenter && this.turn ("center"); g._updateShadow.CALL (this); FOR (a=0; a< d.length; a++) d [ a ] && b.pageZoom [ d [ a ]] !=b.zoom && (this.TRIGGER ("zoomed",[ d [ a ],d,b.pageZoom [ d [ a ]],b.zoom ]),b.pageZoom [ d [ a ]]=b.zoom); RETURN this } RETURN b.zoom },_pageSize : FUNCTION (a,b) { var c=this.DATA (),d={}; IF ("single"==c.display) d.width=this.width (),d.height=this.height (),b && (d.top=0,d.LEFT=0,d.RIGHT="auto"); ELSE { var e=this.width ()/2,h=this.height (); c.pageObjs [ a ].hasClass ("own-size") ? (d.width=c.pageObjs [ a ].width (),d.height=c.pageObjs [ a ].height ()) : (d.width=e,d.height=h); IF (b) { var f=a % 2; d.top=(h-d.height)/2; "ltr"==c.direction ? (d [ f ? "right" : "left" ]=e-d.width,d [ f ? "left" : "right" ]="auto") : (d [ f ? "left" : "right" ]=e-d.width,d [ f ? "right" : "left" ]="auto") } } RETURN d },_makeFlip : FUNCTION (a) { var b=this.DATA (); IF (! b.pages [ a ] && b.pagePlace [ a ]==a) { var c="single"==b.display,d=a % 2; b.pages [ a ]=b.pageObjs [ a ].css (g._pageSize.CALL (this,a)).flip ({ page : a,next : d || c ? a+1 : a-1,turn : this }).flip ("disable",b.disabled); g._setPageLoc.CALL (this,a); b.pageZoom [ a ]=b.zoom } RETURN b.pages [ a ] },_makeRange : FUNCTION () { var a,b; IF (! (1> this.DATA ().totalPages)) { b=this.turn ("range"); FOR (a=b [ 0 ]; a<=b [ 1 ]; a++) g._addPage.CALL (this,a) } },RANGE : FUNCTION (a) { var b,c,d,e=this.DATA (),a=a || e.tpage || e.page || 1; d=g._view.CALL (this,a); IF (1> a || a> e.totalPages) throw p ('"'+a+'" is not a valid page'); d [ 1 ]=d [ 1 ] || d [ 0 ]; 1<=d [ 0 ] && d [ 1 ]<=e.totalPages ? (a=Math.floor(2),e.totalPages-d [ 1 ]> d [ 0 ] ? (b=Math.min(d [ 0 ]-1,a),c=2*a-b) : (c=Math.min(e.totalPages-d [ 1 ],a),b=2*a-c)) : c=b=5; RETURN [ Math.max(1,d [ 0 ]-b),Math.min(e.totalPages,d [ 1 ]+c) ] },_necessPage : FUNCTION (a) { IF (0===a) RETURN ! 0; var b=this.turn ("range"); RETURN this.DATA ().pageObjs [ a ].hasClass ("fixed") || a>=b [ 0 ] && a<=b [ 1 ] },_removeFromDOM : FUNCTION () { var a,b=this.DATA (); FOR (a IN b.pageWrap) n (a,b.pageWrap) && ! g._necessPage.CALL (this,a) && g._removePageFromDOM.CALL (this,a) },_removePageFromDOM : FUNCTION (a) { var b=this.DATA (); IF (b.pages [ a ]) { var c=b.pages [ a ].DATA (); i._moveFoldingPage.CALL (b.pages [ a ],! 1); c.f && c.f.fwrapper && c.f.fwrapper.REMOVE (); b.pages [ a ].removeData (); b.pages [ a ].REMOVE (); DELETE b.pages [ a ] } b.pageObjs [ a ] && b.pageObjs [ a ].REMOVE (); b.pageWrap [ a ] && (b.pageWrap [ a ].REMOVE (),DELETE b.pageWrap [ a ]); g._removeMv.CALL (this,a); DELETE b.pagePlace [ a ]; DELETE b.pageZoom [ a ] },removePage : FUNCTION (a) { var b=this.DATA (); IF ("*"==a) FOR (; 0 !==b.totalPages;) this.turn ("removePage",b.totalPages); ELSE { IF (1> a || a> b.totalPages) throw p ("The page "+a+" doesn't exist"); b.pageObjs [ a ] && (this.turn ("stop"),g._removePageFromDOM.CALL (this,a),DELETE b.pageObjs [ a ]); g._movePages.CALL (this,a,-1); b.totalPages-=1; b.page> b.totalPages ? (b.page=NULL,g._fitPage.CALL (this,b.totalPages)) : (g._makeRange.CALL (this),this.turn ("update")) } RETURN this },_movePages : FUNCTION (a,b) { var c,d=this,e=this.DATA (),h="single"==e.display,f=FUNCTION (a) { var c=a+b,f=c % 2,i=f ? " odd " : " even "; e.pageObjs [ a ] && (e.pageObjs [ c ]=e.pageObjs [ a ].removeClass ("p"+a+" odd even").addClass ("p"+c+i)); e.pagePlace [ a ] && e.pageWrap [ a ] && (e.pagePlace [ c ]=c,e.pageWrap [ c ]=e.pageObjs [ c ].hasClass ("fixed") ? e.pageWrap [ a ].attr ("page",c) : e.pageWrap [ a ].css (g._pageSize.CALL (d,c,! 0)).attr ("page",c),e.pages [ a ] && (e.pages [ c ]=e.pages [ a ].flip ("options",{ page : c,next : h || f ? c+1 : c-1 })),b && (DELETE e.pages [ a ],DELETE e.pagePlace [ a ],DELETE e.pageZoom [ a ],DELETE e.pageObjs [ a ],DELETE e.pageWrap [ a ])) }; IF (0< b) FOR (c=e.totalPages; c>=a; c--) f (c); ELSE FOR (c=a; c<=e.totalPages; c++) f (c) },display : FUNCTION (a) { var b=this.DATA (),c=b.display; IF (void 0===a) RETURN c; IF (-1==f.inArray (a,U)) throw p ('"'+a+'" is not a value for display'); switch (a) { CASE "single" : b.pageObjs [ 0 ] || (this.turn ("stop").css ({ overflow : "hidden" }),b.pageObjs [ 0 ]=f ("<div />",{ "class" : "page p-temporal" }).css ({ width : this.width (),height : this.height () }).appendTo (this)); this.addClass ("shadow"); break; CASE "double" : b.pageObjs [ 0 ] && (this.turn ("stop").css ({ overflow : "" }),b.pageObjs [ 0 ].REMOVE (),DELETE b.pageObjs [ 0 ]),this.removeClass ("shadow") } b.display=a; c && (a=this.turn ("size"),g._movePages.CALL (this,1,0),this.turn ("size",a.width,a.height).turn ("update")); RETURN this },direction : FUNCTION (a) { var b=this.DATA (); IF (void 0===a) RETURN b.direction; a=a.toLowerCase (); IF (-1==f.inArray (a,V)) throw p ('"'+a+'" is not a value for direction'); "rtl"==a && f (this).attr ("dir","ltr").css ({ direction : "ltr" }); b.direction=a; b.done && this.turn ("size",f (this).width (),f (this).height ()); RETURN this },animating : FUNCTION () { RETURN 0< this.DATA ().pageMv.length },corner : FUNCTION () { var a,b,c=this.DATA (); FOR (b IN c.pages) IF (n (b,c.pages) && (a=c.pages [ b ].flip ("corner"))) RETURN a; RETURN ! 1 },DATA : FUNCTION () { RETURN this.DATA () },DISABLE : FUNCTION (a) { var b,c=this.DATA (),d=this.turn ("view"); c.disabled=void 0===a || ! 0===a; FOR (b IN c.pages) n (b,c.pages) && c.pages [ b ].flip ("disable",c.disabled ? ! 0 :-1==f.inArray (parseInt (b,10),d)); RETURN this },disabled : FUNCTION (a) { RETURN void 0===a ? ! 0===this.DATA ().disabled : this.turn ("disable",a) },size : FUNCTION (a,b) { IF (void 0===a || void 0===b) RETURN { width : this.width (),height : this.height () }; this.turn ("stop"); var c,d,e=this.DATA (); d="double"==e.display ? a/2 : a; this.css ({ width : a,height : b }); e.pageObjs [ 0 ] && e.pageObjs [ 0 ].css ({ width : d,height : b }); FOR (c IN e.pageWrap) n (c,e.pageWrap) && (d=g._pageSize.CALL (this,c,! 0),e.pageObjs [ c ].css ({ width : d.width,height : d.height }),e.pageWrap [ c ].css (d),e.pages [ c ] && e.pages [ c ].css ({ width : d.width,height : d.height })); this.turn ("resize"); RETURN this },resize : FUNCTION () { var a,b=this.DATA (); b.pages [ 0 ] && (b.pageWrap [ 0 ].css ({ LEFT :-this.width () }),b.pages [ 0 ].flip ("resize",! 0)); FOR (a=1; a<=b.totalPages; a++) b.pages [ a ] && b.pages [ a ].flip ("resize",! 0); g._updateShadow.CALL (this); b.opts.autoCenter && this.turn ("center") },_removeMv : FUNCTION (a) { var b,c=this.DATA (); FOR (b=0; b< c.pageMv.length; b++) IF (c.pageMv [ b ]==a) RETURN c.pageMv.splice (b,1),! 0; RETURN ! 1 },_addMv : FUNCTION (a) { var b=this.DATA (); g._removeMv.CALL (this,a); b.pageMv.push (a) },_view : FUNCTION (a) { var b=this.DATA (),a=a || b.page; RETURN "double"==b.display ? a % 2 ? [ a-1,a ] : [ a,a+1 ] : [ a ] },VIEW : FUNCTION (a) { var b=this.DATA (),a=g._view.CALL (this,a); RETURN "double"==b.display ? [ 0< a [ 0 ] ? a [ 0 ] : 0,a [ 1 ]<=b.totalPages ? a [ 1 ] : 0 ] : [ 0< a [ 0 ] && a [ 0 ]<=b.totalPages ? a [ 0 ] : 0 ] },STOP : FUNCTION (a,b) { IF (this.turn ("animating")) { var c,d,e,h=this.DATA (); h.tpage && (h.page=h.tpage,DELETE h.tpage); FOR (c=0; c< h.pageMv.length; c++) h.pageMv [ c ] && h.pageMv [ c ] !==a && (e=h.pages [ h.pageMv [ c ]],d=e.DATA ().f.opts,e.flip ("hideFoldedPage",b),b || i._moveFoldingPage.CALL (e,! 1),d.FORCE && (d.next=0===d.page % 2 ? d.page-1 : d.page+1,DELETE d.FORCE)) } this.turn ("update"); RETURN this },pages : FUNCTION (a) { var b=this.DATA (); IF (a) { IF (a< b.totalPages) FOR (var c=b.totalPages; c> a; c--) this.turn ("removePage",c); b.totalPages=a; g._fitPage.CALL (this,b.page); RETURN this } RETURN b.totalPages },_missing : FUNCTION (a) { var b=this.DATA (); IF (! (1> b.totalPages)) { FOR (var c=this.turn ("range",a),d=[],a=c [ 0 ]; a<=c [ 1 ]; a++) b.pageObjs [ a ] || d.push (a); 0< d.length && this.TRIGGER ("missing",[ d ]) } },_fitPage : FUNCTION (a) { var b=this.DATA (),c=this.turn ("view",a); g._missing.CALL (this,a); IF (b.pageObjs [ a ]) { b.page=a; this.turn ("stop"); FOR (var d=0; d< c.length; d++) c [ d ] && b.pageZoom [ c [ d ]] !=b.zoom && (this.TRIGGER ("zoomed",[ c [ d ],c,b.pageZoom [ c [ d ]],b.zoom ]),b.pageZoom [ c [ d ]]=b.zoom); g._removeFromDOM.CALL (this); g._makeRange.CALL (this); g._updateShadow.CALL (this); this.TRIGGER ("turned",[ a,c ]); this.turn ("update"); b.opts.autoCenter && this.turn ("center") } },_turnPage : FUNCTION (a) { var b,c,d=this.DATA (),e=d.pagePlace [ a ],h=this.turn ("view"),i=this.turn ("view",a); IF (d.page !=a) { var j=d.page; IF ("prevented"==s ("turning",this,[ a,i ])) { j==d.page &&-1 !=f.inArray (e,d.pageMv) && d.pages [ e ].flip ("hideFoldedPage",! 0); RETURN }-1 !=f.inArray (1,i) && this.TRIGGER ("first");-1 !=f.inArray (d.totalPages,i) && this.TRIGGER ("last") } "single"==d.display ? (b=h [ 0 ],c=i [ 0 ]) : h [ 1 ] && a> h [ 1 ] ? (b=h [ 1 ],c=i [ 0 ]) : h [ 0 ] && a< h [ 0 ] && (b=h [ 0 ],c=i [ 1 ]); e=d.opts.turnCorners.split (","); h=d.pages [ b ].DATA ().f; i=h.opts; j=h.point; g._missing.CALL (this,a); d.pageObjs [ a ] && (this.turn ("stop"),d.page=a,g._makeRange.CALL (this),d.tpage=c,i.next !=c && (i.next=c,i.FORCE=! 0),this.turn ("update"),h.point=j,"hard"==h.effect ? "ltr"==d.direction ? d.pages [ b ].flip ("turnPage",a> b ? "r" : "l") : d.pages [ b ].flip ("turnPage",a> b ? "l" : "r") : "ltr"==d.direction ? d.pages [ b ].flip ("turnPage",e [ a> b ? 1 : 0 ]) : d.pages [ b ].flip ("turnPage",e [ a> b ? 0 : 1 ])) },page : FUNCTION (a) { var b=this.DATA (); IF (void 0===a) RETURN b.page; IF (! b.disabled && ! b.destroying) { a=parseInt (a,10); IF (0< a && a<=b.totalPages) RETURN a !=b.page && (! b.done ||-1 !=f.inArray (a,this.turn ("view")) ? g._fitPage.CALL (this,a) : g._turnPage.CALL (this,a)),this; throw p ("The page "+a+" does not exist"); } },next : FUNCTION () { RETURN this.turn ("page",Math.min(this.DATA ().totalPages,g._view.CALL (this,this.DATA ().page).pop ()+1)) },previous : FUNCTION () { RETURN this.turn ("page",Math.max(1,g._view.CALL (this,this.DATA ().page).shift ()-1)) },peel : FUNCTION (a,b) { var c=this.DATA (),d=this.turn ("view"),b=void 0===b ? ! 0 : ! 0===b; ! 1===a ? this.turn ("stop",NULL,b) : "single"==c.display ? c.pages [ c.page ].flip ("peel",a,b) : (d="ltr"==c.direction ?-1 !=a.indexOf ("l") ? d [ 0 ] : d [ 1 ] :-1 !=a.indexOf ("l") ? d [ 1 ] : d [ 0 ],c.pages [ d ] && c.pages [ d ].flip ("peel",a,b)); RETURN this },_addMotionPage : FUNCTION () { var a=f (this).DATA ().f.opts,b=a.turn; b.DATA (); g._addMv.CALL (b,a.page) },_eventStart : FUNCTION (a,b,c) { var d=b.turn.DATA (),e=d.pageZoom [ b.page ]; a.isDefaultPrevented () || (e && e !=d.zoom && (b.turn.TRIGGER ("zoomed",[ b.page,b.turn.turn ("view",b.page),e,d.zoom ]),d.pageZoom [ b.page ]=d.zoom),"single"==d.display && c && ("l"==c.charAt (1) && "ltr"==d.direction || "r"==c.charAt (1) && "rtl"==d.direction ? (b.next=b.next< b.page ? b.next : b.page-1,b.FORCE=! 0) : b.next=b.next> b.page ? b.next : b.page+1),g._addMotionPage.CALL (a.target)); g._updateShadow.CALL (b.turn) },_eventEnd : FUNCTION (a,b,c) { f (a.target).DATA (); var a=b.turn,d=a.DATA (); IF (c) { IF (c=d.tpage || d.page,c==b.next || c==b.page) DELETE d.tpage,g._fitPage.CALL (a,c || b.next,! 0) } ELSE g._removeMv.CALL (a,b.page),g._updateShadow.CALL (a),a.turn ("update") },_eventPressed : FUNCTION (a) { var a=f (a.target).DATA ().f,b=a.opts.turn; b.DATA ().mouseAction=! 0; b.turn ("update"); RETURN a.time=(new Date).getTime () },_eventReleased : FUNCTION (a,b) { var c; c=f (a.target); var d=c.DATA ().f,e=d.opts.turn,h=e.DATA (); c="single"==h.display ? "br"==b.corner || "tr"==b.corner ? b.x< c.width ()/2 : b.x> c.width ()/2 : 0> b.x || b.x> c.width (); IF (200> (new Date).getTime ()-d.time || c) a.preventDefault (),g._turnPage.CALL (e,d.opts.next); h.mouseAction=! 1 },_flip : FUNCTION (a) { a.stopPropagation (); a=f (a.target).DATA ().f.opts; a.turn.TRIGGER ("turn",[ a.next ]); a.turn.DATA ().opts.autoCenter && a.turn.turn ("center",a.next) },_touchStart : FUNCTION () { var a=this.DATA (),b; FOR (b IN a.pages) IF (n (b,a.pages) && ! 1===i._eventStart.apply (a.pages [ b ],arguments)) RETURN ! 1 },_touchMove : FUNCTION () { var a=this.DATA (),b; FOR (b IN a.pages) n (b,a.pages) && i._eventMove.apply (a.pages [ b ],arguments) },_touchEnd : FUNCTION () { var a=this.DATA (),b; FOR (b IN a.pages) n (b,a.pages) && i._eventEnd.apply (a.pages [ b ],arguments) },calculateZ : FUNCTION (a) { var b,c,d,e,h=this,f=this.DATA (); b=this.turn ("view"); var i=b [ 0 ] || b [ 1 ],g=a.length-1,j={ pageZ : {},partZ : {},pageV : {} },k=FUNCTION (a) { a=h.turn ("view",a); a [ 0 ] && (j.pageV [ a [ 0 ]]=! 0); a [ 1 ] && (j.pageV [ a [ 1 ]]=! 0) }; FOR (b=0; b<=g; b++) c=a [ b ],d=f.pages [ c ].DATA ().f.opts.next,e=f.pagePlace [ c ],k (c),k (d),c=f.pagePlace [ d ]==d ? d : c,j.pageZ [ c ]=f.totalPages-Math.abs(i-c),j.partZ [ e ]=2*f.totalPages-g+b; RETURN j },UPDATE : FUNCTION () { var a,b=this.DATA (); IF (this.turn ("animating") && 0 !==b.pageMv [ 0 ]) { var c,d=this.turn ("calculateZ",b.pageMv),e=this.turn ("corner"),h=this.turn ("view"),i=this.turn ("view",b.tpage); FOR (a IN b.pageWrap) IF (n (a,b.pageWrap) && (c=b.pageObjs [ a ].hasClass ("fixed"),b.pageWrap [ a ].css ({ display : d.pageV [ a ] || c ? "" : "none",zIndex : (b.pageObjs [ a ].hasClass ("hard") ? d.partZ [ a ] : d.pageZ [ a ]) || (c ?-1 : 0) }),c=b.pages [ a ])) c.flip ("z",d.partZ [ a ] || NULL),d.pageV [ a ] && c.flip ("resize"),b.tpage ? c.flip ("hover",! 1).flip ("disable",-1==f.inArray (parseInt (a,10),b.pageMv) && a !=i [ 0 ] && a !=i [ 1 ]) : c.flip ("hover",! 1===e).flip ("disable",a !=h [ 0 ] && a !=h [ 1 ]) } ELSE FOR (a IN b.pageWrap) n (a,b.pageWrap) && (d=g._setPageLoc.CALL (this,a),b.pages [ a ] && b.pages [ a ].flip ("disable",b.disabled || 1 !=d).flip ("hover",! 0).flip ("z",NULL)); RETURN this },_updateShadow : FUNCTION () { var a,b,c=this.DATA (),d=this.width (),e=this.height (),h="single"==c.display ? d : d/2; a=this.turn ("view"); c.shadow || (c.shadow=f ("<div />",{ "class" : "shadow",css : l (0,0,0).css }).appendTo (this)); FOR (var i=0; i< c.pageMv.length && a [ 0 ] && a [ 1 ]; i++) a=this.turn ("view",c.pages [ c.pageMv [ i ]].DATA ().f.opts.next),b=this.turn ("view",c.pageMv [ i ]),a [ 0 ]=a [ 0 ] && b [ 0 ],a [ 1 ]=a [ 1 ] && b [ 1 ]; switch (a [ 0 ] ? a [ 1 ] ? 3 : "ltr"==c.direction ? 2 : 1 : "ltr"==c.direction ? 1 : 2) { CASE 1 : c.shadow.css ({ width : h,height : e,top : 0,LEFT : h }); break; CASE 2 : c.shadow.css ({ width : h,height : e,top : 0,LEFT : 0 }); break; CASE 3 : c.shadow.css ({ width : d,height : e,top : 0,LEFT : 0 }) } },_setPageLoc : FUNCTION (a) { var b=this.DATA (),c=this.turn ("view"),d=0; IF (a==c [ 0 ] || a==c [ 1 ]) d=1; ELSE IF ("single"==b.display && a==c [ 0 ]+1 || "double"==b.display && a==c [ 0 ]-2 || a==c [ 1 ]+2) d=2; IF (! this.turn ("animating")) switch (d) { CASE 1 : b.pageWrap [ a ].css ({ zIndex : b.totalPages,display : "" }); break; CASE 2 : b.pageWrap [ a ].css ({ zIndex : b.totalPages-1,display : "" }); break; CASE 0 : b.pageWrap [ a ].css ({ zIndex : 0,display : b.pageObjs [ a ].hasClass ("fixed") ? "" : "none" }) } RETURN d },OPTIONS : FUNCTION (a) { IF (void 0===a) RETURN this.DATA ().opts; var b=this.DATA (); f.extend (b.opts,a); a.pages && this.turn ("pages",a.pages); a.page && this.turn ("page",a.page); a.display && this.turn ("display",a.display); a.direction && this.turn ("direction",a.direction); a.width && a.height && this.turn ("size",a.width,a.height); IF (a.WHEN) FOR (var c IN a.WHEN) n (c,a.WHEN) && this.unbind (c).bind (c,a.WHEN [ c ]); RETURN this },version : FUNCTION () { RETURN "4.1.0" } },i={ init : FUNCTION (a) { this.DATA ({ f : { disabled : ! 1,hover : ! 1,effect : this.hasClass ("hard") ? "hard" : "sheet" } }); this.flip ("options",a); i._addPageWrapper.CALL (this); RETURN this },setData : FUNCTION (a) { var b=this.DATA (); b.f=f.extend (b.f,a); RETURN this },OPTIONS : FUNCTION (a) { var b=this.DATA ().f; RETURN a ? (i.setData.CALL (this,{ opts : f.extend ({},b.opts || X,a) }),this) : b.opts },z : FUNCTION (a) { var b=this.DATA ().f; b.opts [ "z-index" ]=a; b.fwrapper && b.fwrapper.css ({ zIndex : a || parseInt (b.parent.css ("z-index"),10) || 0 }); RETURN this },_cAllowed : FUNCTION () { var a=this.DATA ().f,b=a.opts.page,c=a.opts.turn.DATA (),d=b % 2; RETURN "hard"==a.effect ? "ltr"==c.direction ? [ d ? "r" : "l" ] : [ d ? "l" : "r" ] : "single"==c.display ? 1==b ? "ltr"==c.direction ? o.forward : o.backward : b==c.totalPages ? "ltr"==c.direction ? o.backward : o.forward : o.ALL : "ltr"==c.direction ? o [ d ? "forward" : "backward" ] : o [ d ? "backward" : "forward" ] },_cornerActivated : FUNCTION (a) { var b=this.DATA ().f,c=this.width (),d=this.height (),a={ x : a.x,y : a.y,corner : "" },e=b.opts.cornerSize; IF (0>=a.x || 0>=a.y || a.x>=c || a.y>=d) RETURN ! 1; var h=i._cAllowed.CALL (this); switch (b.effect) { CASE "hard" : IF (a.x> c-e) a.corner="r"; ELSE IF (a.x< e) a.corner="l"; ELSE RETURN ! 1; break; CASE "sheet" : IF (a.y< e) a.corner+="t"; ELSE IF (a.y>=d-e) a.corner+="b"; ELSE RETURN ! 1; IF (a.x<=e) a.corner+="l"; ELSE IF (a.x>=c-e) a.corner+="r"; ELSE RETURN ! 1 } RETURN ! a.corner ||-1==f.inArray (a.corner,h) ? ! 1 : a },_isIArea : FUNCTION (a) { var b=this.DATA ().f.parent.OFFSET (),a=t && a.originalEvent ? a.originalEvent.touches [ 0 ] : a; RETURN i._cornerActivated.CALL (this,{ x : a.pageX-b.LEFT,y : a.pageY-b.top }) },_c : FUNCTION (a,b) { b=b || 0; switch (a) { CASE "tl" : RETURN j (b,b); CASE "tr" : RETURN j (this.width ()-b,b); CASE "bl" : RETURN j (b,this.height ()-b); CASE "br" : RETURN j (this.width ()-b,this.height ()-b); CASE "l" : RETURN j (b,0); CASE "r" : RETURN j (this.width ()-b,0) } },_c2 : FUNCTION (a) { switch (a) { CASE "tl" : RETURN j (2*this.width (),0); CASE "tr" : RETURN j (-this.width (),0); CASE "bl" : RETURN j (2*this.width (),this.height ()); CASE "br" : RETURN j (-this.width (),this.height ()); CASE "l" : RETURN j (2*this.width (),0); CASE "r" : RETURN j (-this.width (),0) } },_foldingPage : FUNCTION () { var a=this.DATA ().f; IF (a) { var b=a.opts; IF (b.turn) RETURN a=b.turn.DATA (),"single"==a.display ? 1< b.next || 1< b.page ? a.pageObjs [ 0 ] : NULL : a.pageObjs [ b.next ] } },_backGradient : FUNCTION () { var a=this.DATA ().f,b=a.opts.turn.DATA (); IF ((b=b.opts.gradients && ("single"==b.display || 2 !=a.opts.page && a.opts.page !=b.totalPages-1)) && ! a.bshadow) a.bshadow=f ("<div/>",l (0,0,1)).css ({ position : "",width : this.width (),height : this.height () }).appendTo (a.parent); RETURN b },type : FUNCTION () { RETURN this.DATA ().f.effect },resize : FUNCTION (a) { var b=this.DATA ().f,c=b.opts.turn.DATA (),d=this.width (),e=this.height (); switch (b.effect) { CASE "hard" : a && (b.WRAPPER.css ({ width : d,height : e }),b.fpage.css ({ width : d,height : e }),c.opts.gradients && (b.ashadow.css ({ width : d,height : e }),b.bshadow.css ({ width : d,height : e }))); break; CASE "sheet" : a && (a=Math.round(Math.sqrt(Math.pow(d,2)+Math.pow(e,2))),b.WRAPPER.css ({ width : a,height : a }),b.fwrapper.css ({ width : a,height : a }).children (":first-child").css ({ width : d,height : e }),b.fpage.css ({ width : d,height : e }),c.opts.gradients && b.ashadow.css ({ width : d,height : e }),i._backGradient.CALL (this) && b.bshadow.css ({ width : d,height : e })),b.parent.IS (":visible") && (c=C (b.parent [ 0 ]),b.fwrapper.css ({ top : c.top,LEFT : c.LEFT }),c=C (b.opts.turn [ 0 ]),b.fparent.css ({ top :-c.top,LEFT :-c.LEFT })),this.flip ("z",b.opts [ "z-index" ]) } },_addPageWrapper : FUNCTION () { var a=this.DATA ().f,b=a.opts.turn.DATA (),c=this.parent (); a.parent=c; IF (! a.WRAPPER) switch (a.effect) { CASE "hard" : var d={}; d [ v+"transform-style" ]="preserve-3d"; d [ v+"backface-visibility" ]="hidden"; a.WRAPPER=f ("<div/>",l (0,0,2)).css (d).appendTo (c).prepend (this); a.fpage=f ("<div/>",l (0,0,1)).css (d).appendTo (c); b.opts.gradients && (a.ashadow=f ("<div/>",l (0,0,0)).hide ().appendTo (c),a.bshadow=f ("<div/>",l (0,0,0))); break; CASE "sheet" : var d=this.width (),e=this.height (); Math.round(Math.sqrt(Math.pow(d,2)+Math.pow(e,2))); a.fparent=a.opts.turn.DATA ().fparent; a.fparent || (d=f ("<div/>",{ css : { "pointer-events" : "none" } }).hide (),d.DATA ().flips=0,d.css (l (0,0,"auto","visible").css).appendTo (a.opts.turn),a.opts.turn.DATA ().fparent=d,a.fparent=d); this.css ({ position : "absolute",top : 0,LEFT : 0,bottom : "auto",RIGHT : "auto" }); a.WRAPPER=f ("<div/>",l (0,0,this.css ("z-index"))).appendTo (c).prepend (this); a.fwrapper=f ("<div/>",l (c.OFFSET ().top,c.OFFSET ().LEFT)).hide ().appendTo (a.fparent); a.fpage=f ("<div/>",l (0,0,0,"visible")).css ({ CURSOR : "default" }).appendTo (a.fwrapper); b.opts.gradients && (a.ashadow=f ("<div/>",l (0,0,1)).appendTo (a.fpage)); i.setData.CALL (this,a) } i.resize.CALL (this,! 0) },_fold : FUNCTION (a) { var b=this.DATA ().f,c=b.opts.turn.DATA (),d=i._c.CALL (this,a.corner),e=this.width (),h=this.height (); switch (b.effect) { CASE "hard" : a.x="l"==a.corner ? Math.min(Math.max(a.x,0),2*e) : Math.max(Math.min(a.x,e),-e); var f,g,r,w,k,n=c.totalPages,l=b.opts [ "z-index" ] || n,p={ overflow : "visible" },o=d.x ? (d.x-a.x)/e : a.x/e,q=90*o,s=90> q; switch (a.corner) { CASE "l" : w="0% 50%"; k="100% 50%"; s ? (f=0,g=0< b.opts.next-1,r=1) : (f="100%",g=b.opts.page+1< n,r=0); break; CASE "r" : w="100% 50%",k="0% 50%",q=-q,e=-e,s ? (f=0,g=b.opts.next+1< n,r=0) : (f="-100%",g=1 !=b.opts.page,r=1) } p [ v+"perspective-origin" ]=k; b.WRAPPER.transform ("rotateY("+q+"deg)translate3d(0px, 0px, "+(this.attr ("depth") || 0)+"px)",k); b.fpage.transform ("translateX("+e+"px) rotateY("+(180+q)+"deg)",w); b.parent.css (p); s ? (o=-o+1,b.WRAPPER.css ({ zIndex : l+1 }),b.fpage.css ({ zIndex : l })) : (o-=1,b.WRAPPER.css ({ zIndex : l }),b.fpage.css ({ zIndex : l+1 })); c.opts.gradients && (g ? b.ashadow.css ({ display : "",LEFT : f,backgroundColor : "rgba(0,0,0,"+0.5*o+")" }).transform ("rotateY(0deg)") : b.ashadow.hide (),b.bshadow.css ({ opacity :-o+1 }),s ? b.bshadow.parent () [ 0 ] !=b.WRAPPER [ 0 ] && b.bshadow.appendTo (b.WRAPPER) : b.bshadow.parent () [ 0 ] !=b.fpage [ 0 ] && b.bshadow.appendTo (b.fpage),O (b.bshadow,j (100*r,0),j (100*(-r+1),0),[[ 0,"rgba(0,0,0,0.3)" ],[ 1,"rgba(0,0,0,0)" ]],2)); break; CASE "sheet" : var t=this,G=0,y,z,A,L,x,M,C,u=j (0,0),P=j (0,0),m=j (0,0),I=i._foldingPage.CALL (this); Math.tan(0); var N=c.opts.acceleration,Q=b.WRAPPER.height (),D="t"==a.corner.substr(0,1),B="l"==a.corner.substr(1,1),H=FUNCTION () { var b=j (0,0),f=j (0,0); b.x=d.x ? d.x-a.x : a.x; b.y=T ? d.y ? d.y-a.y : a.y : 0; f.x=B ? e-b.x/2 : a.x+b.x/2; f.y=b.y/2; var g=K-Math.atan2(b.y,b.x),k=g-Math.atan2(f.y,f.x),k=Math.max(0,Math.sin(k)*Math.sqrt(Math.pow(f.x,2)+Math.pow(f.y,2))); G=180*(g/J); m=j (k*Math.sin(g),k*Math.cos(g)); IF (g> K && (m.x+=Math.abs(m.y*b.y/b.x),m.y=0,Math.round(m.x*Math.tan(J-g))< h)) RETURN a.y=Math.sqrt(Math.pow(h,2)+2*f.x*b.x),D && (a.y=h-a.y),H (); IF (g> K && (b=J-g,f=Q-h/Math.sin(b),u=j (Math.round(f*Math.cos(b)),Math.round(f*Math.sin(b))),B && (u.x=-u.x),D)) u.y=-u.y; y=Math.round(m.y/Math.tan(g)+m.x); b=e-y; f=b*Math.cos(2*g); k=b*Math.sin(2*g); P=j (Math.round(B ? b-f : y+f),Math.round(D ? k : h-k)); IF (c.opts.gradients && (x=b*Math.sin(g),b=i._c2.CALL (t,a.corner),b=Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2))/e,C=Math.sin(K*(1< b ? 2-b : b)),M=Math.min(b,1),L=100< x ? (x-100)/x : 0,z=j (100*(x*Math.sin(g)/e),100*(x*Math.cos(g)/h)),i._backGradient.CALL (t) && (A=j (100*(1.2*x*Math.sin(g)/e),100*(1.2*x*Math.cos(g)/h)),B || (A.x=100-A.x),! D))) A.y=100-A.y; m.x=Math.round(m.x); m.y=Math.round(m.y); RETURN ! 0 }; f=FUNCTION (a,d,f,g) { var k=[ "0","auto" ],m=(e-Q)*f [ 0 ]/100,l=(h-Q)*f [ 1 ]/100,d={ LEFT : k [ d [ 0 ]],top : k [ d [ 1 ]],RIGHT : k [ d [ 2 ]],bottom : k [ d [ 3 ]] },k={},n=90 !=g &&-90 !=g ? B ?-1 : 1 : 0,r=f [ 0 ]+"% "+f [ 1 ]+"%"; t.css (d).transform (F (g)+E (a.x+n,a.y,N),r); b.fpage.css (d).transform (F (g)+E (a.x+P.x-u.x-e*f [ 0 ]/100,a.y+P.y-u.y-h*f [ 1 ]/100,N)+F ((180/g-2)*g),r); b.WRAPPER.transform (E (-a.x+m-n,-a.y+l,N)+F (-g),r); b.fwrapper.transform (E (-a.x+u.x+m,-a.y+u.y+l,N)+F (-g),r); c.opts.gradients && (f [ 0 ] && (z.x=100-z.x),f [ 1 ] && (z.y=100-z.y),k [ "box-shadow" ]="0 0 20px rgba(0,0,0,"+0.5*C+")",I.css (k),O (b.ashadow,j (B ? 100 : 0,D ? 0 : 100),j (z.x,z.y),[[ L,"rgba(0,0,0,0)" ],[ 0.8*(1-L)+L,"rgba(0,0,0,"+0.2*M+")" ],[ 1,"rgba(255,255,255,"+0.2*M+")" ]],3,0),i._backGradient.CALL (t) && O (b.bshadow,j (B ? 0 : 100,D ? 0 : 100),j (A.x,A.y),[[ 0.6,"rgba(0,0,0,0)" ],[ 0.8,"rgba(0,0,0,"+0.3*M+")" ],[ 1,"rgba(0,0,0,0)" ]],3)) }; switch (a.corner) { CASE "tl" : a.x=Math.max(a.x,1); H (); f (m,[ 1,0,0,1 ],[ 100,0 ],G); break; CASE "tr" : a.x=Math.min(a.x,e-1); H (); f (j (-m.x,m.y),[ 0,0,0,1 ],[ 0,0 ],-G); break; CASE "bl" : a.x=Math.max(a.x,1); H (); f (j (m.x,-m.y),[ 1,1,0,0 ],[ 100,100 ],-G); break; CASE "br" : a.x=Math.min(a.x,e-1),H (),f (j (-m.x,-m.y),[ 0,1,1,0 ],[ 0,100 ],G) } } b.point=a },_moveFoldingPage : FUNCTION (a) { var b=this.DATA ().f; IF (b) { var c=b.opts.turn,d=c.DATA (),e=d.pagePlace; a ? (d=b.opts.next,e [ d ] !=b.opts.page && (b.folding && i._moveFoldingPage.CALL (this,! 1),i._foldingPage.CALL (this).appendTo (b.fpage),e [ d ]=b.opts.page,b.folding=d),c.turn ("update")) : b.folding && (d.pages [ b.folding ] ? (c=d.pages [ b.folding ].DATA ().f,d.pageObjs [ b.folding ].appendTo (c.WRAPPER)) : d.pageWrap [ b.folding ] && d.pageObjs [ b.folding ].appendTo (d.pageWrap [ b.folding ]),b.folding IN e && (e [ b.folding ]=b.folding),DELETE b.folding) } },_showFoldedPage : FUNCTION (a,b) { var c=i._foldingPage.CALL (this),d=this.DATA (),e=d.f,f=e.visible; IF (c) { IF (! f || ! e.point || e.point.corner !=a.corner) IF (c="hover"==e.STATUS || "peel"==e.STATUS || e.opts.turn.DATA ().mouseAction ? a.corner : NULL,f=! 1,"prevented"==s ("start",this,[ e.opts,c ])) RETURN ! 1; IF (b) { var g=this,d=e.point && e.point.corner==a.corner ? e.point : i._c.CALL (this,a.corner,1); this.animatef ({ FROM : [ d.x,d.y ],TO : [ a.x,a.y ],duration : 500,frame : FUNCTION (b) { a.x=Math.round(b [ 0 ]); a.y=Math.round(b [ 1 ]); i._fold.CALL (g,a) } }) } ELSE i._fold.CALL (this,a),d.effect && ! d.effect.turning && this.animatef (! 1); IF (! f) switch (e.effect) { CASE "hard" : e.visible=! 0; i._moveFoldingPage.CALL (this,! 0); e.fpage.SHOW (); e.opts.shadows && e.bshadow.SHOW (); break; CASE "sheet" : e.visible=! 0,e.fparent.SHOW ().DATA ().flips++,i._moveFoldingPage.CALL (this,! 0),e.fwrapper.SHOW (),e.bshadow && e.bshadow.SHOW () } RETURN ! 0 } RETURN ! 1 },hide : FUNCTION () { var a=this.DATA ().f,b=a.opts.turn.DATA (),c=i._foldingPage.CALL (this); switch (a.effect) { CASE "hard" : b.opts.gradients && (a.bshadowLoc=0,a.bshadow.REMOVE (),a.ashadow.hide ()); a.WRAPPER.transform (""); a.fpage.hide (); break; CASE "sheet" : 0===--a.fparent.DATA ().flips && a.fparent.hide (),this.css ({ LEFT : 0,top : 0,RIGHT : "auto",bottom : "auto" }).transform (""),a.WRAPPER.transform (""),a.fwrapper.hide (),a.bshadow && a.bshadow.hide (),c.transform ("") } a.visible=! 1; RETURN this },hideFoldedPage : FUNCTION (a) { var b=this.DATA ().f; IF (b.point) { var c=this,d=b.point,e=FUNCTION () { b.point=NULL; b.STATUS=""; c.flip ("hide"); c.TRIGGER ("end",[ b.opts,! 1 ]) }; IF (a) { var f=i._c.CALL (this,d.corner),a="t"==d.corner.substr(0,1) ? Math.min(0,d.y-f.y)/2 : Math.max(0,d.y-f.y)/2,g=j (d.x,d.y+a),l=j (f.x,f.y-a); this.animatef ({ FROM : 0,TO : 1,frame : FUNCTION (a) { a=R (d,g,l,f,a); d.x=a.x; d.y=a.y; i._fold.CALL (c,d) },complete : e,duration : 800,hiding : ! 0 }) } ELSE this.animatef (! 1),e () } },turnPage : FUNCTION (a) { var b=this,c=this.DATA ().f,d=c.opts.turn.DATA (),a={ corner : c.corner ? c.corner.corner : a || i._cAllowed.CALL (this) [ 0 ] },e=c.point || i._c.CALL (this,a.corner,c.opts.turn ? d.opts.elevation : 0),f=i._c2.CALL (this,a.corner); this.TRIGGER ("flip").animatef ({ FROM : 0,TO : 1,frame : FUNCTION (c) { c=R (e,e,f,f,c); a.x=c.x; a.y=c.y; i._showFoldedPage.CALL (b,a) },complete : FUNCTION () { b.TRIGGER ("end",[ c.opts,! 0 ]) },duration : d.opts.duration,turning : ! 0 }); c.corner=NULL },moving : FUNCTION () { RETURN "effect" IN this.DATA () },isTurning : FUNCTION () { RETURN this.flip ("moving") && this.DATA ().effect.turning },corner : FUNCTION () { RETURN this.DATA ().f.corner },_eventStart : FUNCTION (a) { var b=this.DATA ().f,c=b.opts.turn; IF (! b.corner && ! b.disabled && ! this.flip ("isTurning") && b.opts.page==c.DATA ().pagePlace [ b.opts.page ]) { b.corner=i._isIArea.CALL (this,a); IF (b.corner && i._foldingPage.CALL (this)) RETURN this.TRIGGER ("pressed",[ b.point ]),i._showFoldedPage.CALL (this,b.corner),! 1; b.corner=NULL } },_eventMove : FUNCTION (a) { var b=this.DATA ().f; IF (! b.disabled) IF (a=t ? a.originalEvent.touches : [ a ],b.corner) { var c=b.parent.OFFSET (); b.corner.x=a [ 0 ].pageX-c.LEFT; b.corner.y=a [ 0 ].pageY-c.top; i._showFoldedPage.CALL (this,b.corner) } ELSE IF (b.hover && ! this.DATA ().effect && this.IS (":visible")) IF (a=i._isIArea.CALL (this,a [ 0 ])) { IF ("sheet"==b.effect && 2==a.corner.length || "hard"==b.effect) b.STATUS="hover",b=i._c.CALL (this,a.corner,b.opts.cornerSize/2),a.x=b.x,a.y=b.y,i._showFoldedPage.CALL (this,a,! 0) } ELSE "hover"==b.STATUS && (b.STATUS="",i.hideFoldedPage.CALL (this,! 0)) },_eventEnd : FUNCTION () { var a=this.DATA ().f,b=a.corner; ! a.disabled && b && "prevented" !=s ("released",this,[ a.point || b ]) && i.hideFoldedPage.CALL (this,! 0); a.corner=NULL },DISABLE : FUNCTION (a) { i.setData.CALL (this,{ disabled : a }); RETURN this },hover : FUNCTION (a) { i.setData.CALL (this,{ hover : a }); RETURN this },peel : FUNCTION (a,b) { var c=this.DATA ().f; IF (a) { IF (-1==f.inArray (a,o.ALL)) throw p ("Corner "+a+" is not permitted"); IF (-1 !=f.inArray (a,i._cAllowed.CALL (this))) { var d=i._c.CALL (this,a,c.opts.cornerSize/2); c.STATUS="peel"; i._showFoldedPage.CALL (this,{ corner : a,x : d.x,y : d.y },b) } } ELSE c.STATUS="",i.hideFoldedPage.CALL (this,b); RETURN this } }; window.requestAnim=window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || FUNCTION (a) { window.setTimeout (a,1E3/60) }; f.extend (f.fn,{ flip : FUNCTION () { RETURN I (f (this [ 0 ]),i,arguments) },turn : FUNCTION () { RETURN I (f (this [ 0 ]),g,arguments) },transform : FUNCTION (a,b) { var c={}; b && (c [ v+"transform-origin" ]=b); c [ v+"transform" ]=a; RETURN this.css (c) },animatef : FUNCTION (a) { var b=this.DATA (); b.effect && b.effect.STOP (); IF (a) { a.TO.length || (a.TO=[ a.TO ]); a.FROM.length || (a.FROM=[ a.FROM ]); FOR (var c=[],d=a.TO.length,e=! 0,g=this,i=(new Date).getTime (),j=FUNCTION () { IF (b.effect && e) { FOR (var f=[],k=Math.min(a.duration,(new Date).getTime ()-i),l=0; l< d; l++) f.push (b.effect.easing (1,k,a.FROM [ l ],c [ l ],a.duration)); a.frame (d==1 ? f [ 0 ] : f); IF (k==a.duration) { DELETE b.effect; g.DATA (b); a.complete && a.complete () } ELSE window.requestAnim (j) } },l=0; l< d; l++) c.push (a.TO [ l ]-a.FROM [ l ]); b.effect=f.extend ({ STOP : FUNCTION () { e=FALSE },easing : FUNCTION (a,b,c,d,e) { RETURN d*Math.sqrt(1-(b=b/e-1)*b)+c } },a); this.DATA (b); j () } ELSE DELETE b.effect } }); f.isTouch=t; f.mouseEvents=q; f.cssPrefix=S; f.cssTransitionEnd=FUNCTION () { var a,b=document.createElement ("fakeelement"),c={ transition : "transitionend",OTransition : "oTransitionEnd",MSTransition : "transitionend",MozTransition : "transitionend",WebkitTransition : "webkitTransitionEnd" }; FOR (a IN c) IF (void 0 !==b.style [ a ]) RETURN c [ a ] }; f.findPos=C }) (jQuery);