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