You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
7.1 KiB

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