assets.js.libs.turn.html4.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groupdocs-viewer Show documentation
Show all versions of groupdocs-viewer Show documentation
GroupDocs.Viewer for Java is a powerful document viewer component
that allows you to display over 50 document formats in your Java applications.
The viewer can both rasterize documents and convert them to SVG+HTML+CSS, delivering true-text high-fidelity rendering.
Supported file formats include: Microsoft Office, Microsoft Visio, Microsoft Project, Outlook documents, PDF, AutoCAD, Image files (JPG, BMP, GIF, TIFF, etc.) and many more formats.
/* turn.js 4.0.8 | Copyright (c) 2012 Emmanuel Garcia | turnjs.com | turnjs.com/license-4.txt */
(function(g){function r(a,b,c){if(!c[0]||"object"==typeof c[0])return b.init.apply(a,c);if(b[c[0]])return b[c[0]].apply(a,Array.prototype.slice.call(c,1));throw l(c[0]+" is an invalid value");}function p(a,b,c,d){return{css:{position:"absolute",top:a,left:b,overflow:d||"hidden","z-index":c||"auto"}}}function s(a,b,c,d,e){var f=1-e,g=f*f*f,k=e*e*e;return m(Math.round(g*a.x+3*e*f*f*b.x+3*e*e*f*c.x+k*d.x),Math.round(g*a.y+3*e*f*f*b.y+3*e*e*f*c.y+k*d.y))}function m(a,b){return{x:a,y:b}}function j(a,b){return Object.prototype.hasOwnProperty.call(b,
a)}function l(a){function b(a){this.name="TurnJsError";this.message=a}b.prototype=Error();b.prototype.constructor=b;return new b(a)}function u(){return""}var q="",n={down:"mousedown",move:"mousemove",up:"mouseup",over:"mouseover",out:"mouseout"},o={backward:["l"],forward:["r"],all:["l","r"]},w=["single","double"],x=["ltr","rtl"],y={acceleration:!0,display:"double",duration:600,page:1,gradients:!0,when:null},z={acceleration:!0,corners:"forward",cornerSize:100,duration:600,gradients:!0},i={init:function(a){if(1<
this.length)throw l("This selector has more than 1 element");for(var b=["Moz","Webkit","Khtml","O","ms"],c=b.length,d="";c--;)b[c]+"Transform"in document.body.style&&(d="-"+b[c].toLowerCase()+"-");q=d;var e,b=0,f=this.data(),c=this.children(),a=g.extend({width:this.width(),height:this.height(),direction:this.attr("dir")||this.css("direction")||"ltr"},y,a);f.opts=a;f.pageObjs={};f.pages={};f.pageWrap={};f.pagePlace={};f.pageMv=[];f.zoom=1;f.totalPages=a.pages||0;f.docEvents={mouseStart:function(a){for(var b in f.pages)if(j(b,
f.pages)&&!1===h._eventStart.call(f.pages[b],a))return!1},mouseMove:function(a){for(var b in f.pages)j(b,f.pages)&&h._eventMove.call(f.pages[b],a)},mouseEnd:function(a){for(var b in f.pages)j(b,f.pages)&&h._eventEnd.call(f.pages[b],a)}};if(a.when)for(e in a.when)j(e,a.when)&&this.bind(e,a.when[e]);this.css({position:"relative",width:a.width,height:a.height});this.turn("display",a.display);""!==a.direction&&this.turn("direction",a.direction);for(e=0;ef)throw l('Page "'+
b+'" cannot be inserted');}else b=f,d=!0;1<=b&&b<=f&&(c="double"==e.display?b%2?" odd":" even":"",e.done&&this.turn("stop"),b in e.pageObjs&&i._movePages.call(this,b,1),d&&(e.totalPages=f),e.pageObjs[b]=g(a).css({"float":"left"}).addClass("page p"+b+c),i._addPage.call(this,b),e.done&&this.turn("update"),i._removeFromDOM.call(this));return this},_addPage:function(a){var b=this.data(),c=b.pageObjs[a];if(c)if(i._necessPage.call(this,a)){if(!b.pageWrap[a]){var d=i._pageSize.call(this,a,!0);c.css({width:d.width,
height:d.height});b.pagePlace[a]=a;b.pageWrap[a]=g("",{"class":"turn-page-wrapper",page:a,css:{position:"absolute",overflow:"hidden"}}).css(d);this.append(b.pageWrap[a]);b.pageWrap[a].prepend(b.pageObjs[a])}(!a||1==i._setPageLoc.call(this,a))&&i._makeFlip.call(this,a)}else b.pagePlace[a]=0,b.pageObjs[a]&&b.pageObjs[a].remove()},hasPage:function(a){return j(a,this.data().pageObjs)},center:function(a){var b=this.data(),c=g(this).turn("size"),d=c.width/(2*b.zoom)-c.width/2;"double"==b.display&&
(a=this.turn("view",a||b.tpage||b.page),"ltr"==b.direction?a[0]?a[1]||(d+=c.width/4):d-=c.width/4:a[0]?a[1]||(d-=c.width/4):d+=c.width/4);g(this).css({marginLeft:d});return this},destroy:function(){var a=this.data();a.destroying=!0;g(this).unbind(n.down).unbind("end").unbind("first").unbind("flip").unbind("last").unbind("pressed").unbind("released").unbind("start").unbind("turning").unbind("turned").unbind("zooming");for(g(document).unbind(n.move,a.docEvents.mouseMove).unbind(n.up,a.docEvents.mouseEnd);0!==
a.totalPages;)this.turn("removePage",a.totalPages);a.fparent&&a.fparent.remove();a.shadow&&a.shadow.remove();this.removeData();return this},is:function(){return"object"==typeof this.data().pages},zoom:function(a){var b=this.data();if("number"==typeof a){if(0.0010>a||100this.data().totalPages)){b=this.turn("range");for(a=b[0];a<=b[1];a++)i._addPage.call(this,a)}},range:function(a){var b,c,d,e=this.data(),a=a||e.tpage||e.page||1;d=i._view.call(this,a);if(1>a||a>e.totalPages)throw l('"'+a+'" is not a page for range');d[1]=d[1]||d[0];1<=d[0]&&d[1]<=e.totalPages?(a=Math.floor(2),e.totalPages-d[1]>d[0]?(b=Math.min(d[0]-1,a),c=2*a-b):(c=Math.min(e.totalPages-d[1],a),b=2*a-c)):c=b=5;return[Math.max(1,d[0]-
b),Math.min(e.totalPages,d[1]+c)]},_necessPage:function(a){if(0===a)return!0;var b=this.data(),c=this.turn("range");return b.pageObjs[a].hasClass("fixed")||a>=c[0]&&a<=c[1]},_removeFromDOM:function(){var a,b=this.data();for(a in b.pageWrap)j(a,b.pageWrap)&&!i._necessPage.call(this,a)&&i._removePageFromDOM.call(this,a)},_removePageFromDOM:function(a){var b=this.data();if(b.pages[a]){var c=b.pages[a].data();h._moveFoldingPage.call(b.pages[a],!1);c.f&&c.f.fwrapper&&c.f.fwrapper.remove();b.pages[a].removeData();
b.pages[a].remove();delete b.pages[a]}b.pageObjs[a]&&b.pageObjs[a].remove();b.pageWrap[a]&&(b.pageWrap[a].remove(),delete b.pageWrap[a]);delete b.pagePlace[a]},removePage:function(a){var b=this.data();if(1>a||a>b.totalPages)throw l("The page "+a+" doesn't exist");b.pageObjs[a]&&(this.turn("stop"),i._removePageFromDOM.call(this,a),delete b.pageObjs[a]);i._movePages.call(this,a,-1);b.totalPages-=1;b.page>b.totalPages?this.turn("page",b.totalPages):i._makeRange.call(this);return this},_movePages:function(a,
b){var c,d=this,e=this.data(),f="single"==e.display,g=function(a){var c=a+b,g=c%2,h=g?" odd ":" even ";e.pageObjs[a]&&(e.pageObjs[c]=e.pageObjs[a].removeClass("p"+a+" odd even").addClass("p"+c+h));e.pagePlace[a]&&e.pageWrap[a]&&(e.pagePlace[c]=c,e.pageWrap[c]=e.pageObjs[c].hasClass("fixed")?e.pageWrap[a].attr("page",c):e.pageWrap[a].css(i._pageSize.call(d,c,!0)).attr("page",c),e.pages[a]&&(e.pages[c]=e.pages[a].flip("options",{page:c,next:f||g?c+1:c-1,corners:f?"all":g?"forward":"backward"})),b&&
(delete e.pages[a],delete e.pagePlace[a],delete e.pageObjs[a],delete e.pageWrap[a],delete e.pageObjs[a]))};if(0=a;c--)g(c);else for(c=a;c<=e.totalPages;c++)g(c)},display:function(a){var b=this.data(),c=b.display;if(a){if(-1==g.inArray(a,w))throw l('"'+a+'" is not a value for display');"single"==a?b.pageObjs[0]||(this.turn("stop").css({overflow:"hidden"}),b.pageObjs[0]=g("",{"class":"page p-temporal"}).css({width:this.width(),height:this.height()}).appendTo(this)):b.pageObjs[0]&&
(this.turn("stop").css({overflow:""}),b.pageObjs[0].remove(),delete b.pageObjs[0]);b.display=a;c&&(a=this.turn("size"),i._movePages.call(this,1,0),this.turn("size",a.width,a.height).turn("update"));return this}return c},direction:function(a){var b=this.data();if("undefined"==typeof a)return b.direction;a=a.toLowerCase();if(-1==g.inArray(a,x))throw turnError('"'+a+'" is not a value for direction');"rtl"==a&&g(this).attr("dir","ltr").css({direction:"ltr"});b.direction=a;b.done&&this.turn("size",g(this).width(),
g(this).height());return this},animating:function(){return 0a&&this.turn("page",a)}b.totalPages=a;return this}return b.totalPages},_missing:function(a){for(var b=this.data(),c=this.turn("range",a),d=[],a=c[0];a<=c[1];a++)b.pageObjs[a]||
d.push(a);0h[1]?(c=h[1],d=k[0]):h[0]&&ah[0]?"r":
"l"):e.pages[c].flip("turnPage",k[0]>h[0]?"l":"r"):e.pages[c].flip("turnPage"))},page:function(a){var a=parseInt(a,10),b=this.data();return 0b.page?b.next:b.page+1),i._addMotionPage.call(a.target));i._updateShadow.call(b.turn)},_end:function(a,b,c){g(a.target).data();var a=b.turn,d=a.data();if(c||d.tpage){if(d.tpage==
b.next||d.tpage==b.page)delete d.tpage,i._fitPage.call(a,d.tpage||b.next,!0)}else i._removeMv.call(a,b.page),i._updateShadow.call(a),a.turn("update")},_pressed:function(a){a.stopPropagation();var b,a=g(a.target).data().f,c=a.opts.turn.data().pages;for(b in c)b!=a.opts.page&&c[b].flip("disable",!0);return a.time=(new Date).getTime()},_released:function(a,b){a.stopPropagation();var c,d=g(a.target),e=d.data().f,f=e.opts.turn,t=f.data();c="single"==t.display?"r"==b.corner?b.xd.width()/
2:0>b.x||b.x>d.width();if(200>(new Date).getTime()-e.time||c)a.preventDefault(),i._turnPage.call(f,e.opts.next,!1===h._cornerActivated.call(d,b,1));t.mouseAction=!1},_flip:function(a){a.stopPropagation();a=g(a.target).data().f.opts;a.turn.trigger("turn",[a.next]);a.turn.data().opts.autoCenter&&a.turn.turn("center",a.next)},calculateZ:function(a){var b,c,d,e,f=this,g=this.data();b=this.turn("view");var h=b[0]||b[1],i={pageZ:{},partZ:{},pageV:{}},j=function(a){a=f.turn("view",a);a[0]&&(i.pageV[a[0]]=
!0);a[1]&&(i.pageV[a[1]]=!0)};for(b=0;b ",{"class":"shadow",css:p(0,0,0).css}).appendTo(this));for(var h=0;h=a.x||0>=a.y||a.x>=d||a.y>=e)return!1;e=h._cAllowed.call(this);if(a.x>d-b)a.corner="r";else if(a.x",p(0,0,2)).css(c).appendTo(b).prepend(this);a.fpage=g("",p(0,0,1)).css(c).appendTo(b)}h.resize.call(this,!0)},_fold:function(a){var b=this.data().f,c=h._c.call(this,a.corner),c=c.x?c.x-a.x:a.x,d=this.width();this.height();c=Math.min(2*d,Math.max(0,c));switch(a.corner){case "r":b.wrapper.css({width:Math.max(0,
d-c)});this.css({position:"relative",left:-c});b.fpage.css({left:-c+d,width:Math.max(0,c-d)});break;case "l":b.wrapper.css({width:d}),this.css({position:"relative",left:c}),b.fpage.css({left:d,width:Math.max(0,c-d)}),b.folding&&b.folding.css({position:"relative",left:2*-d+c})}b.parent.css({overflow:"visible"});b.point=a},_moveFoldingPage:function(a){var b=this.data().f;if(a){var a=h._foldingPage.call(this),c=b.opts.turn;if(a){if(b.folding){if(b.folding===a)return;h._moveFoldingPage.call(this,!1)}h.setData.call(this,
{backParent:a.parent(),folding:a});b.fpage.prepend(a)}c.turn("update")}else b.backParent&&(b.backParent.prepend(b.folding),delete b.backParent,delete b.folding)},_showFoldedPage:function(a,b){var c=h._foldingPage.call(this),d=this.data(),e=d.f,f=e.visible;if(!f||!e.point||e.point.corner!=a.corner){e.opts.turn.data();var i=g.Event("start");this.trigger(i,[e.opts,a.corner]);f=!1;if(i.isDefaultPrevented())return!1}if(c){if(b){var k=this,c=e.point&&e.point.corner==a.corner?e.point:h._c.call(this,a.corner,
1);this.animatef({from:[c.x,c.y],to:[a.x,a.y],duration:500,frame:function(b){a.x=Math.round(b[0]);a.y=Math.round(b[1]);h._fold.call(k,a)}})}else h._fold.call(this,a),d.effect&&!d.effect.turning&&this.animatef(!1);f||(e.visible=!0,h._moveFoldingPage.call(this,!0),e.fpage.show());return!0}return!1},hide:function(){var a=this.data().f;h._foldingPage.call(this);this.css({position:"",left:"auto"});a.wrapper.css({width:this.width()});a.fpage.css({width:this.width()});a.folding&&a.folding.css({position:"",
left:"auto"});a.fpage.hide();a.visible=!1;return this},hideFoldedPage:function(a){var b=this.data().f;if(b.point){var c=this,d=b.point,e=function(){b.point=null;c.flip("hide");c.trigger("end",[b.opts,!1])};if(a){var f=h._c.call(this,d.corner),a="t"==d.corner.substr(0,1)?Math.min(0,d.y-f.y)/2:Math.max(0,d.y-f.y)/2,g=m(d.x,d.y+a),i=m(f.x,f.y-a);this.animatef({from:0,to:1,frame:function(a){a=s(d,g,i,f,a);d.x=a.x;d.y=a.y;h._fold.call(c,d)},complete:e,duration:800,hiding:!0})}else this.animatef(!1),e()}},
turnPage:function(a){var b=this,c=this.data().f,a={corner:c.corner?c.corner.corner:a||h._cAllowed.call(this)[0]},d=c.point||h._c.call(this,a.corner,c.opts.turn?c.opts.turn.data().opts.elevation:0),e=h._c2.call(this,a.corner);this.trigger("flip").animatef({from:0,to:1,frame:function(c){c=s(d,d,e,e,c);a.x=c.x;a.y=c.y;h._showFoldedPage.call(b,a)},complete:function(){b.trigger("end",[c.opts,!0])},duration:c.opts.duration,turning:!0});c.corner=null},moving:function(){return"effect"in this.data()},isTurning:function(){return this.flip("moving")&&
this.data().effect.turning},_eventStart:function(a){var b=this.data().f;if(!b.disabled&&!this.flip("isTurning")){b.corner=h._cornerActivated.call(this,a);if(b.corner&&h._foldingPage.call(this,b.corner))return h._showFoldedPage.call(this,b.corner)&&this.trigger("pressed",[b.point]),!1;b.corner=null}},_eventMove:function(a){var b=this.data().f;if(!b.disabled)if(a=[a],b.corner){var c=b.parent.offset();b.corner.x=a[0].pageX-c.left;b.corner.y=a[0].pageY-c.top;h._showFoldedPage.call(this,b.corner)}else!this.data().effect&&
this.is(":visible")&&((a=h._cornerActivated.call(this,a[0]))?(b=h._c.call(this,a.corner,b.opts.cornerSize/2),a.x=b.x,a.y=b.y,h._showFoldedPage.call(this,a,!0)):h.hideFoldedPage.call(this,!0))},_eventEnd:function(){var a=this.data().f;if(!a.disabled&&a.point){var b=g.Event("released");this.trigger(b,[a.point]);b.isDefaultPrevented()||h.hideFoldedPage.call(this,!0)}a.corner=null},disable:function(a){h.setData.call(this,{disabled:a});return this}};window.requestAnim=function(a){window.setTimeout(a,1E3/
60)};g.extend(g.fn,{flip:function(a,b){return r(this,h,arguments)},turn:function(a){return r(this,i,arguments)},transform:function(a,b){var c={};b&&(c[q+"transform-origin"]=b);c[q+"transform"]=a;return this.css(c)},animatef:function(a){var b=this.data();b.effect&&b.effect.stop();if(a){a.to.length||(a.to=[a.to]);a.from.length||(a.from=[a.from]);for(var c=[],d=a.to.length,e=!0,f=this,h=(new Date).getTime(),i=function(){if(b.effect&&e){for(var g=[],j=Math.min(a.duration,(new Date).getTime()-h),l=0;l<
d;l++)g.push(b.effect.easing(1,j,a.from[l],c[l],a.duration));a.frame(d==1?g[0]:g);if(j==a.duration){delete b.effect;f.data(b);a.complete&&a.complete()}else window.requestAnim(i)}},j=0;j