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
9.2 KiB

10 years ago
  1. !function(a,b,c,d){"use strict";a.fn.shape=function(e){var f,g=a(this),h=a("body"),i=(new Date).getTime(),j=[],k=arguments[0],l="string"==typeof k,m=[].slice.call(arguments,1),n=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};return g.each(function(){var b,o,p,q=g.selector||"",r=a.extend(!0,{},a.fn.shape.settings,e),s=r.namespace,t=r.selector,u=r.error,v=r.className,w="."+s,x="module-"+s,y=a(this),z=y.find(t.sides),A=y.find(t.side),B=!1,C=this,D=y.data(x);p={initialize:function(){p.verbose("Initializing module for",C),p.set.defaultSide(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),D=p,y.data(x,D)},destroy:function(){p.verbose("Destroying previous module for",C),y.removeData(x).off(w)},refresh:function(){p.verbose("Refreshing selector cache for",C),y=a(C),z=a(this).find(t.shape),A=a(this).find(t.side)},repaint:function(){p.verbose("Forcing repaint event");{var a=z.get(0)||c.createElement("div");a.offsetWidth}},animate:function(c,e){p.verbose("Animating box with properties",c),e=e||function(a){p.verbose("Executing animation callback"),a!==d&&a.stopPropagation(),p.reset(),p.set.active()},a.proxy(r.beforeChange,o[0])(),p.get.transitionEvent()?(p.verbose("Starting CSS animation"),y.addClass(v.animating),z.css(c).one(p.get.transitionEvent(),e),p.set.duration(r.duration),n(function(){y.addClass(v.animating),b.addClass(v.hidden)})):e()},queue:function(a){p.debug("Queueing animation of",a),z.one(p.get.transitionEvent(),function(){p.debug("Executing queued animation"),setTimeout(function(){y.shape(a)},0)})},reset:function(){p.verbose("Animating states reset"),y.removeClass(v.animating).attr("style","").removeAttr("style"),z.attr("style","").removeAttr("style"),A.attr("style","").removeAttr("style").removeClass(v.hidden),o.removeClass(v.animating).attr("style","").removeAttr("style")},is:{animating:function(){return y.hasClass(v.animating)}},set:{defaultSide:function(){b=y.find("."+r.className.active),o=b.next(t.side).size()>0?b.next(t.side):y.find(t.side).first(),B=!1,p.verbose("Active side set to",b),p.verbose("Next side set to",o)},duration:function(a){a=a||r.duration,a="number"==typeof a?a+"ms":a,p.verbose("Setting animation duration",a),z.add(A).css({"-webkit-transition-duration":a,"-moz-transition-duration":a,"-ms-transition-duration":a,"-o-transition-duration":a,"transition-duration":a})},stageSize:function(){var a=y.clone().addClass(v.loading),b=a.find("."+r.className.active),c=B?a.find(B):b.next(t.side).size()>0?b.next(t.side):a.find(t.side).first(),d={};b.removeClass(v.active),c.addClass(v.active),a.prependTo(h),d={width:c.outerWidth(),height:c.outerHeight()},a.remove(),y.css(d),p.verbose("Resizing stage to fit new content",d)},nextSide:function(a){B=a,o=y.find(a),0===o.size()&&p.error(u.side),p.verbose("Next side manually set to",o)},active:function(){p.verbose("Setting new side to active",o),A.removeClass(v.active),o.addClass(v.active),a.proxy(r.onChange,o[0])(),p.set.defaultSide()}},flip:{up:function(){p.debug("Flipping up",o),p.is.animating()?p.queue("flip up"):(p.set.stageSize(),p.stage.above(),p.animate(p.get.transform.up()))},down:function(){p.debug("Flipping down",o),p.is.animating()?p.queue("flip down"):(p.set.stageSize(),p.stage.below(),p.animate(p.get.transform.down()))},left:function(){p.debug("Flipping left",o),p.is.animating()?p.queue("flip left"):(p.set.stageSize(),p.stage.left(),p.animate(p.get.transform.left()))},right:function(){p.debug("Flipping right",o),p.is.animating()?p.queue("flip right"):(p.set.stageSize(),p.stage.right(),p.animate(p.get.transform.right()))},over:function(){p.debug("Flipping over",o),p.is.animating()?p.queue("flip over"):(p.set.stageSize(),p.stage.behind(),p.animate(p.get.transform.over()))},back:function(){p.debug("Flipping back",o),p.is.animating()?p.queue("flip back"):(p.set.stageSize(),p.stage.behind(),p.animate(p.get.transform.back()))}},get:{transform:{up:function(){var a={y:-((b.outerHeight()-o.outerHeight())/2),z:-(b.outerHeight()/2)};return{tr