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