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

  1. !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,f,p,q=a(this),r=q.find(g.selector.sides),s=q.find(g.selector.side),t=this,u=q.data(i),v=(g.namespace,g.error),w=g.className;p={initialize:function(){p.verbose("Initializing module for",t),p.set.defaultSide(),u=p,q.data(i,u)},destroy:function(){p.verbose("Destroying previous module for",t),q.removeData(i).off(h)},refresh:function(){p.verbose("Refreshing selector cache for",t),q=a(t),r=a(this).find(g.selector.shape),s=a(this).find(g.selector.side)},repaint:function(){p.verbose("Forcing repaint event");var a=r.get(0)||c.createElement("div");a.offsetWidth},animate:function(a,c){p.verbose("Animating box with properties",a),c=c||function(a){p.verbose("Executing animation callback"),a!==d&&a.stopPropagation(),p.reset(),p.set.active()},g.useCSS?p.get.transitionEvent()?(p.verbose("Starting CSS animation"),q.addClass(w.animating),p.set.stageSize(),p.repaint(),q.addClass(w.css),b.addClass(w.hidden),r.css(a).one(p.get.transitionEvent(),c)):c():(p.verbose("Starting javascript animation"),q.addClass(w.animating).removeClass(w.css),p.set.stageSize(),p.repaint(),b.animate({opacity:0},g.duration,g.easing),r.animate(a,g.duration,g.easing,c))},queue:function(a){p.debug("Queueing animation of",a),r.one(p.get.transitionEvent(),function(){p.debug("Executing queued animation"),setTimeout(function(){q.shape(a)},0)})},reset:function(){p.verbose("Animating states reset"),q.removeClass(w.css).removeClass(w.animating).attr("style","").removeAttr("style"),r.attr("style","").removeAttr("style"),s.attr("style","").removeAttr("style").removeClass(w.hidden),f.removeClass(w.animating).attr("style","").removeAttr("style")},is:{animating:function(){return q.hasClass(w.animating)}},get:{transitionEvent:function(){var a,b=c.createElement("element"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in e)if(b.style[a]!==d)return e[a]},nextSide:function(){return b.next(g.selector.side).size()>0?b.next(g.selector.side):q.find(g.selector.side).first()}},set:{defaultSide:function(){b=q.find("."+g.className.active),f=b.next(g.selector.side).size()>0?b.next(g.selector.side):q.find(g.selector.side).first(),p.verbose("Active side set to",b),p.verbose("Next side set to",f)},stageSize:function(){var a={width:f.outerWidth(),height:f.outerHeight()};p.verbose("Resizing stage to fit new content",a),q.css({width:a.width,height:a.height})},nextSide:function(a){f=q.find(a),0===f.size()&&p.error(v.side),p.verbose("Next side manually set to",f)},active:function(){p.verbose("Setting new side to active",f),s.removeClass(w.active),f.addClass(w.active),a.proxy(g.onChange,f)(),p.set.defaultSide()}},flip:{up:function(){p.debug("Flipping up",f),p.is.animating()?p.queue("flip.up"):(p.stage.above(),p.animate(p.getTransform.up()))},down:function(){p.debug("Flipping down",f),p.is.animating()?p.queue("flip.down"):(p.stage.below(),p.animate(p.getTransform.down()))},left:function(){p.debug("Flipping left",f),p.is.animating()?p.queue("flip.left"):(p.stage.left(),p.animate(p.getTransform.left()))},right:function(){p.debug("Flipping right",f),p.is.animating()?p.queue("flip.right"):(p.stage.right(),p.animate(p.getTransform.right()))},over:function(){p.debug("Flipping over",f),p.is.animating()?p.queue("flip.over"):(p.stage.behind(),p.animate(p.getTransform.over()))},back:function(){p.debug("Flipping back",f),p.is.animating()?p.queue("flip.back"):(p.stage.behind(),p.animate(p.getTransform.back()))}},getTransform:{up:function(){var a={y:-((b.outerHeight()-f.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()-f.outerHeight())/2),z:-(b.outerHeight()/2)};return{transform:"translateY("+a.y+"px) translateZ("+a.z+"px) rotateX(90deg)