Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed an issue with the page turn reverse

  • Loading branch information...
commit 9b064d710e34d1dc07ab86b9767fd61f58977426 1 parent 0e97625
Matt Lantz authored
View
4 build/alice.js
@@ -1822,7 +1822,7 @@ alice.plugins.caterpillar = (function () {
numZ = "0",
piggy = document.createElement('div');
- piggy.style = myPageStyle;
+ piggy.setAttribute("style", myPageStyle);
piggy.setAttribute('id', '_piggy');
piggy.setAttribute('class', document.getElementById(pageName+id).getAttribute('class'));
piggy.style[alice.prefix+'backfaceVisibility'] = 'visible';
@@ -2545,7 +2545,7 @@ alice.plugins.caterpillar = (function () {
}else{
if(runState === "paused"){
alice.plugins.caterpillar.abPageTurnR(dets);
- document.getElementById(config.bookName).setAttribute('data-page-number', (pageNum-1));
+ document.getElementById(config.bookName).setAttribute('data-page-number', pageNum);
}
}
}else{
View
4 build/alice.min.js
@@ -41,5 +41,5 @@
// (c) 2010 tinyHippos inc.
// jWorkflow is freely distributable under the terms of the MIT license.
// Portions of jWorkflow are inspired by Underscore.js
-var jWorkflow=function(){function e(e){if(typeof e!="function")throw"expected function but was "+typeof e}function t(e){return typeof e.andThen=="function"&&typeof e.start=="function"&&typeof e.chill=="function"}function n(e){return!!e.map&&!!e.reduce}var r={order:function(r,i){var s=[],o,u=null,a=function(){var e=!1;return{take:function(){e=!0},pass:function(t){var n;e=!1,o.length?(n=o.shift(),t=n.func.apply(n.context,[t,a]),e||a.pass(t)):u.func&&u.func.apply(u.context,[t])},drop:function(t){e=!0,o=[],setTimeout(function(){a.pass(t)},1)}}}(),f={andThen:function(r,i){if(t(r)){var o=function(e,t){t.take(),r.start({callback:function(e){t.pass(e)},context:i,initialValue:e})};s.push({func:o,context:i})}else if(n(r)){var u=function(e,t){t.take();var n=r.length,i=function(){return--n||t.pass()};r.forEach(function(e){jWorkflow.order(e).start(i)})};s.push({func:u,context:i})}else e(r),s.push({func:r,context:i});return f},chill:function(e){return f.andThen(function(t,n){n.take(),setTimeout(function(){n.pass(t)},e)})},start:function(){var e,t,n;arguments[0]&&typeof arguments[0]=="object"?(e=arguments[0].callback,t=arguments[0].context,n=arguments[0].initialValue):(e=arguments[0],t=arguments[1]),u={func:e,context:t},o=s.slice(),a.pass(n)}};return r?f.andThen(r,i):f}};return r}();typeof module=="object"&&typeof require=="function"&&(module.exports=jWorkflow);var alice=function(){"use strict";var e={id:"alice",name:"AliceJS",description:"A Lightweight Independent CSS Engine",version:"0.5",build:"20121101-1034",prefix:"",prefixJS:"",elems:null,cleaner:{},format:{},helper:{},plugins:{},anima:null,debug:!1,elements:function(e){var t,n=[],r=function(e,t){Array.prototype.forEach.apply(e,[t])},i=function(e){n.push(e)},s=function(e){if(typeof e!="string")return[];var t=document.getElementById(e);return t?[t]:document.querySelectorAll(e)};if(typeof e=="string")if(e.indexOf("$")===0)if(e.indexOf("#")>-1)t=e.substring(e.indexOf("#")+1,e.indexOf("')")),r(s(t),i);else{if(!(e.indexOf(".")>-1)){console.warn("jQuery selectors must be either classes or ids.");return}t=e.substring(e.indexOf(".")+1,e.indexOf("')")),r(s(t),i)}else r(s(e),i);else e.length===undefined?n.push(e):r(e,function(e){e.nodeType&&e.nodeType!==3?n.push(e):r(s(e),i)});return n},randomize:function(e,t){var n,r,i=parseInt(e,10);return typeof t=="string"&&t.indexOf("%")>-1?n=parseInt(t,10)/100:n=parseFloat(t,10),r=i+i*(Math.random()*2*n-n),Math.floor(r)},duration:function(e){var t,n=function(e){return e},r=function(e){var t;return e.indexOf("ms")>-1?t=parseInt(e,10):e.indexOf("s")>-1?t=parseFloat(e,10)*1e3:t=parseInt(e,10),t},i=function(e){var t;return e.value&&(typeof e.value=="string"?t=r(e.value):t=n(e.value)),t};switch(typeof e){case"number":t=n(e);break;case"string":t=r(e);break;case"object":t=i(e);break;default:t=e}return t},coords:function(e){var t={"top-left":{x:"0%",y:"0%"},"top-center":{x:"50%",y:"0%"},"top-right":{x:"100%",y:"0%"},"middle-left":{x:"0%",y:"50%"},"middle-center":{x:"50%",y:"50%"},"middle-right":{x:"100%",y:"50%"},"bottom-left":{x:"0%",y:"100%"},"bottom-center":{x:"50%",y:"100%"},"bottom-right":{x:"100%",y:"100%"},top:{x:"50%",y:"0%"},left:{x:"0%",y:"50%"},center:{x:"50%",y:"50%"},right:{x:"100%",y:"50%"},bottom:{x:"50%",y:"100%"},NW:{x:"0%",y:"0%"},N:{x:"50%",y:"0%"},NE:{x:"100%",y:"0%"},W:{x:"0%",y:"50%"},E:{x:"100%",y:"50%"},SW:{x:"0%",y:"100%"},S:{x:"50%",y:"100%"},SE:{x:"100%",y:"100%"},"":{x:"50%",y:"50%"},"undefined":{x:"50%",y:"50%"}};return t[e]},easing:function(e){var t={linear:{p1:.25,p2:.25,p3:.75,p4:.75},ease:{p1:.25,p2:.1,p3:.25,p4:1},"ease-in":{p1:.42,p2:0,p3:1,p4:1},"ease-out":{p1:0,p2:0,p3:.58,p4:1},"ease-in-out":{p1:.42,p2:0,p3:.58,p4:1},easeInQuad:{p1:.55,p2:.085,p3:.68,p4:.53},easeInCubic:{p1:.55,p2:.055,p3:.675,p4:.19},easeInQuart:{p1:.895,p2:.03,p3:.685,p4:.22},easeInQuint:{p1:.755,p2:.05,p3:.855,p4:.06},easeInSine:{p1:.47,p2:0,p3:.745,p4:.715},easeInExpo:{p1:.95,p2:.05,p3:.795,p4:.035},easeInCirc:{p1:.6,p2:.04,p3:.98,p4:.335},easeInBack:{p1:.6,p2:-0.28,p3:.735,p4:.045},easeOutQuad:{p1:.25,p2:.46,p3:.45,p4:.94},easeOutCubic:{p1:.215,p2:.61,p3:.355,p4:1},easeOutQuart:{p1:.165,p2:.84,p3:.44,p4:1},easeOutQuint:{p1:.23,p2:1,p3:.32,p4:1},easeOutSine:{p1:.39,p2:.575,p3:.565,p4:1},easeOutExpo:{p1:.19,p2:1,p3:.22,p4:1},easeOutCirc:{p1:.075,p2:.82,p3:.165,p4:1},easeOutBack:{p1:.175,p2:.885,p3:.32,p4:1.275},easeInOutQuad:{p1:.455,p2:.03,p3:.515,p4:.955},easeInOutCubic:{p1:.645,p2:.045,p3:.355,p4:1},easeInOutQuart:{p1:.77,p2:0,p3:.175,p4:1},easeInOutQuint:{p1:.86,p2:0,p3:.07,p4:1},easeInOutSine:{p1:.445,p2:.05,p3:.55,p4:.95},easeInOutExpo:{p1:1,p2:0,p3:0,p4:1},easeInOutCirc:{p1:.785,p2:.135,p3:.15,p4:.86},easeInOutBack:{p1:.68,p2:-0.55,p3:.265,p4:1.55},custom:{p1:0,p2:.35,p3:.5,p4:1.3},random:{p1:Math.random().toPrecision(3),p2:Math.random().toPrecision(3),p3:Math.random().toPrecision(3),p4:Math.random().toPrecision(3)}};return t[e]?t[e]:{p1:.42,p2:0,p3:.58,p4:1}},flip:function(e,t,n){var r=t||1,i,s=function(e){return{start:0,end:e,axis:"Y"}},o=function(t){switch(e){case"left":return{start:0,end:-360*r,axis:"Y"};case"right":return{start:0,end:360*r,axis:"Y"};case"up":return{start:0,end:360*r,axis:"X"};case"down":return{start:0,end:-360*r,axis:"X"}}},u=function(e){var t;return e.value&&(typeof e.value=="string"?t=o(e.value):t=s(e.value)),t};switch(typeof e){case"number":i=s(e);break;case"string":i=o(e);break;case"object":i=u(e);break;default:i=null}return i},percentage:function(e){var t;return typeof e=="string"?e.indexOf("%")>-1||e.indexOf("°")>-1?t=parseInt(e,10)/100:e>=1||e<=-1?t=parseInt(e,10)/100:t=parseFloat(e,10):typeof e=="number"&&(e>=1||e<=-1?t=e/100:t=e),t},vendorPrefix:function(){var e=document.createElement("div");"webkitAnimation"in e.style?(this.prefix="-webkit-",this.prefixJS="webkit"):"MozAnimation"in e.style?(this.prefix="-moz-",this.prefixJS="Moz"):"msAnimation"in e.style?(this.prefix="-ms-",this.prefixJS="ms"):"OAnimation"in e.style||"OTransform"in e.style?(this.prefix="-o-",this.prefixJS="O"):(this.prefix="",this.prefixJS=""),this.debug&&console.log("prefix="+this.prefix,"prefixJS="+this.prefixJS);return},docHeight:function(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))},pixel:function(e,t){if(typeof e=="number")return e%1===0?e:parseFloat(e,10)*t;if(e.indexOf("px")>-1)return parseInt(e,10);if(e.indexOf("%")>-1)return Math.round(parseInt(e,10)/100*t)},keyframeInsert:function(e){if(document.styleSheets&&document.styleSheets.length){var t=0;try{document.styleSheets[0].cssRules.length>0&&(t=document.styleSheets[0].cssRules.length),document.styleSheets[0].insertRule(e,t)}catch(n){console.warn(n.message,e)}}else{var r=document.createElement("style");r.innerHTML=e,document.head.appendChild(r)}return},keyframeDelete:function(e){var t=document.all?"rules":"cssRules",n;for(n=0;n<document.styleSheets[0][t].length;n+=1)if(document.styleSheets[0][t][n].name===e){document.styleSheets[0].deleteRule(n),this.debug&&console.log("Deleted keyframe: "+e);break}return},clearAnimation:function(e){this.style[this.prefixJS+"AnimationName"]=" ",this.style[this.prefixJS+"AnimationDelay"]=" ",this.style[this.prefixJS+"AnimationDuration"]=" ",this.style[this.prefixJS+"AnimationTimingFunction"]=" ",this.style[this.prefixJS+"AnimationIterationCount"]=" ",this.style[this.prefixJS+"AnimationDirection"]=" ",this.style[this.prefixJS+"AnimationPlayState"]=" ",alice.keyframeDelete(e.animationName);return},init:function(t){console.info("Initializing "+this.name+" ("+this.description+") "+this.version),this.vendorPrefix(),t&&t.elems&&(this.elems=this.elements(t.elems));if(t&&t.workflow===!0){console.log("jWorkflow: enabled");var n=t&&t.id?t.id:"",r=jWorkflow.order(),i={delay:function(e){return r.chill(e),i},log:function(e){return r.andThen(function(){console.log(e)}),i},custom:function(e){return r.andThen(e),i},start:function(){r.start(function(){console.info("workflow.start")})}};return Array.prototype.forEach.call(Object.keys(e.plugins),function(t){var s=e.plugins[t];i[t]=function(){var e=arguments;return r.andThen(function(){s.apply(document.getElementById(n),e)}),i}}),i}return console.log("jWorkflow: disabled"),e.plugins}};return e}();alice.format={duration:function(e){"use strict";var t=0,n=0,r=0;return t=alice.duration(e),r=t,e.randomness&&(n=alice.randomize(t,alice.percentage(e.randomness)),r=Math.abs(n)),r+"ms"},easing:function(e){"use strict";var t=alice.easing(e),n="cubic-bezier("+t.p1+", "+t.p2+", "+t.p3+", "+t.p4+")";return n},coords:function(e){"use strict";var t=alice.coords(e),n=t.x+" "+t.y;return n},oppositeNumber:function(e){"use strict";return-e}},alice.helper={duration:function(e,t,n){"use strict";return e&&e.offset?t?t=parseInt(t,10)+parseInt(e.offset,10):t=parseInt(alice.format.duration(n),10):t=parseInt(alice.format.duration(n),10),t+="ms",t},rotation:function(e,t){"use strict";var n=e;return t.randomness&&(n=alice.randomize(n,alice.percentage(t.randomness))),n}},alice.cleaner={removeAni:function(e){"use strict";var t,n;document.addEventListener(alice.prefixJS+"AnimationEnd",function(){n=alice.elements(e);for(t=0;t<n.length;t++)document.getElementById(n[t].getAttribute("id")).removeAttribute("style")},!1)},removeElems:function(e){"use strict";var t,n;document.addEventListener(alice.prefixJS+"AnimationEnd",function(){n=alice.elements(e);for(t=0;t<n.length;t++){var r=document.getElementById(n[t].getAttribute("id"));r.parentNode.removeChild(r)}},!1)}};var alicejs=alice.init();alice.plugins.cheshire=function(e){"use strict";console.info("cheshire",e);var t=e.delay||"0ms",n=e.duration||"2000ms",r=e.timing||"ease",i=e.iteration||1,s=e.direction||"normal",o=e.playstate||"running",u=e.perspective||"1000",a=e.perspectiveOrigin||"center",f=e.backfaceVisibility||"visible",l=alice.percentage(e.overshoot)||0,c=85,h=e.rotate||0,p=e.turns||1,d=alice.flip(e.flip,p,l),v=e.fade&&e.fade!==""?e.fade:null,m=v&&v==="out"?1:0,g=v&&v==="out"?0:1,y=e.scale&&e.scale.from?alice.percentage(e.scale.from):1,b=e.scale&&e.scale.to?alice.percentage(e.scale.to):1,w=e.shadow||!1,E="",S="",x=1,T=0,N=e.posEnd||0,C=N+x*Math.floor(N*l),k=e.cleanUp||"partial",L={},A,O,M,_,D,P,H,B,j,F,I,q,R,U;e.cleanUp==="partial"?alice.cleaner.removeAni(e.elems):e.cleanUp==="total"&&alice.cleaner.removeElems(e.elems),O=alice.elements(e.elems);if(O&&O.length>0)for(_=0;_<O.length;_+=1){M=O[_],A=M.parentElement||M.parentNode,L.delay=alice.helper.duration(e.delay,L.delay,t),L.duration=alice.helper.duration(e.duration,L.duration,n),L.rotate=alice.helper.rotation(h,e),L.rotateStart=alice.percentage(L.rotate)*100,L.rotateOver=l*100,L.rotateEnd=0,D=alice.id+"-cheshire-"+(new Date).getTime()+"-"+Math.floor(Math.random()*1e6);if(e.move){q=e.move.direction||e.move;switch(q){case"left":E="Left",S="X",x=-1,R=window.innerWidth,T=e.move.start?alice.pixel(e.move.start,R):R,N=e.move.end?alice.pixel(e.move.end,R):0,C=x*Math.floor(T*l);break;case"right":E="Right",S="X",x=1,R=document.body.offsetWidth-M.clientWidth,T=e.move.start?alice.pixel(e.move.start,R):0,N=e.move.end?alice.pixel(e.move.end,R):R,C=N+x*Math.floor(N*l);break;case"up":E="Up",S="Y",x=-1,R=window.innerHeight,T=e.move.start?alice.pixel(e.move.start,R):R,N=e.move.end?alice.pixel(e.move.end,R):0,C=x*Math.floor(T*l);break;case"down":E="Down",S="Y",x=1,R=alice.docHeight()-A.clientHeight*3,T=e.move.start?alice.pixel(e.move.start,R):0,N=e.move.end?alice.pixel(e.move.end,R):R,C=N+x*Math.floor(N*l),alice.debug&&console.log(alice.docHeight(),window.innerHeight,window.pageYOffset,A.clientHeight)}}H="",H+=d?" rotate"+d.axis+"("+d.start+"deg)":" translate"+S+"("+T+"px)",H+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateStart+"deg)":"",H+=" scale("+y+")",B="",B+=d?" rotate"+d.axis+"("+Math.floor((1+l)*d.end)+"deg)":" translate"+S+"("+C+"px)",B+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateOver+"deg)":"",B+=b>1?" scale("+b+")":"",B+=" scale("+b+")",j="",j+=d?" rotate"+d.axis+"("+d.end+"deg)":" translate"+S+"("+N+"px)",E===""&&s==="alternate"?j+=" rotate("+ -L.rotateStart+"deg)":j+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateEnd+"deg)":"",j+=" scale("+b+")",w===!0&&b>1&&(U=Math.round(b*10),F=" 0px 0px 0px rgba(0, 0, 0, 1)",I=" "+U+"px "+U+"px "+U+"px rgba(0, 0, 0, 0.5)"),P="",P+="@"+alice.prefix+"keyframes "+D+" {\n",P+=" 0% {\n",P+=" "+alice.prefix+"transform:"+H+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=v?" opacity: "+m+";"+"\n":"",P+=w===!0&&b>1?" "+alice.prefix+"box-shadow: "+F+";"+"\n":"",P+=" }\n",l!==0&&(P+=" "+c+"% {\n",P+=" "+alice.prefix+"transform:"+B+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=" }\n"),P+=" 100% {\n",P+=" "+alice.prefix+"transform:"+j+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=v?" opacity: "+g+";"+"\n":"",P+=w===!0&&b>1?" "+alice.prefix+"box-shadow: "+I+";"+"\n":"",P+=" }\n",P+="}\n",console.log(P),alice.keyframeInsert(P),A.style[alice.prefixJS+"Perspective"]=u+"px",A.style[alice.prefixJS+"PerspectiveOrigin"]=alice.format.coords(a),M.style[alice.prefixJS+"BackfaceVisibility"]=f,M.style[alice.prefixJS+"AnimationName"]=D,M.style[alice.prefixJS+"AnimationDelay"]=L.delay,M.style[alice.prefixJS+"AnimationDuration"]=L.duration,M.style[alice.prefixJS+"AnimationTimingFunction"]=alice.format.easing(r),M.style[alice.prefixJS+"AnimationIterationCount"]=i,M.style[alice.prefixJS+"AnimationDirection"]=s,M.style[alice.prefixJS+"AnimationPlayState"]=o,M.style[alice.prefixJS+"Transform"]=j,M.style.opacity=v?g:"",M.style[alice.prefixJS+"BoxShadow"]=w===!0&&b>1?I:"","MozAnimation"in M.style?M.addEventListener("animationend",alice.clearAnimation,!1):M.addEventListener(alice.prefixJS+"AnimationEnd",alice.clearAnimation,!1),alice.debug&&(console.log(P),console.log(A.style),console.log(M.id,alice.prefixJS,M.style,M.style.cssText,M.style[alice.prefixJS+"AnimationDuration"],M.style[alice.prefixJS+"AnimationTimingFunction"]))}else console.warn("No elements!");return e},alice.plugins.bounce=function(e){"use strict";console.info("bounce: ",arguments),e||(e="");var t={from:"100%",to:"150%"};e.scale&&(typeof e.scale=="object"?t=e.scale:t.to=e.scale);var n={elems:e.elems||alice.anima,scale:t,shadow:e.shadow||!0,duration:e.duration||"750ms",timing:e.timing||"easeOutSine",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.dance=function(e){"use strict";console.info("dance: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,rotate:e.rotate||45,duration:e.duration||"750ms",timing:e.timing||"easeInOutBack",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.drain=function(e){"use strict";console.info("drain: ",arguments),e||(e="");var t={scale:e.fade==="in"?{from:"0%",to:"100%"}:{from:"100%",to:"0%"},elems:e.elems||alice.anima,rotate:e.rotate||-2880,duration:e.duration||"4500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.fade=function(e){"use strict";console.info("fade: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,fade:e.fade||"in",duration:e.duration||"4500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.hinge=function(e){"use strict";console.info("hinge: ",arguments),e||(e="");var t={perspectiveOrigin:"top-left",elems:e.elems||alice.anima,rotate:e.rotate||25,overshoot:e.overshoot||0,duration:e.duration||"1000ms",timing:e.timing||"linear",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.pageFlip=function(e){"use strict";console.info("pageFlip: ",arguments),e||(e="");var t="";switch(e.flipDirection){case"right":t="right";break;case"up":t="top";break;case"down":t="bottom"}var n={perspectiveOrigin:t||"left",elems:e.elems||alice.anima,flip:e.flipDirection||"left",turns:e.turns||1,overshoot:e.overshoot||0,duration:e.duration||"2000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.pendulum=function(e){"use strict";console.info("pendulum: ",arguments),e||(e="");var t={perspectiveOrigin:"top",elems:e.elems||alice.anima,rotate:e.rotate||45,overshoot:e.overshoot||0,duration:e.duration||"2000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.phantomZone=function(e){"use strict";console.info("phantomZone: ",arguments),e||(e="");var t={scale:e.fade==="in"?{from:"1%",to:"100%"}:{from:"100%",to:"1%"},elems:e.elems||alice.anima,rotate:e.rotate||-720,flip:e.flip||"left",duration:e.duration||"5000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.raceFlag=function(e){"use strict";console.info("raceFlag: ",arguments),e||(e="");var t={flip:"down",elems:e.elems||alice.anima,rotate:e.rotate||-720,perspectiveOrigin:e.perspectiveOrigin||"top-right",duration:e.duration||"3000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.slide=function(e){"use strict";console.info("slide: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,move:e.move||"left",overshoot:e.overshoot||"0",duration:e.duration||"4000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.spin=function(e){"use strict";console.info("spin: ",arguments),e||(e="");var t={perspectiveOrigin:"center",direction:"normal",elems:e.elems||alice.anima,flip:e.flip||"left",turns:e.turns||1,overshoot:e.overshoot||0,duration:e.duration||"1200ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.toss=function(e){"use strict";console.info("toss: ",arguments),e||(e="");var t={rotate:e.move==="left"||e.move==="down"?720:-720,elems:e.elems||alice.anima,move:e.move||"right",overshoot:e.overshoot||0,perspectiveOrigin:e.perspectiveOrigin||"center",duration:e.duration||"2500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.twirl=function(e){"use strict";console.info("twirl: ",arguments),e||(e="");var t={rotate:e.flip==="left"?-135:135,elems:e.elems||alice.anima,flip:e.flip||"left",duration:e.duration||"3000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.wobble=function(e){"use strict";console.info("wobble: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,rotate:e.rotate||5,perspectiveOrigin:e.perspectiveOrigin||"center",duration:e.duration||"200ms",timing:e.timing||"linear",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.zoom=function(e){"use strict";console.info("zoom: ",arguments),e||(e="");var t={from:"1%",to:"125%"};e.scale&&(typeof e.scale=="object"?t=e.scale:t.to=scale);var n={elems:e.elems||alice.anima,scale:t,shadow:e.shadow||!0,move:e.move||"none",duration:e.duration||"2000ms",timing:e.timing||"ease",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.caterpillar=function(){"use strict";var e={docWidth:function(){var e=document.body.clientWidth;return e},docHeight:alice.docHeight(),_rot270:"(262deg)",_rot180:"(180deg)",_rot90:"(90deg)",_rot0:"(0deg)",_rotNeg90:"(-90deg)",_rotNeg180:"(-180deg)",_rotNeg270:"(-262deg)",originZero:"",onPageTrigger:"",helper:{getThisId:function(e){var t=e.substring(e.indexOf("_")+1,e.length);return t=parseInt(t,10),t},setAnimationDefaults:function(e,t){e.style[alice.prefixJS+"AnimationDuration"]=t,e.style[alice.prefixJS+"AnimationFillMode"]="forwards",e.style[alice.prefixJS+"AnimationPlayState"]="running",e.style[alice.prefixJS+"AnimationDirection"]="normal",e.style[alice.prefixJS+"AnimationTimingFunction"]="linear",e.style.display="block"},findCSSRule:function(e){var t,n,r,i,s,o,u;t=document.styleSheets.length;for(n=0;n<t;n++){r=document.styleSheets[n],r.rules?u=r.rules:u=r.cssRules,u=r.cssRules?r.cssRules:r.rules;for(i=0;i<u.length;i++)if(u[i].selectorText==e)return s=u[i].style.width.toString(),o=u[i].style.height.toString(),[s,o]}},piggyback:function(t,n,r,i,s,o,u,a,f,l){t===0&&(t=f);var c=document.getElementById(i),h=document.getElementById(r+t).style,p=n==="standard"?r+"abstrPageTurnF":r+"abstrPageReTurnF",d="0",v=document.createElement("div");v.style=h,v.setAttribute("id","_piggy"),v.setAttribute("class",document.getElementById(r+t).getAttribute("class")),v.style[alice.prefix+"backfaceVisibility"]="visible",v.style.width=c.style.width,v.style.height=c.style.height,v.style.position="absolute",v.style.background=l||"#222",v.style.top="0px",v.style.left="0px";if(n==="advanced"){var m;m=e._rot270;switch(u){case"left":m=e._rotNeg270;break;case"bottom":m=e._rotNeg270}v.style[alice.prefixJS+"Transform"]=a+m}v.style.zIndex=d,v.style[alice.prefixJS+"AnimationName"]=p,v.style[alice.prefixJS+"TransformOrigin"]=o,v.style[alice.prefixJS+"AnimationDuration"]=s,v.style[alice.prefixJS+"AnimationFillMode"]="forwards",v.style[alice.prefixJS+"AnimationPlayState"]="running",v.style[alice.prefixJS+"AnimationDirection"]="normal",v.style[alice.prefixJS+"AnimationTimingFunction"]="linear",v.style.display="block",c.appendChild(v)}},AnimGenerator:function(t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M;l="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot90+";",c="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot270+";",h="\n "+alice.prefix+"transform: "+t.transformRotate+e._rotNeg270+";",p="\n "+alice.prefix+"transform: "+t.transformRotate+e._rotNeg90+";",d="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot0+";",v="\n "+alice.prefix+"transform-origin: "+t.originZero+";",m="\n "+alice.prefix+"transform-origin: 50% 50%;",g="\n "+alice.prefix+"transform-origin: "+t.transformOrigin+";",y=" 0%{"+alice.prefix+"box-shadow:"+t.shadowPattern0+";",b=" 50%{"+alice.prefix+"box-shadow:"+t.shadowPattern50+";",w=" 100%{"+alice.prefix+"box-shadow:"+t.shadowPattern100+";",E="50%{"+alice.prefix+"box-shadow:"+t.shadowPatternRev50+";"+"\n",S="100%{"+alice.prefix+"box-shadow:"+t.shadowPatternRev100+";"+"\n",x="@"+alice.prefix+"keyframes "+t.bookName+"p_oddPageTurnF{\n",T="@"+alice.prefix+"keyframes "+t.bookName+"p_oddPageTurnR{\n",N="@"+alice.prefix+"keyframes "+t.bookName+"p_evenPageTurnF{\n",C="@"+alice.prefix+"keyframes "+t.bookName+"p_evenPageTurnR{\n",k="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageTurnF{\n",L="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageTurnR{\n",A="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageReTurnF{\n",O="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageReTurnR{\n",M="}\n",t.paging==="single"&&(t.binding==="left"&&(s=k+y+M+b+M+w+v+h+M+"\n"+M,i=L+y+M+b+M+w+v+d+M+"\n"+M,r=A+y+M+b+M+w+v+d+M+"\n"+M,n=O+y+M+b+M+w+v+d+M+"\n"+M),t.binding==="right"&&(s=k+y+M+b+M+w+g+c+M+"\n"+M,i=L+y+M+b+M+w+g+d+M+"\n"+M,r=A+y+M+b+M+w+g+d+M+"\n"+M,n=O+y+M+b+M+w+g+d+M+"\n"+M),t.binding==="top"&&(s=k+y+M+b+M+w+v+c+M+"\n"+M,i=L+y+M+b+M+w+v+d+M+"\n"+M,r=A+y+M+b+M+w+v+d+M+"\n"+M,n=O+y+M+b+M+w+v+d+M+"\n"+M),t.binding==="bottom"&&(s=k+y+M+b+M+w+g+h+M+"\n"+M,i=L+y+M+b+M+w+g+d+M+"\n"+M,r=A+y+M+b+M+w+g+d+M+"\n"+M,n=O+y+M+b+M+w+g+d+M+"\n"+M),t.binding==="center"&&(s=k+y+M+b+M+w+m+p+M+"\n"+M,i=L+y+M+b+M+w+m+d+M+"\n"+M,r=A+y+M+b+M+w+m+l+M+"\n"+M,n=O+y+M+b+M+w+m+d+M+"\n"+M),t.binding==="middle"&&(s=k+y+M+b+M+w+m+p+M+"\n"+M,i=L+y+M+b+M+w+m+d+M+"\n"+M,r=A+y+M+b+M+w+m+l+M+"\n"+M,n=O+y+M+b+M+w+m+d+M+"\n"+M),alice.keyframeInsert(s),alice.keyframeInsert(i),alice.keyframeInsert(r),alice.keyframeInsert(n)),t.paging==="double"&&(t.binding==="left"&&(o=x+y+M+b+M+w+v+p+M+"\n"+M,u=T+y+M+b+M+w+v+d+M+"\n"+M,a=N+E+M+S+g+d+M+"\n"+M,f=C+E+M+S+g+l+M+"\n"+M),t.binding==="right"&&(o=x+y+M+b+M+w+g+l+M+"\n"+M,u=T+y+M+b+M+w+g+d+M+"\n"+M,a=N+E+M+S+v+d+M+"\n"+M,f=C+E+M+S+v+p+M+"\n"+M),t.binding==="top"&&(o=x+y+M+b+M+w+v+l+M+"\n"+M,u=T+y+M+b+M+w+v+d+M+"\n"+M,a=N+E+M+S+g+d+M+"\n"+M,f=C+E+M+S+g+p+M+"\n"+M),t.binding==="bottom"&&(o=x+y+M+b+M+w+g+p+M+"\n"+M,u=T+y+M+b+M+w+g+d+M+"\n"+M,a=N+E+M+S+v+d+M+"\n"+M,f=C+E+M+S+v+l+M+"\n"+M),alice.keyframeInsert(o),alice.keyframeInsert(u),alice.keyframeInsert(a),alice.keyframeInsert(f))},clearSinglePages:function(t,n,r,i,s,o){var u,a,f,l=e.helper.getThisId(t),c=document.getElementById(t);document.getElementById("_piggy")&&(f=document.getElementById("_piggy").parentNode,f.removeChild(document.getElementById("_piggy")),document.getElementById(s.bookName).setAttribute("data-state","paused")),c.style[alice.prefixJS+"Animation"]="",c.style[alice.prefixJS+"AnimationDelay"]="",c.style[alice.prefixJS+"AnimationDuration"]="",c.style[alice.prefixJS+"AnimationTimingFunction"]="",c.style[alice.prefixJS+"AnimationIterationCount"]="",c.style[alice.prefixJS+"AnimationDirection"]="",c.style[alice.prefixJS+"AnimationPlayState"]="";if(s.binding==="center"||s.binding==="middle")o||(c.style.display="none");else if(s.binding==="left"||s.binding==="top"||s.binding==="right"||s.binding==="bottom")c.style.display="none";a=document.getElementById(r+(parseInt(l,10)-1)),u=document.getElementById(r+(parseInt(l,10)+1)),l===s.realPageCount&&(u=document.getElementById(r+"1")),c.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[0],c.style.zIndex="0",n==="forwards"&&(l===1?a=document.getElementById(r+s.realPageCount):l>1&&(s.binding==="left"||s.binding==="right"||s.binding==="top"||s.binding==="bottom")&&(u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[0]),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[1]);if(n==="reverse"){if(l>0){if(s.binding==="center"||s.binding==="middle")s.wrap===!0?l===1?a=document.getElementById(r+s.realPageCount):a=document.getElementById(r+(l-1)):l!==1&&(a=document.getElementById(r+(l-1))),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2];s.wrap===!0&&l!==s.realPageCount&&(u=document.getElementById(r+(parseInt(l,10)+1)));if(s.binding==="left"||s.binding==="top"||s.binding==="right"||s.binding==="bottom")u.style.display="none",c.style.display="block";u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2]}l===1&&(a=document.getElementById(s.pageName+s.realPageCount),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2],u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[1])}},clearDoublePages:function(t,n,r,i){var s,o,u=document.getElementById(r),a=e.helper.getThisId(r),f=document.getElementById(i.pageName+(parseInt(a,10)+1)),l="display: block; left: 0px; top: 0px;";if(a%2===1){u.setAttribute("style","");if(t==="forward"){u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,s=i.transformRotate+e._rot90;switch(i.binding){case"top":u.style.top=i.pageHeight+"px";break;case"right":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"left":s=i.transformRotate+e._rotNeg90,u.style.left=i.pageWidth+"px";break;case"bottom":s=i.transformRotate+e._rotNeg90,u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin}u.style[alice.prefixJS+"Transform"]=s}else if(t==="reverse"){u.setAttribute("style",l),u.style[alice.prefixJS+"TransformOrigin"]=i.originZero;switch(i.binding){case"top":u.style.top=i.pageHeight+"px";break;case"right":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"left":u.style.left=i.pageWidth+"px";break;case"bottom":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;default:u.style.top="0px"}}}if(a%2===0){u.setAttribute("style","");if(t==="forward"){u.setAttribute("style",l),u.style[alice.prefixJS+"TransformOrigin"]=i.originZero;switch(i.binding){case"top":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"right":u.style.left=i.pageWidth+"px";break;case"left":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin,u.style.left="0px";break;case"bottom":u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,u.style.top=i.pageHeight+"px"}u.style[alice.prefixJS+"Transform"]=e.transformRotate+e._rot0}else if(t==="reverse"){u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,o=e.transformRotate+e._rotNeg90;switch(i.binding){case"top":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"right":u.style.left=i.pageWidth+"px";break;case"bottom":o=i.transformRotate+e._rot90,u.style.top=i.pageHeight+"px";break;case"left":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin,o=i.transformRotate+e._rot90}u.style[alice.prefixJS+"Transform"]=o}}u.style[alice.prefixJS+"boxShadow"]=i.shadowPattern0},styleConfig:function(t){var n=document.getElementById(t.pageName+t.pageId);t.paging==="single"&&((t.binding==="center"||t.binding==="middle")&&n.setAttribute("style","display: none; "+alice.prefix+"transform-origin: 50% 50%;"+alice.prefix+"transform: "+t.transformRotate+e._rot90+";"+alice.prefix+"box-shadow: "+t.shadowPattern100+";"),(t.binding==="left"||t.binding==="top"||t.binding==="bottom"||t.binding==="right")&&n.setAttribute("style","display: none; "+alice.prefix+"transform-origin:"+t.transformOrigin+";"+alice.prefix+"transform: "+t.transformRotate+e._rot0+";"+alice.prefix+"box-shadow: "+t.shadowPattern100+";")),t.paging==="double"&&(t.binding==="left"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.left=t.pageWidth+"px"),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin,n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90)),t.binding==="right"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.left=t.pageWidth+"px",n.style[
-alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90)),t.binding==="top"&&(t.pageId%2===1&&(n.style.top=t.pageHeight+"px",n.style[alice.prefixJS+"TransformOrigin"]=t.originZero),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin,n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90)),t.binding==="bottom"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.top=t.pageHeight+"px",n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90)))},init:function(t){var n={},r,i,s,o,u,a,f,l,c,h,p,d;n.pages=[],n.realPageCount=0,n.speed=alice.duration(t.speed),n.book=document.getElementById(t.elems),n.bookName=n.book.id,n.timing=e.timing,n.binding=t.binding,n.piggyBg=t.piggyBg,n.originZero="0 0",n.pageClass=t.pageClass,n.pageName=t.elems+"p_",n.paging=t.paging,n.randomize=t.randomize,n.wrap=t.wrap,n.shadow=t.shadow,n.book.setAttribute("data-state","paused"),n.book.setAttribute("data-page-number","1"),n.bookSize=e.helper.findCSSRule("#"+n.book.getAttribute("id")),n.bookSize?(r=n.bookSize[0],i=n.bookSize[1]):(r=n.book.style.width,i=n.book.style.height),r.indexOf("%")>0?(s="%",o="0."+r.substring(0,r.indexOf(s)),o=parseFloat(o),u=n.docWidth()*o):r.indexOf("px")>0?(s="px",u=r.substring(0,r.indexOf(s))):u=r,n.pageWidth=u,i.indexOf("%")>0?(a="%",f="0."+i.substring(0,i.indexOf(a)),f=parseFloat(f),l=n.docHeight*f):i.indexOf("px")>0?(a="px",l=i.substring(0,i.indexOf(a))):l=i,n.pageHeight=l,n.goggles=Math.floor(n.pageWidth*4);if(n.shadow===!0){n.shadowPattern0="0px 0px 14px rgba(0, 0, 0, 0.1)",n.shadowPattern50="10px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPattern100="0px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPatternRev50="-10px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPatternRev100="0px 0px 14px rgba(0, 0, 0, 0.1)";if(n.binding==="center"||n.binding==="middle")n.shadowPattern50="0px 0px 14px rgba(0, 0, 0, 0.3)"}else n.shadowPattern0="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPattern50="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPattern100="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPatternRev50="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPatternRev100="0px 0px 0px rgba(0, 0, 0, 0)";n.NewPageClass=t.elems+(new Date).getTime(),e.animationEnd=alice.prefixJS+"AnimationEnd",alice.prefixJS==="Moz"&&(e.animationEnd="animationend"),c=n.book.childNodes,h=0;for(p=0;p<c.length;p++)if(c[p].nodeType===1){if(c[p].tagName!=="DIV"&&c[p].tagName!=="div")return console.error("Your pages must be all be the DIV tag element. Please place the contents inside."),!1;n.pages[h]=c[p],n.realPageCount=n.realPageCount+1,h++}n.book.style[alice.prefixJS+"Perspective"]=n.goggles+"px",n.book.style.zIndex="1000",n.book.style.position="relative",n.binding=t.binding;if(t.binding==="center"||t.binding==="left"||t.binding==="right")n.transformRotate="rotateY";if(t.binding==="middle"||t.binding==="top"||t.binding==="bottom")n.transformRotate="rotateX";if(t.paging==="single")n.book.style.width=n.pageWidth+"px",n.book.style.height=n.pageHeight+"px";else if(t.paging==="double")if(t.binding==="left"||t.binding==="right")n.book.style.width=n.pageWidth*2+"px",n.book.style.height=n.pageHeight+"px";else if(t.binding==="top"||t.binding==="bottom")n.book.style.width=n.pageWidth+"px",n.book.style.height=n.pageHeight*2+"px";if(t.paging==="single"){n.transformDegrees=[e._rot0,e._rot0,e._rot0];switch(t.binding){case"center":n.transformDegrees=[e._rot0,e._rot90,e._rotNeg90],n.transformOrigin="50% 50%";break;case"middle":n.transformDegrees=[e._rot0,e._rot90,e._rotNeg90],n.transformOrigin="50% 50%";break;case"left":n.transformOrigin=n.originZero;break;case"top":n.transformOrigin=n.originZero;break;case"right":n.transformOrigin=n.pageWidth+"px 0px";break;case"bottom":n.transformDegrees=[e._rot0,e._rot0,e._rotNeg270],n.transformOrigin="0px "+pageHeight+"px"}}if(n.paging==="double"){switch(t.binding){case"left":n.transformOrigin=n.pageWidth+"px 0px";break;case"right":n.transformOrigin=n.pageWidth+"px 0px";break;case"top":n.transformOrigin="0px "+n.pageHeight+"px";break;case"bottom":n.transformOrigin="0px "+n.pageHeight+"px"}n.transformDegrees=[e._rot0,e._rot0]}return n.pageClass=n.pageClass,e.onPageTrigger=document.createEvent("Event"),e.onPageTrigger.initEvent("onPageTrigger",!0,!0),e.AnimGenerator(n),e.pageBuilder(n),d={bookName:n.book.id,realPageCount:n.realPageCount,book:document.getElementById(n.bookName),pageNumber:function(){return parseInt(document.getElementById(n.bookName).getAttribute("data-page-number"),10)},nxtPage:function(){var t,r,i;t=this.pageNumber(),n.paging==="single"&&t<1&&(t=1),n.paging==="double"&&(t===0&&(document.getElementById(n.bookName).setAttribute("data-page-number","1"),t=this.pageNumber()),t%2!==1&&t++),r={pageId:t,pageName:n.pageName,bookName:n.bookName,binding:n.binding,wrap:n.wrap,speed:n.speed,randomizer:n.randomize,transformOrigin:n.transformOrigin,paging:n.paging,realPageCount:n.realPageCount,piggyBg:n.piggyBg},i=document.getElementById(n.bookName).getAttribute("data-state"),n.paging==="single"?n.binding!=="center"&&n.binding!=="middle"?t===n.realPageCount&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number","1")):t<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+1)):t===n.realPageCount&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number","1")):t<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+1)):(document.getElementById(n.bookName).getAttribute("data-page-number")<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.turnPage(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+2)),document.getElementById(n.bookName).getAttribute("data-page-number")>=n.realPageCount&&document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)),document.getElementById(n.bookName).dispatchEvent(e.onPageTrigger)},prePage:function(){var t,r,i;n.paging==="single"?t=this.pageNumber()-1:t=this.pageNumber(),n.paging==="double"&&t%2!==0&&t--,r={pageId:t,pageName:n.pageName,bookName:n.bookName,binding:n.binding,wrap:n.wrap,speed:n.speed,randomizer:n.randomize,transformOrigin:n.transformOrigin,paging:n.paging,realPageCount:n.realPageCount,transformRotate:n.transformRotate,originZero:n.originZero},i=document.getElementById(n.bookName).getAttribute("data-state"),n.paging==="single"?n.binding!=="center"&&n.binding!=="middle"?n.wrap===!0?t===0?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t-1)):t===1?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",1)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t)):t===0&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)):t>1?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",1)):t!==0?i==="paused"&&(alice.plugins.caterpillar.turnPage(r),document.getElementById(n.bookName).setAttribute("data-page-number",t-=2),t===0&&document.getElementById(n.bookName).setAttribute("data-page-number","1")):document.getElementById(n.bookName).setAttribute("data-page-number","1"),document.getElementById(n.bookName).dispatchEvent(e.onPageTrigger)},appendPages:function(t){var r=document.getElementById(n.bookName),i=n.realPageCount,s=n.paging,o=document.getElementById(n.bookName+"p_1"),u=document.getElementById(n.bookName+"p_2"),a=document.getElementById(t).childNodes,f=n.realPageCount+1,l=[];for(var c=0;c<a.length;c++)if(a[c].nodeType===1)if(a[c].tagName==="DIV"||a[c].tagName==="div"){if(f%2===1){var h=s==="single"?u:o;a[c].setAttribute("style",h.getAttribute("style"))}f%2===0&&a[c].setAttribute("style",u.getAttribute("style")),a[c].style.display="none",a[c].setAttribute("class",o.getAttribute("class")),a[c].setAttribute("id",n.pageName+f),e.eventListenerFunc(f,n),r.appendChild(a[c]),n.realPageCount=n.realPageCount+1,f++}}},d},eventListenerFunc:function(t,n){var r=document.getElementById(n.pageName+t);r.addEventListener(e.animationEnd,function(){if(n.paging==="single"){var r=n.pageName+t;this.style[alice.prefixJS+"AnimationName"]===n.pageName+"abstrPageTurnF"&&((n.binding==="center"||n.binding==="middle")&&alice.plugins.caterpillar.abstrPageFlip(r,"forwards",n.bookName,n),e.clearSinglePages(r,"forwards",n.pageName,n.bookName,n)),this.style[alice.prefixJS+"AnimationName"]===n.pageName+"abstrPageReTurnF"&&((n.binding==="center"||n.binding==="middle")&&alice.plugins.caterpillar.abstrPageFlip(r,"reverse",n.bookName,n),e.clearSinglePages(r,"reverse",n.pageName,n.bookName,n))}if(n.paging==="double"){this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_oddPageTurnF"&&(e.turnNextPage(this.getAttribute("id"),"odd",n.bookName,n),e.clearDoublePages("forward",n.binding,this.getAttribute("id"),n));if(this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_oddPageTurnR"){e.clearDoublePages("reverse",e.binding,this.getAttribute("id"),n),document.getElementById(n.bookName).setAttribute("data-state","paused");var i=e.helper.getThisId(this.getAttribute("id"));i=parseInt(i,10)+2,i<n.realPageCount+1&&(document.getElementById(n.pageName+i).style.display="none")}this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_evenPageTurnF"&&(e.clearDoublePages("forward",n.binding,this.getAttribute("id"),n),document.getElementById(n.bookName).setAttribute("data-state","paused")),this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_evenPageTurnR"&&(e.turnNextPage(this.getAttribute("id"),"even",n.bookName,n),e.clearDoublePages("reverse",n.binding,this.getAttribute("id"),n))}},!1)},pageBuilder:function(t){var n=t.pages[0].getAttribute("class"),r=n+" "+t.pageClass,i="."+t.NewPageClass+"{ display: none; "+alice.prefix+"box-shadow: "+t.shadowPattern100+";"+alice.prefix+"backface-visibility: hidden;"+"width: "+t.pageWidth+"px;"+"height: "+t.pageHeight+"px;"+"position: absolute;"+"border: none;"+"left: 0px;"+"top: 0px;"+"z-index: 0;"+"overflow: hidden;"+"}";alice.keyframeInsert(i);var s=1,o,u;for(u=0;u<t.pages.length;u++)t.pages[u].setAttribute("id",t.pageName+s),t.pages[u].setAttribute("class",r+" "+t.NewPageClass),e.eventListenerFunc(s,t),e.styleConfig({pageId:s,pageName:t.pageName,binding:t.binding,paging:t.paging,bookName:t.bookName,pageWidth:t.pageWidth,pageHeight:t.pageHeight,speed:t.speed,randomizer:t.randomize,transformOrigin:t.transformOrigin,transformRotate:t.transformRotate,originZero:t.originZero}),t.paging==="single"?s===1&&(t.pages[u].style.display="block",t.pages[u].setAttribute("style","display: block; z-index: 1;"+alice.prefix+"transform-origin:"+t.transformOrigin+";"+alice.prefix+"transform: "+t.transformRotate+e._rot0+";"+alice.prefix+"box-shadow: "+t.shadowPatternRev100+";")):t.paging==="double"&&s===1&&(t.pages[u].style.display="block",t.pages[u].style[alice.prefixJS+"BoxShadow"]=t.shadowPattern100+";"),s++;return e},abstrPageFlip:function(t,n,r,i){var s,o,u,a,f;n==="forwards"?(s=e.helper.getThisId(t)+1,o=r+"p_abstrPageTurnR",s===i.realPageCount+1&&(s=1)):n==="reverse"&&(o=r+"p_abstrPageReTurnR",s=e.helper.getThisId(t)-1),(i.binding==="center"||i.binding==="middle")&&s===0&&(s=i.realPageCount),u=i.book.querySelector("div:nth-child("+s+")").getAttribute("id"),a=document.getElementById(u),a.style[alice.prefixJS+"Transform"]=i.transformRotate+e._rotNeg90,e.styleConfig({pageId:s,pageName:i.pageName,binding:i.binding,paging:i.paging,bookName:i.bookName,wrap:i.wrap,animationRunning:!0,speed:i.speed,randomizer:i.randomize,transformOrigin:i.transformOrigin,transformRotate:i.transformRotate}),a.style[alice.prefixJS+"AnimationName"]=o,f=alice.randomize(alice.duration(i.speed),i.randomize)+"ms",e.helper.setAnimationDefaults(a,f),a.addEventListener(e.animationEnd,function(){a.style[alice.prefixJS+"AnimationName"]===o&&(e.clearSinglePages(u,n,i.pageName,i.bookName,i,"doNotHide"),document.getElementById(i.bookName).setAttribute("data-state","paused"))},!1)},abPageTurn:function(t){var n,r,i,s,o;n=t.pageId>=t.realPageCount?1:t.pageId+1;if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){t.pageId===0&&t.wrap===!0&&(t.binding==="center"||t.binding==="middle")&&(pageId=t.realPageCount),r=document.getElementById(t.pageName+t.pageId),i,s;try{t.pageId>=t.realPageCount&&t.wrap===!0&&(t.pageId=0),i=document.getElementById(t.bookName).querySelector("div:nth-child("+(t.pageId+1)+")").getAttribute("id"),s=document.getElementById(i),s.style.display="block";if(t.binding==="center"||t.binding==="middle")s.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90}catch(u){if(t.wrap!==!0)return console.log("This is the end of the book!"),!1}r.style.zIndex="100",r.style[alice.prefixJS+"AnimationName"]=t.pageName+"abstrPageTurnF",document.getElementById(t.bookName).setAttribute("data-state","running"),o=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(r,o),t.binding!=="center"&&t.binding!=="middle"&&e.helper.piggyback(t.pageId,"standard",t.pageName,t.bookName,o,t.transformOrigin,t.binding,t.transformRotate,t.realPageCount,t.piggyBg)}},abPageTurnR:function(t){if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){var n,r,i;(t.binding==="center"||t.binding==="middle")&&t.pageId!==0&&(r=document.getElementById(t.pageName+t.pageId),r.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90,t.pageId++),n=document.getElementById(t.pageName+t.pageId),t.binding!=="center"&&t.binding!=="middle"?t.pageId===0&&t.wrap===!0&&(n=document.getElementById(t.pageName+t.realPageCount),document.getElementById(t.bookName).setAttribute("data-page-number",t.realPageCount)):t.pageId===0&&t.wrap===!0&&(n=document.getElementById(t.pageName+"1"));try{n.style.zIndex="10"}catch(s){if(t.wrap!==!0)return console.log("This is the start of the book!"),!1}switch(t.binding){case"left":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg270;break;case"bottom":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg270;break;case"top":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot270;break;case"right":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot270}n.style[alice.prefixJS+"AnimationName"]=t.pageName+"abstrPageReTurnF",document.getElementById(t.bookName).setAttribute("data-state","running"),i=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(n,i),t.binding!=="center"&&t.binding!=="middle"&&e.helper.piggyback(t.pageId,"advanced",t.pageName,t.bookName,i,t.transformOrigin,t.binding,t.transformRotate,t.realPageCount,t.piggyBg)}},turnNextPage:function(t,n,r,i){var s,o,u,a,f;s=e.helper.getThisId(t),s=n==="odd"?s+1:s-1,a=n==="even"?r+"p_oddPageTurnR":r+"p_evenPageTurnF",o=document.getElementById(r).querySelector("div:nth-child("+s+")").getAttribute("id"),u=document.getElementById(o),u.style.zIndex=1,n==="odd"&&(u.style.display="block"),u.style[alice.prefixJS+"AnimationName"]=a,f=alice.randomize(alice.duration(i.speed),i.randomize)+"ms",e.helper.setAnimationDefaults(u,f)},turnPage:function(t){if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){var n,r,i,s,o,u,a;t.pageId%2===1?(n=t.pageId+2,r=t.bookName+"p_oddPageTurnF"):(n=t.pageId-2,r=t.bookName+"p_evenPageTurnR"),o=document.getElementById(t.bookName).querySelector("div:nth-child("+n+")"),o&&(o=o.getAttribute("id"),u=document.getElementById(o),u.style.zIndex="0",u.style.display="block"),i=document.getElementById(t.pageName+t.pageId),i.style.zIndex="1",i.style[alice.prefixJS+"AnimationName"]=r,document.getElementById(t.bookName).setAttribute("data-state","running"),a=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(i,a)}}};return e}(),alice.plugins.book=function(e){"use strict";console.info("book: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"left",paging:"double"};return console.log(t),alice.plugins.caterpillar.init(t)},alice.plugins.notebook=function(e){"use strict";console.info("notebook: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"top",paging:"single",wrap:e.wrap||!1,piggyBg:e.pageBackground||"#222"};return console.log(t),alice.plugins.caterpillar.init(t)},alice.plugins.flipbook=function(e){"use strict";console.info("flipbook: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"center",paging:"single",wrap:e.wrap||!1};return console.log(t),alice.plugins.caterpillar.init(t)};
+var jWorkflow=function(){function e(e){if(typeof e!="function")throw"expected function but was "+typeof e}function t(e){return typeof e.andThen=="function"&&typeof e.start=="function"&&typeof e.chill=="function"}function n(e){return!!e.map&&!!e.reduce}var r={order:function(r,i){var s=[],o,u=null,a=function(){var e=!1;return{take:function(){e=!0},pass:function(t){var n;e=!1,o.length?(n=o.shift(),t=n.func.apply(n.context,[t,a]),e||a.pass(t)):u.func&&u.func.apply(u.context,[t])},drop:function(t){e=!0,o=[],setTimeout(function(){a.pass(t)},1)}}}(),f={andThen:function(r,i){if(t(r)){var o=function(e,t){t.take(),r.start({callback:function(e){t.pass(e)},context:i,initialValue:e})};s.push({func:o,context:i})}else if(n(r)){var u=function(e,t){t.take();var n=r.length,i=function(){return--n||t.pass()};r.forEach(function(e){jWorkflow.order(e).start(i)})};s.push({func:u,context:i})}else e(r),s.push({func:r,context:i});return f},chill:function(e){return f.andThen(function(t,n){n.take(),setTimeout(function(){n.pass(t)},e)})},start:function(){var e,t,n;arguments[0]&&typeof arguments[0]=="object"?(e=arguments[0].callback,t=arguments[0].context,n=arguments[0].initialValue):(e=arguments[0],t=arguments[1]),u={func:e,context:t},o=s.slice(),a.pass(n)}};return r?f.andThen(r,i):f}};return r}();typeof module=="object"&&typeof require=="function"&&(module.exports=jWorkflow);var alice=function(){"use strict";var e={id:"alice",name:"AliceJS",description:"A Lightweight Independent CSS Engine",version:"0.5",build:"20121101-1034",prefix:"",prefixJS:"",elems:null,cleaner:{},format:{},helper:{},plugins:{},anima:null,debug:!1,elements:function(e){var t,n=[],r=function(e,t){Array.prototype.forEach.apply(e,[t])},i=function(e){n.push(e)},s=function(e){if(typeof e!="string")return[];var t=document.getElementById(e);return t?[t]:document.querySelectorAll(e)};if(typeof e=="string")if(e.indexOf("$")===0)if(e.indexOf("#")>-1)t=e.substring(e.indexOf("#")+1,e.indexOf("')")),r(s(t),i);else{if(!(e.indexOf(".")>-1)){console.warn("jQuery selectors must be either classes or ids.");return}t=e.substring(e.indexOf(".")+1,e.indexOf("')")),r(s(t),i)}else r(s(e),i);else e.length===undefined?n.push(e):r(e,function(e){e.nodeType&&e.nodeType!==3?n.push(e):r(s(e),i)});return n},randomize:function(e,t){var n,r,i=parseInt(e,10);return typeof t=="string"&&t.indexOf("%")>-1?n=parseInt(t,10)/100:n=parseFloat(t,10),r=i+i*(Math.random()*2*n-n),Math.floor(r)},duration:function(e){var t,n=function(e){return e},r=function(e){var t;return e.indexOf("ms")>-1?t=parseInt(e,10):e.indexOf("s")>-1?t=parseFloat(e,10)*1e3:t=parseInt(e,10),t},i=function(e){var t;return e.value&&(typeof e.value=="string"?t=r(e.value):t=n(e.value)),t};switch(typeof e){case"number":t=n(e);break;case"string":t=r(e);break;case"object":t=i(e);break;default:t=e}return t},coords:function(e){var t={"top-left":{x:"0%",y:"0%"},"top-center":{x:"50%",y:"0%"},"top-right":{x:"100%",y:"0%"},"middle-left":{x:"0%",y:"50%"},"middle-center":{x:"50%",y:"50%"},"middle-right":{x:"100%",y:"50%"},"bottom-left":{x:"0%",y:"100%"},"bottom-center":{x:"50%",y:"100%"},"bottom-right":{x:"100%",y:"100%"},top:{x:"50%",y:"0%"},left:{x:"0%",y:"50%"},center:{x:"50%",y:"50%"},right:{x:"100%",y:"50%"},bottom:{x:"50%",y:"100%"},NW:{x:"0%",y:"0%"},N:{x:"50%",y:"0%"},NE:{x:"100%",y:"0%"},W:{x:"0%",y:"50%"},E:{x:"100%",y:"50%"},SW:{x:"0%",y:"100%"},S:{x:"50%",y:"100%"},SE:{x:"100%",y:"100%"},"":{x:"50%",y:"50%"},"undefined":{x:"50%",y:"50%"}};return t[e]},easing:function(e){var t={linear:{p1:.25,p2:.25,p3:.75,p4:.75},ease:{p1:.25,p2:.1,p3:.25,p4:1},"ease-in":{p1:.42,p2:0,p3:1,p4:1},"ease-out":{p1:0,p2:0,p3:.58,p4:1},"ease-in-out":{p1:.42,p2:0,p3:.58,p4:1},easeInQuad:{p1:.55,p2:.085,p3:.68,p4:.53},easeInCubic:{p1:.55,p2:.055,p3:.675,p4:.19},easeInQuart:{p1:.895,p2:.03,p3:.685,p4:.22},easeInQuint:{p1:.755,p2:.05,p3:.855,p4:.06},easeInSine:{p1:.47,p2:0,p3:.745,p4:.715},easeInExpo:{p1:.95,p2:.05,p3:.795,p4:.035},easeInCirc:{p1:.6,p2:.04,p3:.98,p4:.335},easeInBack:{p1:.6,p2:-0.28,p3:.735,p4:.045},easeOutQuad:{p1:.25,p2:.46,p3:.45,p4:.94},easeOutCubic:{p1:.215,p2:.61,p3:.355,p4:1},easeOutQuart:{p1:.165,p2:.84,p3:.44,p4:1},easeOutQuint:{p1:.23,p2:1,p3:.32,p4:1},easeOutSine:{p1:.39,p2:.575,p3:.565,p4:1},easeOutExpo:{p1:.19,p2:1,p3:.22,p4:1},easeOutCirc:{p1:.075,p2:.82,p3:.165,p4:1},easeOutBack:{p1:.175,p2:.885,p3:.32,p4:1.275},easeInOutQuad:{p1:.455,p2:.03,p3:.515,p4:.955},easeInOutCubic:{p1:.645,p2:.045,p3:.355,p4:1},easeInOutQuart:{p1:.77,p2:0,p3:.175,p4:1},easeInOutQuint:{p1:.86,p2:0,p3:.07,p4:1},easeInOutSine:{p1:.445,p2:.05,p3:.55,p4:.95},easeInOutExpo:{p1:1,p2:0,p3:0,p4:1},easeInOutCirc:{p1:.785,p2:.135,p3:.15,p4:.86},easeInOutBack:{p1:.68,p2:-0.55,p3:.265,p4:1.55},custom:{p1:0,p2:.35,p3:.5,p4:1.3},random:{p1:Math.random().toPrecision(3),p2:Math.random().toPrecision(3),p3:Math.random().toPrecision(3),p4:Math.random().toPrecision(3)}};return t[e]?t[e]:{p1:.42,p2:0,p3:.58,p4:1}},flip:function(e,t,n){var r=t||1,i,s=function(e){return{start:0,end:e,axis:"Y"}},o=function(t){switch(e){case"left":return{start:0,end:-360*r,axis:"Y"};case"right":return{start:0,end:360*r,axis:"Y"};case"up":return{start:0,end:360*r,axis:"X"};case"down":return{start:0,end:-360*r,axis:"X"}}},u=function(e){var t;return e.value&&(typeof e.value=="string"?t=o(e.value):t=s(e.value)),t};switch(typeof e){case"number":i=s(e);break;case"string":i=o(e);break;case"object":i=u(e);break;default:i=null}return i},percentage:function(e){var t;return typeof e=="string"?e.indexOf("%")>-1||e.indexOf("°")>-1?t=parseInt(e,10)/100:e>=1||e<=-1?t=parseInt(e,10)/100:t=parseFloat(e,10):typeof e=="number"&&(e>=1||e<=-1?t=e/100:t=e),t},vendorPrefix:function(){var e=document.createElement("div");"webkitAnimation"in e.style?(this.prefix="-webkit-",this.prefixJS="webkit"):"MozAnimation"in e.style?(this.prefix="-moz-",this.prefixJS="Moz"):"msAnimation"in e.style?(this.prefix="-ms-",this.prefixJS="ms"):"OAnimation"in e.style||"OTransform"in e.style?(this.prefix="-o-",this.prefixJS="O"):(this.prefix="",this.prefixJS=""),this.debug&&console.log("prefix="+this.prefix,"prefixJS="+this.prefixJS);return},docHeight:function(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))},pixel:function(e,t){if(typeof e=="number")return e%1===0?e:parseFloat(e,10)*t;if(e.indexOf("px")>-1)return parseInt(e,10);if(e.indexOf("%")>-1)return Math.round(parseInt(e,10)/100*t)},keyframeInsert:function(e){if(document.styleSheets&&document.styleSheets.length){var t=0;try{document.styleSheets[0].cssRules.length>0&&(t=document.styleSheets[0].cssRules.length),document.styleSheets[0].insertRule(e,t)}catch(n){console.warn(n.message,e)}}else{var r=document.createElement("style");r.innerHTML=e,document.head.appendChild(r)}return},keyframeDelete:function(e){var t=document.all?"rules":"cssRules",n;for(n=0;n<document.styleSheets[0][t].length;n+=1)if(document.styleSheets[0][t][n].name===e){document.styleSheets[0].deleteRule(n),this.debug&&console.log("Deleted keyframe: "+e);break}return},clearAnimation:function(e){this.style[this.prefixJS+"AnimationName"]=" ",this.style[this.prefixJS+"AnimationDelay"]=" ",this.style[this.prefixJS+"AnimationDuration"]=" ",this.style[this.prefixJS+"AnimationTimingFunction"]=" ",this.style[this.prefixJS+"AnimationIterationCount"]=" ",this.style[this.prefixJS+"AnimationDirection"]=" ",this.style[this.prefixJS+"AnimationPlayState"]=" ",alice.keyframeDelete(e.animationName);return},init:function(t){console.info("Initializing "+this.name+" ("+this.description+") "+this.version),this.vendorPrefix(),t&&t.elems&&(this.elems=this.elements(t.elems));if(t&&t.workflow===!0){console.log("jWorkflow: enabled");var n=t&&t.id?t.id:"",r=jWorkflow.order(),i={delay:function(e){return r.chill(e),i},log:function(e){return r.andThen(function(){console.log(e)}),i},custom:function(e){return r.andThen(e),i},start:function(){r.start(function(){console.info("workflow.start")})}};return Array.prototype.forEach.call(Object.keys(e.plugins),function(t){var s=e.plugins[t];i[t]=function(){var e=arguments;return r.andThen(function(){s.apply(document.getElementById(n),e)}),i}}),i}return console.log("jWorkflow: disabled"),e.plugins}};return e}();alice.format={duration:function(e){"use strict";var t=0,n=0,r=0;return t=alice.duration(e),r=t,e.randomness&&(n=alice.randomize(t,alice.percentage(e.randomness)),r=Math.abs(n)),r+"ms"},easing:function(e){"use strict";var t=alice.easing(e),n="cubic-bezier("+t.p1+", "+t.p2+", "+t.p3+", "+t.p4+")";return n},coords:function(e){"use strict";var t=alice.coords(e),n=t.x+" "+t.y;return n},oppositeNumber:function(e){"use strict";return-e}},alice.helper={duration:function(e,t,n){"use strict";return e&&e.offset?t?t=parseInt(t,10)+parseInt(e.offset,10):t=parseInt(alice.format.duration(n),10):t=parseInt(alice.format.duration(n),10),t+="ms",t},rotation:function(e,t){"use strict";var n=e;return t.randomness&&(n=alice.randomize(n,alice.percentage(t.randomness))),n}},alice.cleaner={removeAni:function(e){"use strict";var t,n;document.addEventListener(alice.prefixJS+"AnimationEnd",function(){n=alice.elements(e);for(t=0;t<n.length;t++)document.getElementById(n[t].getAttribute("id")).removeAttribute("style")},!1)},removeElems:function(e){"use strict";var t,n;document.addEventListener(alice.prefixJS+"AnimationEnd",function(){n=alice.elements(e);for(t=0;t<n.length;t++){var r=document.getElementById(n[t].getAttribute("id"));r.parentNode.removeChild(r)}},!1)}};var alicejs=alice.init();alice.plugins.cheshire=function(e){"use strict";console.info("cheshire",e);var t=e.delay||"0ms",n=e.duration||"2000ms",r=e.timing||"ease",i=e.iteration||1,s=e.direction||"normal",o=e.playstate||"running",u=e.perspective||"1000",a=e.perspectiveOrigin||"center",f=e.backfaceVisibility||"visible",l=alice.percentage(e.overshoot)||0,c=85,h=e.rotate||0,p=e.turns||1,d=alice.flip(e.flip,p,l),v=e.fade&&e.fade!==""?e.fade:null,m=v&&v==="out"?1:0,g=v&&v==="out"?0:1,y=e.scale&&e.scale.from?alice.percentage(e.scale.from):1,b=e.scale&&e.scale.to?alice.percentage(e.scale.to):1,w=e.shadow||!1,E="",S="",x=1,T=0,N=e.posEnd||0,C=N+x*Math.floor(N*l),k=e.cleanUp||"partial",L={},A,O,M,_,D,P,H,B,j,F,I,q,R,U;e.cleanUp==="partial"?alice.cleaner.removeAni(e.elems):e.cleanUp==="total"&&alice.cleaner.removeElems(e.elems),O=alice.elements(e.elems);if(O&&O.length>0)for(_=0;_<O.length;_+=1){M=O[_],A=M.parentElement||M.parentNode,L.delay=alice.helper.duration(e.delay,L.delay,t),L.duration=alice.helper.duration(e.duration,L.duration,n),L.rotate=alice.helper.rotation(h,e),L.rotateStart=alice.percentage(L.rotate)*100,L.rotateOver=l*100,L.rotateEnd=0,D=alice.id+"-cheshire-"+(new Date).getTime()+"-"+Math.floor(Math.random()*1e6);if(e.move){q=e.move.direction||e.move;switch(q){case"left":E="Left",S="X",x=-1,R=window.innerWidth,T=e.move.start?alice.pixel(e.move.start,R):R,N=e.move.end?alice.pixel(e.move.end,R):0,C=x*Math.floor(T*l);break;case"right":E="Right",S="X",x=1,R=document.body.offsetWidth-M.clientWidth,T=e.move.start?alice.pixel(e.move.start,R):0,N=e.move.end?alice.pixel(e.move.end,R):R,C=N+x*Math.floor(N*l);break;case"up":E="Up",S="Y",x=-1,R=window.innerHeight,T=e.move.start?alice.pixel(e.move.start,R):R,N=e.move.end?alice.pixel(e.move.end,R):0,C=x*Math.floor(T*l);break;case"down":E="Down",S="Y",x=1,R=alice.docHeight()-A.clientHeight*3,T=e.move.start?alice.pixel(e.move.start,R):0,N=e.move.end?alice.pixel(e.move.end,R):R,C=N+x*Math.floor(N*l),alice.debug&&console.log(alice.docHeight(),window.innerHeight,window.pageYOffset,A.clientHeight)}}H="",H+=d?" rotate"+d.axis+"("+d.start+"deg)":" translate"+S+"("+T+"px)",H+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateStart+"deg)":"",H+=" scale("+y+")",B="",B+=d?" rotate"+d.axis+"("+Math.floor((1+l)*d.end)+"deg)":" translate"+S+"("+C+"px)",B+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateOver+"deg)":"",B+=b>1?" scale("+b+")":"",B+=" scale("+b+")",j="",j+=d?" rotate"+d.axis+"("+d.end+"deg)":" translate"+S+"("+N+"px)",E===""&&s==="alternate"?j+=" rotate("+ -L.rotateStart+"deg)":j+=L.rotate&&parseInt(L.rotate,10)!==0?" rotate("+L.rotateEnd+"deg)":"",j+=" scale("+b+")",w===!0&&b>1&&(U=Math.round(b*10),F=" 0px 0px 0px rgba(0, 0, 0, 1)",I=" "+U+"px "+U+"px "+U+"px rgba(0, 0, 0, 0.5)"),P="",P+="@"+alice.prefix+"keyframes "+D+" {\n",P+=" 0% {\n",P+=" "+alice.prefix+"transform:"+H+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=v?" opacity: "+m+";"+"\n":"",P+=w===!0&&b>1?" "+alice.prefix+"box-shadow: "+F+";"+"\n":"",P+=" }\n",l!==0&&(P+=" "+c+"% {\n",P+=" "+alice.prefix+"transform:"+B+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=" }\n"),P+=" 100% {\n",P+=" "+alice.prefix+"transform:"+j+";"+"\n",P+=" "+alice.prefix+"transform-origin:"+alice.format.coords(a)+";"+"\n",P+=v?" opacity: "+g+";"+"\n":"",P+=w===!0&&b>1?" "+alice.prefix+"box-shadow: "+I+";"+"\n":"",P+=" }\n",P+="}\n",console.log(P),alice.keyframeInsert(P),A.style[alice.prefixJS+"Perspective"]=u+"px",A.style[alice.prefixJS+"PerspectiveOrigin"]=alice.format.coords(a),M.style[alice.prefixJS+"BackfaceVisibility"]=f,M.style[alice.prefixJS+"AnimationName"]=D,M.style[alice.prefixJS+"AnimationDelay"]=L.delay,M.style[alice.prefixJS+"AnimationDuration"]=L.duration,M.style[alice.prefixJS+"AnimationTimingFunction"]=alice.format.easing(r),M.style[alice.prefixJS+"AnimationIterationCount"]=i,M.style[alice.prefixJS+"AnimationDirection"]=s,M.style[alice.prefixJS+"AnimationPlayState"]=o,M.style[alice.prefixJS+"Transform"]=j,M.style.opacity=v?g:"",M.style[alice.prefixJS+"BoxShadow"]=w===!0&&b>1?I:"","MozAnimation"in M.style?M.addEventListener("animationend",alice.clearAnimation,!1):M.addEventListener(alice.prefixJS+"AnimationEnd",alice.clearAnimation,!1),alice.debug&&(console.log(P),console.log(A.style),console.log(M.id,alice.prefixJS,M.style,M.style.cssText,M.style[alice.prefixJS+"AnimationDuration"],M.style[alice.prefixJS+"AnimationTimingFunction"]))}else console.warn("No elements!");return e},alice.plugins.bounce=function(e){"use strict";console.info("bounce: ",arguments),e||(e="");var t={from:"100%",to:"150%"};e.scale&&(typeof e.scale=="object"?t=e.scale:t.to=e.scale);var n={elems:e.elems||alice.anima,scale:t,shadow:e.shadow||!0,duration:e.duration||"750ms",timing:e.timing||"easeOutSine",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.dance=function(e){"use strict";console.info("dance: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,rotate:e.rotate||45,duration:e.duration||"750ms",timing:e.timing||"easeInOutBack",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.drain=function(e){"use strict";console.info("drain: ",arguments),e||(e="");var t={scale:e.fade==="in"?{from:"0%",to:"100%"}:{from:"100%",to:"0%"},elems:e.elems||alice.anima,rotate:e.rotate||-2880,duration:e.duration||"4500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.fade=function(e){"use strict";console.info("fade: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,fade:e.fade||"in",duration:e.duration||"4500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.hinge=function(e){"use strict";console.info("hinge: ",arguments),e||(e="");var t={perspectiveOrigin:"top-left",elems:e.elems||alice.anima,rotate:e.rotate||25,overshoot:e.overshoot||0,duration:e.duration||"1000ms",timing:e.timing||"linear",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.pageFlip=function(e){"use strict";console.info("pageFlip: ",arguments),e||(e="");var t="";switch(e.flipDirection){case"right":t="right";break;case"up":t="top";break;case"down":t="bottom"}var n={perspectiveOrigin:t||"left",elems:e.elems||alice.anima,flip:e.flipDirection||"left",turns:e.turns||1,overshoot:e.overshoot||0,duration:e.duration||"2000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.pendulum=function(e){"use strict";console.info("pendulum: ",arguments),e||(e="");var t={perspectiveOrigin:"top",elems:e.elems||alice.anima,rotate:e.rotate||45,overshoot:e.overshoot||0,duration:e.duration||"2000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.phantomZone=function(e){"use strict";console.info("phantomZone: ",arguments),e||(e="");var t={scale:e.fade==="in"?{from:"1%",to:"100%"}:{from:"100%",to:"1%"},elems:e.elems||alice.anima,rotate:e.rotate||-720,flip:e.flip||"left",duration:e.duration||"5000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.raceFlag=function(e){"use strict";console.info("raceFlag: ",arguments),e||(e="");var t={flip:"down",elems:e.elems||alice.anima,rotate:e.rotate||-720,perspectiveOrigin:e.perspectiveOrigin||"top-right",duration:e.duration||"3000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.slide=function(e){"use strict";console.info("slide: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,move:e.move||"left",overshoot:e.overshoot||"0",duration:e.duration||"4000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.spin=function(e){"use strict";console.info("spin: ",arguments),e||(e="");var t={perspectiveOrigin:"center",direction:"normal",elems:e.elems||alice.anima,flip:e.flip||"left",turns:e.turns||1,overshoot:e.overshoot||0,duration:e.duration||"1200ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.toss=function(e){"use strict";console.info("toss: ",arguments),e||(e="");var t={rotate:e.move==="left"||e.move==="down"?720:-720,elems:e.elems||alice.anima,move:e.move||"right",overshoot:e.overshoot||0,perspectiveOrigin:e.perspectiveOrigin||"center",duration:e.duration||"2500ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.twirl=function(e){"use strict";console.info("twirl: ",arguments),e||(e="");var t={rotate:e.flip==="left"?-135:135,elems:e.elems||alice.anima,flip:e.flip||"left",duration:e.duration||"3000ms",timing:e.timing||"ease-in-out",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.wobble=function(e){"use strict";console.info("wobble: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,rotate:e.rotate||5,perspectiveOrigin:e.perspectiveOrigin||"center",duration:e.duration||"200ms",timing:e.timing||"linear",delay:e.delay||"0ms",iteration:e.iteration||"infinite",direction:"alternate",playstate:e.playstate||"running"};return alice.plugins.cheshire(t),t},alice.plugins.zoom=function(e){"use strict";console.info("zoom: ",arguments),e||(e="");var t={from:"1%",to:"125%"};e.scale&&(typeof e.scale=="object"?t=e.scale:t.to=scale);var n={elems:e.elems||alice.anima,scale:t,shadow:e.shadow||!0,move:e.move||"none",duration:e.duration||"2000ms",timing:e.timing||"ease",delay:e.delay||"0ms",iteration:e.iteration||1,direction:e.direction||"normal",playstate:e.playstate||"running"};return alice.plugins.cheshire(n),n},alice.plugins.caterpillar=function(){"use strict";var e={docWidth:function(){var e=document.body.clientWidth;return e},docHeight:alice.docHeight(),_rot270:"(262deg)",_rot180:"(180deg)",_rot90:"(90deg)",_rot0:"(0deg)",_rotNeg90:"(-90deg)",_rotNeg180:"(-180deg)",_rotNeg270:"(-262deg)",originZero:"",onPageTrigger:"",helper:{getThisId:function(e){var t=e.substring(e.indexOf("_")+1,e.length);return t=parseInt(t,10),t},setAnimationDefaults:function(e,t){e.style[alice.prefixJS+"AnimationDuration"]=t,e.style[alice.prefixJS+"AnimationFillMode"]="forwards",e.style[alice.prefixJS+"AnimationPlayState"]="running",e.style[alice.prefixJS+"AnimationDirection"]="normal",e.style[alice.prefixJS+"AnimationTimingFunction"]="linear",e.style.display="block"},findCSSRule:function(e){var t,n,r,i,s,o,u;t=document.styleSheets.length;for(n=0;n<t;n++){r=document.styleSheets[n],r.rules?u=r.rules:u=r.cssRules,u=r.cssRules?r.cssRules:r.rules;for(i=0;i<u.length;i++)if(u[i].selectorText==e)return s=u[i].style.width.toString(),o=u[i].style.height.toString(),[s,o]}},piggyback:function(t,n,r,i,s,o,u,a,f,l){t===0&&(t=f);var c=document.getElementById(i),h=document.getElementById(r+t).style,p=n==="standard"?r+"abstrPageTurnF":r+"abstrPageReTurnF",d="0",v=document.createElement("div");v.setAttribute("style",h),v.setAttribute("id","_piggy"),v.setAttribute("class",document.getElementById(r+t).getAttribute("class")),v.style[alice.prefix+"backfaceVisibility"]="visible",v.style.width=c.style.width,v.style.height=c.style.height,v.style.position="absolute",v.style.background=l||"#222",v.style.top="0px",v.style.left="0px";if(n==="advanced"){var m;m=e._rot270;switch(u){case"left":m=e._rotNeg270;break;case"bottom":m=e._rotNeg270}v.style[alice.prefixJS+"Transform"]=a+m}v.style.zIndex=d,v.style[alice.prefixJS+"AnimationName"]=p,v.style[alice.prefixJS+"TransformOrigin"]=o,v.style[alice.prefixJS+"AnimationDuration"]=s,v.style[alice.prefixJS+"AnimationFillMode"]="forwards",v.style[alice.prefixJS+"AnimationPlayState"]="running",v.style[alice.prefixJS+"AnimationDirection"]="normal",v.style[alice.prefixJS+"AnimationTimingFunction"]="linear",v.style.display="block",c.appendChild(v)}},AnimGenerator:function(t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M;l="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot90+";",c="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot270+";",h="\n "+alice.prefix+"transform: "+t.transformRotate+e._rotNeg270+";",p="\n "+alice.prefix+"transform: "+t.transformRotate+e._rotNeg90+";",d="\n "+alice.prefix+"transform: "+t.transformRotate+e._rot0+";",v="\n "+alice.prefix+"transform-origin: "+t.originZero+";",m="\n "+alice.prefix+"transform-origin: 50% 50%;",g="\n "+alice.prefix+"transform-origin: "+t.transformOrigin+";",y=" 0%{"+alice.prefix+"box-shadow:"+t.shadowPattern0+";",b=" 50%{"+alice.prefix+"box-shadow:"+t.shadowPattern50+";",w=" 100%{"+alice.prefix+"box-shadow:"+t.shadowPattern100+";",E="50%{"+alice.prefix+"box-shadow:"+t.shadowPatternRev50+";"+"\n",S="100%{"+alice.prefix+"box-shadow:"+t.shadowPatternRev100+";"+"\n",x="@"+alice.prefix+"keyframes "+t.bookName+"p_oddPageTurnF{\n",T="@"+alice.prefix+"keyframes "+t.bookName+"p_oddPageTurnR{\n",N="@"+alice.prefix+"keyframes "+t.bookName+"p_evenPageTurnF{\n",C="@"+alice.prefix+"keyframes "+t.bookName+"p_evenPageTurnR{\n",k="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageTurnF{\n",L="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageTurnR{\n",A="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageReTurnF{\n",O="@"+alice.prefix+"keyframes "+t.bookName+"p_abstrPageReTurnR{\n",M="}\n",t.paging==="single"&&(t.binding==="left"&&(s=k+y+M+b+M+w+v+h+M+"\n"+M,i=L+y+M+b+M+w+v+d+M+"\n"+M,r=A+y+M+b+M+w+v+d+M+"\n"+M,n=O+y+M+b+M+w+v+d+M+"\n"+M),t.binding==="right"&&(s=k+y+M+b+M+w+g+c+M+"\n"+M,i=L+y+M+b+M+w+g+d+M+"\n"+M,r=A+y+M+b+M+w+g+d+M+"\n"+M,n=O+y+M+b+M+w+g+d+M+"\n"+M),t.binding==="top"&&(s=k+y+M+b+M+w+v+c+M+"\n"+M,i=L+y+M+b+M+w+v+d+M+"\n"+M,r=A+y+M+b+M+w+v+d+M+"\n"+M,n=O+y+M+b+M+w+v+d+M+"\n"+M),t.binding==="bottom"&&(s=k+y+M+b+M+w+g+h+M+"\n"+M,i=L+y+M+b+M+w+g+d+M+"\n"+M,r=A+y+M+b+M+w+g+d+M+"\n"+M,n=O+y+M+b+M+w+g+d+M+"\n"+M),t.binding==="center"&&(s=k+y+M+b+M+w+m+p+M+"\n"+M,i=L+y+M+b+M+w+m+d+M+"\n"+M,r=A+y+M+b+M+w+m+l+M+"\n"+M,n=O+y+M+b+M+w+m+d+M+"\n"+M),t.binding==="middle"&&(s=k+y+M+b+M+w+m+p+M+"\n"+M,i=L+y+M+b+M+w+m+d+M+"\n"+M,r=A+y+M+b+M+w+m+l+M+"\n"+M,n=O+y+M+b+M+w+m+d+M+"\n"+M),alice.keyframeInsert(s),alice.keyframeInsert(i),alice.keyframeInsert(r),alice.keyframeInsert(n)),t.paging==="double"&&(t.binding==="left"&&(o=x+y+M+b+M+w+v+p+M+"\n"+M,u=T+y+M+b+M+w+v+d+M+"\n"+M,a=N+E+M+S+g+d+M+"\n"+M,f=C+E+M+S+g+l+M+"\n"+M),t.binding==="right"&&(o=x+y+M+b+M+w+g+l+M+"\n"+M,u=T+y+M+b+M+w+g+d+M+"\n"+M,a=N+E+M+S+v+d+M+"\n"+M,f=C+E+M+S+v+p+M+"\n"+M),t.binding==="top"&&(o=x+y+M+b+M+w+v+l+M+"\n"+M,u=T+y+M+b+M+w+v+d+M+"\n"+M,a=N+E+M+S+g+d+M+"\n"+M,f=C+E+M+S+g+p+M+"\n"+M),t.binding==="bottom"&&(o=x+y+M+b+M+w+g+p+M+"\n"+M,u=T+y+M+b+M+w+g+d+M+"\n"+M,a=N+E+M+S+v+d+M+"\n"+M,f=C+E+M+S+v+l+M+"\n"+M),alice.keyframeInsert(o),alice.keyframeInsert(u),alice.keyframeInsert(a),alice.keyframeInsert(f))},clearSinglePages:function(t,n,r,i,s,o){var u,a,f,l=e.helper.getThisId(t),c=document.getElementById(t);document.getElementById("_piggy")&&(f=document.getElementById("_piggy").parentNode,f.removeChild(document.getElementById("_piggy")),document.getElementById(s.bookName).setAttribute("data-state","paused")),c.style[alice.prefixJS+"Animation"]="",c.style[alice.prefixJS+"AnimationDelay"]="",c.style[alice.prefixJS+"AnimationDuration"]="",c.style[alice.prefixJS+"AnimationTimingFunction"]="",c.style[alice.prefixJS+"AnimationIterationCount"]="",c.style[alice.prefixJS+"AnimationDirection"]="",c.style[alice.prefixJS+"AnimationPlayState"]="";if(s.binding==="center"||s.binding==="middle")o||(c.style.display="none");else if(s.binding==="left"||s.binding==="top"||s.binding==="right"||s.binding==="bottom")c.style.display="none";a=document.getElementById(r+(parseInt(l,10)-1)),u=document.getElementById(r+(parseInt(l,10)+1)),l===s.realPageCount&&(u=document.getElementById(r+"1")),c.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[0],c.style.zIndex="0",n==="forwards"&&(l===1?a=document.getElementById(r+s.realPageCount):l>1&&(s.binding==="left"||s.binding==="right"||s.binding==="top"||s.binding==="bottom")&&(u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[0]),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[1]);if(n==="reverse"){if(l>0){if(s.binding==="center"||s.binding==="middle")s.wrap===!0?l===1?a=document.getElementById(r+s.realPageCount):a=document.getElementById(r+(l-1)):l!==1&&(a=document.getElementById(r+(l-1))),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2];s.wrap===!0&&l!==s.realPageCount&&(u=document.getElementById(r+(parseInt(l,10)+1)));if(s.binding==="left"||s.binding==="top"||s.binding==="right"||s.binding==="bottom")u.style.display="none",c.style.display="block";u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2]}l===1&&(a=document.getElementById(s.pageName+s.realPageCount),a.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[2],u.style[alice.prefixJS+"Transform"]=s.transformRotate+s.transformDegrees[1])}},clearDoublePages:function(t,n,r,i){var s,o,u=document.getElementById(r),a=e.helper.getThisId(r),f=document.getElementById(i.pageName+(parseInt(a,10)+1)),l="display: block; left: 0px; top: 0px;";if(a%2===1){u.setAttribute("style","");if(t==="forward"){u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,s=i.transformRotate+e._rot90;switch(i.binding){case"top":u.style.top=i.pageHeight+"px";break;case"right":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"left":s=i.transformRotate+e._rotNeg90,u.style.left=i.pageWidth+"px";break;case"bottom":s=i.transformRotate+e._rotNeg90,u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin}u.style[alice.prefixJS+"Transform"]=s}else if(t==="reverse"){u.setAttribute("style",l),u.style[alice.prefixJS+"TransformOrigin"]=i.originZero;switch(i.binding){case"top":u.style.top=i.pageHeight+"px";break;case"right":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"left":u.style.left=i.pageWidth+"px";break;case"bottom":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;default:u.style.top="0px"}}}if(a%2===0){u.setAttribute("style","");if(t==="forward"){u.setAttribute("style",l),u.style[alice.prefixJS+"TransformOrigin"]=i.originZero;switch(i.binding){case"top":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"right":u.style.left=i.pageWidth+"px";break;case"left":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin,u.style.left="0px";break;case"bottom":u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,u.style.top=i.pageHeight+"px"}u.style[alice.prefixJS+"Transform"]=e.transformRotate+e._rot0}else if(t==="reverse"){u.style[alice.prefixJS+"TransformOrigin"]=i.originZero,o=e.transformRotate+e._rotNeg90;switch(i.binding){case"top":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin;break;case"right":u.style.left=i.pageWidth+"px";break;case"bottom":o=i.transformRotate+e._rot90,u.style.top=i.pageHeight+"px";break;case"left":u.style[alice.prefixJS+"TransformOrigin"]=i.transformOrigin,o=i.transformRotate+e._rot90}u.style[alice.prefixJS+"Transform"]=o}}u.style[alice.prefixJS+"boxShadow"]=i.shadowPattern0},styleConfig:function(t){var n=document.getElementById(t.pageName+t.pageId);t.paging==="single"&&((t.binding==="center"||t.binding==="middle")&&n.setAttribute("style","display: none; "+alice.prefix+"transform-origin: 50% 50%;"+alice.prefix+"transform: "+t.transformRotate+e._rot90+";"+alice.prefix+"box-shadow: "+t.shadowPattern100+";"),(t.binding==="left"||t.binding==="top"||t.binding==="bottom"||t.binding==="right")&&n.setAttribute("style","display: none; "+alice.prefix+"transform-origin:"+t.transformOrigin+";"+alice.prefix+"transform: "+t.transformRotate+e._rot0+";"+alice.prefix+"box-shadow: "+t.shadowPattern100+";")),t.paging==="double"&&(t.binding==="left"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.left=t.pageWidth+"px"),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin,n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90)),t.binding==="right"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.left=t.pageWidth+"px"
+,n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90)),t.binding==="top"&&(t.pageId%2===1&&(n.style.top=t.pageHeight+"px",n.style[alice.prefixJS+"TransformOrigin"]=t.originZero),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin,n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90)),t.binding==="bottom"&&(t.pageId%2===1&&(n.style[alice.prefixJS+"TransformOrigin"]=t.transformOrigin),t.pageId%2===0&&(n.style[alice.prefixJS+"TransformOrigin"]=t.originZero,n.style.top=t.pageHeight+"px",n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90)))},init:function(t){var n={},r,i,s,o,u,a,f,l,c,h,p,d;n.pages=[],n.realPageCount=0,n.speed=alice.duration(t.speed),n.book=document.getElementById(t.elems),n.bookName=n.book.id,n.timing=e.timing,n.binding=t.binding,n.piggyBg=t.piggyBg,n.originZero="0 0",n.pageClass=t.pageClass,n.pageName=t.elems+"p_",n.paging=t.paging,n.randomize=t.randomize,n.wrap=t.wrap,n.shadow=t.shadow,n.book.setAttribute("data-state","paused"),n.book.setAttribute("data-page-number","1"),n.bookSize=e.helper.findCSSRule("#"+n.book.getAttribute("id")),n.bookSize?(r=n.bookSize[0],i=n.bookSize[1]):(r=n.book.style.width,i=n.book.style.height),r.indexOf("%")>0?(s="%",o="0."+r.substring(0,r.indexOf(s)),o=parseFloat(o),u=n.docWidth()*o):r.indexOf("px")>0?(s="px",u=r.substring(0,r.indexOf(s))):u=r,n.pageWidth=u,i.indexOf("%")>0?(a="%",f="0."+i.substring(0,i.indexOf(a)),f=parseFloat(f),l=n.docHeight*f):i.indexOf("px")>0?(a="px",l=i.substring(0,i.indexOf(a))):l=i,n.pageHeight=l,n.goggles=Math.floor(n.pageWidth*4);if(n.shadow===!0){n.shadowPattern0="0px 0px 14px rgba(0, 0, 0, 0.1)",n.shadowPattern50="10px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPattern100="0px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPatternRev50="-10px 0px 14px rgba(0, 0, 0, 0.3)",n.shadowPatternRev100="0px 0px 14px rgba(0, 0, 0, 0.1)";if(n.binding==="center"||n.binding==="middle")n.shadowPattern50="0px 0px 14px rgba(0, 0, 0, 0.3)"}else n.shadowPattern0="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPattern50="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPattern100="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPatternRev50="0px 0px 0px rgba(0, 0, 0, 0)",n.shadowPatternRev100="0px 0px 0px rgba(0, 0, 0, 0)";n.NewPageClass=t.elems+(new Date).getTime(),e.animationEnd=alice.prefixJS+"AnimationEnd",alice.prefixJS==="Moz"&&(e.animationEnd="animationend"),c=n.book.childNodes,h=0;for(p=0;p<c.length;p++)if(c[p].nodeType===1){if(c[p].tagName!=="DIV"&&c[p].tagName!=="div")return console.error("Your pages must be all be the DIV tag element. Please place the contents inside."),!1;n.pages[h]=c[p],n.realPageCount=n.realPageCount+1,h++}n.book.style[alice.prefixJS+"Perspective"]=n.goggles+"px",n.book.style.zIndex="1000",n.book.style.position="relative",n.binding=t.binding;if(t.binding==="center"||t.binding==="left"||t.binding==="right")n.transformRotate="rotateY";if(t.binding==="middle"||t.binding==="top"||t.binding==="bottom")n.transformRotate="rotateX";if(t.paging==="single")n.book.style.width=n.pageWidth+"px",n.book.style.height=n.pageHeight+"px";else if(t.paging==="double")if(t.binding==="left"||t.binding==="right")n.book.style.width=n.pageWidth*2+"px",n.book.style.height=n.pageHeight+"px";else if(t.binding==="top"||t.binding==="bottom")n.book.style.width=n.pageWidth+"px",n.book.style.height=n.pageHeight*2+"px";if(t.paging==="single"){n.transformDegrees=[e._rot0,e._rot0,e._rot0];switch(t.binding){case"center":n.transformDegrees=[e._rot0,e._rot90,e._rotNeg90],n.transformOrigin="50% 50%";break;case"middle":n.transformDegrees=[e._rot0,e._rot90,e._rotNeg90],n.transformOrigin="50% 50%";break;case"left":n.transformOrigin=n.originZero;break;case"top":n.transformOrigin=n.originZero;break;case"right":n.transformOrigin=n.pageWidth+"px 0px";break;case"bottom":n.transformDegrees=[e._rot0,e._rot0,e._rotNeg270],n.transformOrigin="0px "+pageHeight+"px"}}if(n.paging==="double"){switch(t.binding){case"left":n.transformOrigin=n.pageWidth+"px 0px";break;case"right":n.transformOrigin=n.pageWidth+"px 0px";break;case"top":n.transformOrigin="0px "+n.pageHeight+"px";break;case"bottom":n.transformOrigin="0px "+n.pageHeight+"px"}n.transformDegrees=[e._rot0,e._rot0]}return n.pageClass=n.pageClass,e.onPageTrigger=document.createEvent("Event"),e.onPageTrigger.initEvent("onPageTrigger",!0,!0),e.AnimGenerator(n),e.pageBuilder(n),d={bookName:n.book.id,realPageCount:n.realPageCount,book:document.getElementById(n.bookName),pageNumber:function(){return parseInt(document.getElementById(n.bookName).getAttribute("data-page-number"),10)},nxtPage:function(){var t,r,i;t=this.pageNumber(),n.paging==="single"&&t<1&&(t=1),n.paging==="double"&&(t===0&&(document.getElementById(n.bookName).setAttribute("data-page-number","1"),t=this.pageNumber()),t%2!==1&&t++),r={pageId:t,pageName:n.pageName,bookName:n.bookName,binding:n.binding,wrap:n.wrap,speed:n.speed,randomizer:n.randomize,transformOrigin:n.transformOrigin,paging:n.paging,realPageCount:n.realPageCount,piggyBg:n.piggyBg},i=document.getElementById(n.bookName).getAttribute("data-state"),n.paging==="single"?n.binding!=="center"&&n.binding!=="middle"?t===n.realPageCount&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number","1")):t<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+1)):t===n.realPageCount&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number","1")):t<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.abPageTurn(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+1)):(document.getElementById(n.bookName).getAttribute("data-page-number")<n.realPageCount&&i==="paused"&&(alice.plugins.caterpillar.turnPage(r),document.getElementById(n.bookName).setAttribute("data-page-number",t+2)),document.getElementById(n.bookName).getAttribute("data-page-number")>=n.realPageCount&&document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)),document.getElementById(n.bookName).dispatchEvent(e.onPageTrigger)},prePage:function(){var t,r,i;n.paging==="single"?t=this.pageNumber()-1:t=this.pageNumber(),n.paging==="double"&&t%2!==0&&t--,r={pageId:t,pageName:n.pageName,bookName:n.bookName,binding:n.binding,wrap:n.wrap,speed:n.speed,randomizer:n.randomize,transformOrigin:n.transformOrigin,paging:n.paging,realPageCount:n.realPageCount,transformRotate:n.transformRotate,originZero:n.originZero},i=document.getElementById(n.bookName).getAttribute("data-state"),n.paging==="single"?n.binding!=="center"&&n.binding!=="middle"?n.wrap===!0?t===0?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t)):t===1?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",1)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t)):t===0&&n.wrap===!0?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",n.realPageCount)):t>1?i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",t)):i==="paused"&&(alice.plugins.caterpillar.abPageTurnR(r),document.getElementById(n.bookName).setAttribute("data-page-number",1)):t!==0?i==="paused"&&(alice.plugins.caterpillar.turnPage(r),document.getElementById(n.bookName).setAttribute("data-page-number",t-=2),t===0&&document.getElementById(n.bookName).setAttribute("data-page-number","1")):document.getElementById(n.bookName).setAttribute("data-page-number","1"),document.getElementById(n.bookName).dispatchEvent(e.onPageTrigger)},appendPages:function(t){var r=document.getElementById(n.bookName),i=n.realPageCount,s=n.paging,o=document.getElementById(n.bookName+"p_1"),u=document.getElementById(n.bookName+"p_2"),a=document.getElementById(t).childNodes,f=n.realPageCount+1,l=[];for(var c=0;c<a.length;c++)if(a[c].nodeType===1)if(a[c].tagName==="DIV"||a[c].tagName==="div"){if(f%2===1){var h=s==="single"?u:o;a[c].setAttribute("style",h.getAttribute("style"))}f%2===0&&a[c].setAttribute("style",u.getAttribute("style")),a[c].style.display="none",a[c].setAttribute("class",o.getAttribute("class")),a[c].setAttribute("id",n.pageName+f),e.eventListenerFunc(f,n),r.appendChild(a[c]),n.realPageCount=n.realPageCount+1,f++}}},d},eventListenerFunc:function(t,n){var r=document.getElementById(n.pageName+t);r.addEventListener(e.animationEnd,function(){if(n.paging==="single"){var r=n.pageName+t;this.style[alice.prefixJS+"AnimationName"]===n.pageName+"abstrPageTurnF"&&((n.binding==="center"||n.binding==="middle")&&alice.plugins.caterpillar.abstrPageFlip(r,"forwards",n.bookName,n),e.clearSinglePages(r,"forwards",n.pageName,n.bookName,n)),this.style[alice.prefixJS+"AnimationName"]===n.pageName+"abstrPageReTurnF"&&((n.binding==="center"||n.binding==="middle")&&alice.plugins.caterpillar.abstrPageFlip(r,"reverse",n.bookName,n),e.clearSinglePages(r,"reverse",n.pageName,n.bookName,n))}if(n.paging==="double"){this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_oddPageTurnF"&&(e.turnNextPage(this.getAttribute("id"),"odd",n.bookName,n),e.clearDoublePages("forward",n.binding,this.getAttribute("id"),n));if(this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_oddPageTurnR"){e.clearDoublePages("reverse",e.binding,this.getAttribute("id"),n),document.getElementById(n.bookName).setAttribute("data-state","paused");var i=e.helper.getThisId(this.getAttribute("id"));i=parseInt(i,10)+2,i<n.realPageCount+1&&(document.getElementById(n.pageName+i).style.display="none")}this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_evenPageTurnF"&&(e.clearDoublePages("forward",n.binding,this.getAttribute("id"),n),document.getElementById(n.bookName).setAttribute("data-state","paused")),this.style[alice.prefixJS+"AnimationName"]===n.bookName+"p_evenPageTurnR"&&(e.turnNextPage(this.getAttribute("id"),"even",n.bookName,n),e.clearDoublePages("reverse",n.binding,this.getAttribute("id"),n))}},!1)},pageBuilder:function(t){var n=t.pages[0].getAttribute("class"),r=n+" "+t.pageClass,i="."+t.NewPageClass+"{ display: none; "+alice.prefix+"box-shadow: "+t.shadowPattern100+";"+alice.prefix+"backface-visibility: hidden;"+"width: "+t.pageWidth+"px;"+"height: "+t.pageHeight+"px;"+"position: absolute;"+"border: none;"+"left: 0px;"+"top: 0px;"+"z-index: 0;"+"overflow: hidden;"+"}";alice.keyframeInsert(i);var s=1,o,u;for(u=0;u<t.pages.length;u++)t.pages[u].setAttribute("id",t.pageName+s),t.pages[u].setAttribute("class",r+" "+t.NewPageClass),e.eventListenerFunc(s,t),e.styleConfig({pageId:s,pageName:t.pageName,binding:t.binding,paging:t.paging,bookName:t.bookName,pageWidth:t.pageWidth,pageHeight:t.pageHeight,speed:t.speed,randomizer:t.randomize,transformOrigin:t.transformOrigin,transformRotate:t.transformRotate,originZero:t.originZero}),t.paging==="single"?s===1&&(t.pages[u].style.display="block",t.pages[u].setAttribute("style","display: block; z-index: 1;"+alice.prefix+"transform-origin:"+t.transformOrigin+";"+alice.prefix+"transform: "+t.transformRotate+e._rot0+";"+alice.prefix+"box-shadow: "+t.shadowPatternRev100+";")):t.paging==="double"&&s===1&&(t.pages[u].style.display="block",t.pages[u].style[alice.prefixJS+"BoxShadow"]=t.shadowPattern100+";"),s++;return e},abstrPageFlip:function(t,n,r,i){var s,o,u,a,f;n==="forwards"?(s=e.helper.getThisId(t)+1,o=r+"p_abstrPageTurnR",s===i.realPageCount+1&&(s=1)):n==="reverse"&&(o=r+"p_abstrPageReTurnR",s=e.helper.getThisId(t)-1),(i.binding==="center"||i.binding==="middle")&&s===0&&(s=i.realPageCount),u=i.book.querySelector("div:nth-child("+s+")").getAttribute("id"),a=document.getElementById(u),a.style[alice.prefixJS+"Transform"]=i.transformRotate+e._rotNeg90,e.styleConfig({pageId:s,pageName:i.pageName,binding:i.binding,paging:i.paging,bookName:i.bookName,wrap:i.wrap,animationRunning:!0,speed:i.speed,randomizer:i.randomize,transformOrigin:i.transformOrigin,transformRotate:i.transformRotate}),a.style[alice.prefixJS+"AnimationName"]=o,f=alice.randomize(alice.duration(i.speed),i.randomize)+"ms",e.helper.setAnimationDefaults(a,f),a.addEventListener(e.animationEnd,function(){a.style[alice.prefixJS+"AnimationName"]===o&&(e.clearSinglePages(u,n,i.pageName,i.bookName,i,"doNotHide"),document.getElementById(i.bookName).setAttribute("data-state","paused"))},!1)},abPageTurn:function(t){var n,r,i,s,o;n=t.pageId>=t.realPageCount?1:t.pageId+1;if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){t.pageId===0&&t.wrap===!0&&(t.binding==="center"||t.binding==="middle")&&(pageId=t.realPageCount),r=document.getElementById(t.pageName+t.pageId),i,s;try{t.pageId>=t.realPageCount&&t.wrap===!0&&(t.pageId=0),i=document.getElementById(t.bookName).querySelector("div:nth-child("+(t.pageId+1)+")").getAttribute("id"),s=document.getElementById(i),s.style.display="block";if(t.binding==="center"||t.binding==="middle")s.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot90}catch(u){if(t.wrap!==!0)return console.log("This is the end of the book!"),!1}r.style.zIndex="100",r.style[alice.prefixJS+"AnimationName"]=t.pageName+"abstrPageTurnF",document.getElementById(t.bookName).setAttribute("data-state","running"),o=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(r,o),t.binding!=="center"&&t.binding!=="middle"&&e.helper.piggyback(t.pageId,"standard",t.pageName,t.bookName,o,t.transformOrigin,t.binding,t.transformRotate,t.realPageCount,t.piggyBg)}},abPageTurnR:function(t){if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){var n,r,i;(t.binding==="center"||t.binding==="middle")&&t.pageId!==0&&(r=document.getElementById(t.pageName+t.pageId),r.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg90,t.pageId++),n=document.getElementById(t.pageName+t.pageId),t.binding!=="center"&&t.binding!=="middle"?t.pageId===0&&t.wrap===!0&&(n=document.getElementById(t.pageName+t.realPageCount),document.getElementById(t.bookName).setAttribute("data-page-number",t.realPageCount)):t.pageId===0&&t.wrap===!0&&(n=document.getElementById(t.pageName+"1"));try{n.style.zIndex="10"}catch(s){if(t.wrap!==!0)return console.log("This is the start of the book!"),!1}switch(t.binding){case"left":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg270;break;case"bottom":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rotNeg270;break;case"top":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot270;break;case"right":n.style[alice.prefixJS+"Transform"]=t.transformRotate+e._rot270}n.style[alice.prefixJS+"AnimationName"]=t.pageName+"abstrPageReTurnF",document.getElementById(t.bookName).setAttribute("data-state","running"),i=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(n,i),t.binding!=="center"&&t.binding!=="middle"&&e.helper.piggyback(t.pageId,"advanced",t.pageName,t.bookName,i,t.transformOrigin,t.binding,t.transformRotate,t.realPageCount,t.piggyBg)}},turnNextPage:function(t,n,r,i){var s,o,u,a,f;s=e.helper.getThisId(t),s=n==="odd"?s+1:s-1,a=n==="even"?r+"p_oddPageTurnR":r+"p_evenPageTurnF",o=document.getElementById(r).querySelector("div:nth-child("+s+")").getAttribute("id"),u=document.getElementById(o),u.style.zIndex=1,n==="odd"&&(u.style.display="block"),u.style[alice.prefixJS+"AnimationName"]=a,f=alice.randomize(alice.duration(i.speed),i.randomize)+"ms",e.helper.setAnimationDefaults(u,f)},turnPage:function(t){if(document.getElementById(t.bookName).getAttribute("data-state")==="paused"){var n,r,i,s,o,u,a;t.pageId%2===1?(n=t.pageId+2,r=t.bookName+"p_oddPageTurnF"):(n=t.pageId-2,r=t.bookName+"p_evenPageTurnR"),o=document.getElementById(t.bookName).querySelector("div:nth-child("+n+")"),o&&(o=o.getAttribute("id"),u=document.getElementById(o),u.style.zIndex="0",u.style.display="block"),i=document.getElementById(t.pageName+t.pageId),i.style.zIndex="1",i.style[alice.prefixJS+"AnimationName"]=r,document.getElementById(t.bookName).setAttribute("data-state","running"),a=alice.randomize(alice.duration(t.speed),t.randomizer)+"ms",e.helper.setAnimationDefaults(i,a)}}};return e}(),alice.plugins.book=function(e){"use strict";console.info("book: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"left",paging:"double"};return console.log(t),alice.plugins.caterpillar.init(t)},alice.plugins.notebook=function(e){"use strict";console.info("notebook: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"top",paging:"single",wrap:e.wrap||!1,piggyBg:e.pageBackground||"#222"};return console.log(t),alice.plugins.caterpillar.init(t)},alice.plugins.flipbook=function(e){"use strict";console.info("flipbook: ",arguments),e||(e="");var t={elems:e.elems||alice.anima,pageClass:e.pageClass||"",bookWidth:e.bookWidth||document.getElementById(e.elems||alice.anima).style.width,bookHeight:e.bookHeight||document.getElementById(e.elems||alice.anima).style.height,shadow:e.shadow||!1,speed:e.speed||"500ms",randomize:e.randomize||"15%",binding:e.binding||"center",paging:"single",wrap:e.wrap||!1};return console.log(t),alice.plugins.caterpillar.init(t)};
View
BIN  build/alice.min.js.gz
Binary file not shown
View
2  src/alice.plugins.caterpillar.js
@@ -820,7 +820,7 @@ alice.plugins.caterpillar = (function () {
}else{
if(runState === "paused"){
alice.plugins.caterpillar.abPageTurnR(dets);
- document.getElementById(config.bookName).setAttribute('data-page-number', (pageNum-1));
+ document.getElementById(config.bookName).setAttribute('data-page-number', pageNum);
}
}
}else{
Please sign in to comment.
Something went wrong with that request. Please try again.