|
|
(function(e,t,n,o){e.fn.shape=function(t){var i,a=e(this),s=e.extend(!0,{},e.fn.shape.settings,t),r="."+s.namespace,c="module-"+s.namespace,l=a.selector||"",u=(new Date).getTime(),d=[],f=arguments[0],m="string"==typeof f,p=[].slice.call(arguments,1);return a.each(function(){var t,g,h,v=e(this),b=v.find(s.selector.sides),y=v.find(s.selector.side),x="transitionend msTransitionEnd oTransitionEnd webkitTransitionEnd",w=this,C=v.data(c),k=(s.namespace,s.error),T=s.className;h={initialize:function(){h.verbose("Initializing module for",w),h.set.defaultSide(),C=h,v.data(c,C)},destroy:function(){h.verbose("Destroying previous module for",w),v.removeData(c).off(r)},refresh:function(){h.verbose("Refreshing selector cache for",w),v=e(w),b=e(this).find(s.selector.shape),y=e(this).find(s.selector.side)},repaint:function(){h.verbose("Forcing repaint event");var e=b.get(0)||n.createElement("div");e.offsetWidth},animate:function(n,o){h.verbose("Animating box with properties",n),o=o||function(t){h.reset(),h.set.active(),e.proxy(s.onChange,g)(),t.stopImmediatePropagation()},s.useCSS?(h.verbose("Starting CSS animation"),v.addClass(T.animating),h.set.stageSize(),h.repaint(),v.addClass(T.css),t.addClass(T.hidden),b.css(n).one(x,o)):(h.verbose("Starting javascript animation"),v.addClass(T.animating).removeClass(T.css),h.set.stageSize(),h.repaint(),t.animate({opacity:0},s.duration,s.easing),b.animate(n,s.duration,s.easing,o))},queue:function(e){h.debug("Queueing animation of",e),b.one(x,function(){h.debug("Executing queued animation"),v.shape(e)})},reset:function(){h.verbose("Animating states reset"),v.removeClass(T.css).removeClass(T.animating).removeAttr("style"),b.removeAttr("style"),y.removeAttr("style").removeClass(T.hidden),g.removeClass(T.animating).removeAttr("style")},is:{animating:function(){return v.hasClass(T.animating)}},get:{nextSide:function(){return t.next(s.selector.side).size()>0?t.next(s.selector.side):v.find(s.selector.side).first()}},set:{defaultSide:function(){t=v.find("."+s.className.active),g=t.next(s.selector.side).size()>0?t.next(s.selector.side):v.find(s.selector.side).first(),h.verbose("Active side set to",t),h.verbose("Next side set to",g)},stageSize:function(){var e={width:g.outerWidth(),height:g.outerHeight()};h.verbose("Resizing stage to fit new content",e),v.css({width:e.width,height:e.height})},nextSide:function(e){g=v.find(e),0===g.size()&&h.error(k.side),h.verbose("Next side manually set to",g)},active:function(){h.verbose("Setting new side to active",g),y.removeClass(T.active),g.addClass(T.active),h.set.defaultSide()}},flip:{up:function(){h.debug("Flipping up",g),h.is.animating()?h.queue("flip.up"):(h.stage.above(),h.animate(h.getTransform.up()))},down:function(){h.debug("Flipping down",g),h.is.animating()?h.queue("flip.down"):(h.stage.below(),h.animate(h.getTransform.down()))},left:function(){h.debug("Flipping left",g),h.is.animating()?h.queue("flip.left"):(h.stage.left(),h.animate(h.getTransform.left()))},right:function(){h.debug("Flipping right",g),h.is.animating()?h.queue("flip.right"):(h.stage.right(),h.animate(h.getTransform.right()))},over:function(){h.debug("Flipping over",g),h.is.animating()?h.queue("flip.over"):(h.stage.behind(),h.animate(h.getTransform.behind()))}},getTransform:{up:function(){var e={y:-((t.outerHeight()-g.outerHeight())/2),z:-(t.outerHeight()/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(-90deg)"}},down:function(){var e={y:-((t.outerHeight()-g.outerHeight())/2),z:-(t.outerHeight()/2)};return{transform:"translateY("+e.y+"px) translateZ("+e.z+"px) rotateX(90deg)"}},left:function(){var e={x:-((t.outerWidth()-g.outerWidth())/2),z:-(t.outerWidth()/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(90deg)"}},right:function(){var e={x:-((t.outerWidth()-g.outerWidth())/2),z:-(t.outerWidth()/2)};return{transform:"translateX("+e.x+"px) translateZ("+e.z+"px) rotateY(-90deg)"}},behind:function(){var e={x:-((t.outerWidth()-g.outerWidth())/2)};return{transform:"translateX("+e.x+"px) rotateY(180deg)"}}},stage:{above:function(){var e={origin:(t.
|