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

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