Regalamiunsorriso/www/js/flipbook.book3.min.js

5 lines
16 KiB
JavaScript
Raw Normal View History

2026-03-14 20:04:39 +01:00
/* v 3.17
author http://codecanyon.net/user/creativeinteractivemedia/portfolio?ref=creativeinteractivemedia
*/
var FLIPBOOK=FLIPBOOK||{};FLIPBOOK.Book3=function(t,e,i){this.options=i,this.model=e,this.singlePage=i.singlePageMode,this.pageWidth=this.options.pageWidth,this.pageHeight=this.options.pageHeight,this.wrapper=t,this.$wrapper=jQuery(this.wrapper).addClass("flipbook-book3"),this.$bookLayer=this.$wrapper.parent(),this.bookLayer=this.$bookLayer[0],this.flipEasing="easeInOutCubic",this.flipEasing="easeOutSine",this.flipEasing="easeOutQuad",this.scroll=new FLIPBOOK.IScroll(this.bookLayer,{zoom:!0,scrollX:!0,scrollY:!0,scrollbars:!0,keepInCenterV:!0,keepInCenterH:!0,freeScroll:!0,preventDefault:!1});var o=this;e.on("toolMove",function(){o.updateTool()}),e.on("toolSelect",function(){o.updateTool()}),this.scroll.on("zoomEnd",function(){var t;isNaN(o.scroll.scale)?o.zoomTo(i.zoomMin):(i.main.onZoom(o.scroll.scale/o.ratio),t=i.main.zoom,o.scroll.options.eventPassthrough=1<t?"":"vertical",o.scroll.options.freeScroll=1<t,o.scroll.refresh())}),this.scroll.on("zoomStart",function(){});var s=this.wrapper.style;s.width=String(2*this.pageWidth)+"px",s.height=String(this.pageHeight)+"px";var n,a=3*this.pageHeight+"px";this.$centerContainer=jQuery("<div>").appendTo(this.$wrapper).addClass("flipbook-center-container3"),this.$centerContainer.css({"-webkit-perspective":a,perspective:a}),this.centerContainerStyle=this.$centerContainer[0].style,this.centerContainerStyle.width=2*this.pageWidth+"px",this.centerContainerStyle.height=this.pageHeight+"px",this.pagesArr=[],this.animating=!1,this.setRightIndex(i.rightToLeft?i.pages.length:0),o.updateFlipped(),this.numPages=i.pages.length;for(var h=0;h<i.numPages;h++)(n=new FLIPBOOK.Page3(this,h,i.pages[h].src,i.pages[h].htmlContent)).hideHtml(),this.pagesArr.push(n),this.$centerContainer.append(n.$wrapper),this.flippedright++;this.pagesArr[0].show(),this.nextEnabled=!0,this.prevEnabled=!0},FLIPBOOK.Book3.prototype=Object.create(FLIPBOOK.Book.prototype),FLIPBOOK.Book3.prototype.constructor=FLIPBOOK.Book3,FLIPBOOK.Book3.prototype.enableMouseWheelZoom=function(){this.scroll.options.eventPassthrough="vertical",this.scroll.refresh()},FLIPBOOK.Book3.prototype.disableMouseWheelZoom=function(){this.scroll.options.eventPassthrough="",this.scroll.refresh()},FLIPBOOK.Book3.prototype.enablePrev=function(t){this.prevEnabled=t},FLIPBOOK.Book3.prototype.enablePan=function(){this.scroll.enable()},FLIPBOOK.Book3.prototype.disablePan=function(){this.scroll.disable()},FLIPBOOK.Book3.prototype.setRightIndex=function(t){this.rightIndex=t},FLIPBOOK.Book3.prototype.updateTool=function(){switch(this.options.main.tool){case"toolSelect":this.disablePan(),jQuery(".flipbook-textLayer").css("pointer-events","auto").removeClass(".flipbook-noselect");break;case"toolMove":this.enablePan(),jQuery(".flipbook-textLayer").css("pointer-events","none").addClass(".flipbook-noselect")}},FLIPBOOK.Book3.prototype.enableNext=function(t){this.nextEnabled=t},FLIPBOOK.Book3.prototype.isZoomed=function(){return this.options.main.zoom>this.options.zoomMin&&1<this.options.main.zoom},FLIPBOOK.Book3.prototype.onZoom=function(){},FLIPBOOK.Book3.prototype.getNumPages=function(){},FLIPBOOK.Book3.prototype.move=function(t){if(!(this.zoom<=1)){var e=this.scroll;if(e){var i=e.x,o=e.y,s=20*this.zoom;switch(t){case"left":i+=s;break;case"right":i-=s;break;case"up":o+=s;break;case"down":o-=s}0<i&&(i=0),i<e.maxScrollX&&(i=+e.maxScrollX),0<o&&(o=0),o<e.maxScrollY&&(o=+e.maxScrollY),e.scrollTo(i,o,0)}}},FLIPBOOK.Book3.prototype.zoomTo=function(t,e,i,o){var s;this.enabled&&(i=i||0,o=o||0,e=e||0,this.zoom=t,e=0,(s=this.scroll)&&s.zoom(t*this.ratio,i,o,e))},FLIPBOOK.Book3.prototype.setWrapperW=function(t){this.$wrapperW!=t&&(this.$wrapper.width(t),this.$wrapperW=t)},FLIPBOOK.Book3.prototype.updateBookPosition=function(){if(this.options.singlePageMode)return this.setWrapperW(this.pageWidth),this.$wrapper.width(this.pageWidth),this.scroll&&this.scroll.refresh(),this.view=1,void this.focusRight();1==this.view?this.setWrapperW(this.pageWidth):this.setWrapperW(2*this.pageWidth),this.scroll&&this.scroll.refresh(),2==this.view?this.isCover()?this.focusRight():this.isBackCov