1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
|
!function(H,e,T,Z){"use strict";e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),H.fn.shape=function(v){var b,x=H(this),y=(H("body"),(new Date).getTime()),S=[],w=v,C="string"==typeof w,W=[].slice.call(arguments,1),F=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,0)};return x.each(function(){var n,a,t=x.selector||"",o=H.isPlainObject(v)?H.extend(!0,{},H.fn.shape.settings,v):H.extend({},H.fn.shape.settings),e=o.namespace,r=o.selector,i=o.error,s=o.className,d="."+e,l="module-"+e,u=H(this),c=u.find(r.sides),g=u.find(r.side),f=!1,m=this,h=u.data(l),p={initialize:function(){p.verbose("Initializing module for",m),p.set.defaultSide(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),h=p,u.data(l,h)},destroy:function(){p.verbose("Destroying previous module for",m),u.removeData(l).off(d)},refresh:function(){p.verbose("Refreshing selector cache for",m),u=H(m),c=H(this).find(r.shape),g=H(this).find(r.side)},repaint:function(){p.verbose("Forcing repaint event");(c[0]||T.createElement("div")).offsetWidth},animate:function(e,t){p.verbose("Animating box with properties",e),t=t||function(e){p.verbose("Executing animation callback"),e!==Z&&e.stopPropagation(),p.reset(),p.set.active()},o.beforeChange.call(a[0]),p.get.transitionEvent()?(p.verbose("Starting CSS animation"),u.addClass(s.animating),c.css(e).one(p.get.transitionEvent(),t),p.set.duration(o.duration),F(function(){u.addClass(s.animating),n.addClass(s.hidden)})):t()},queue:function(e){p.debug("Queueing animation of",e),c.one(p.get.transitionEvent(),function(){p.debug("Executing queued animation"),setTimeout(function(){u.shape(e)},0)})},reset:function(){p.verbose("Animating states reset"),u.removeClass(s.animating).attr("style","").removeAttr("style"),c.attr("style","").removeAttr("style"),g.attr("style","").removeAttr("style").removeClass(s.hidden),a.removeClass(s.animating).attr("style","").removeAttr("style")},is:{complete:function(){return g.filter("."+s.active)[0]==a[0]},animating:function(){return u.hasClass(s.animating)}},set:{defaultSide:function(){n=u.find("."+o.className.active),a=0<n.next(r.side).length?n.next(r.side):u.find(r.side).first(),f=!1,p.verbose("Active side set to",n),p.verbose("Next side set to",a)},duration:function(e){e="number"==typeof(e=e||o.duration)?e+"ms":e,p.verbose("Setting animation duration",e),!o.duration&&0!==o.duration||c.add(g).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=u.find("."+o.className.active),t=e.outerWidth(!0),i=e.outerHeight(!0);u.css({width:t,height:i})},stageSize:function(){var e=u.clone().addClass(s.loading),t=e.find("."+o.className.active),i=f?e.find(r.side).eq(f):0<t.next(r.side).length?t.next(r.side):e.find(r.side).first(),n="next"==o.width?i.outerWidth(!0):"initial"==o.width?u.width():o.width,a="next"==o.height?i.outerHeight(!0):"initial"==o.height?u.height():o.height;t.removeClass(s.active),i.addClass(s.active),e.insertAfter(u),e.remove(),"auto"!=o.width&&(u.css("width",n+o.jitter),p.verbose("Specifying width during animation",n)),"auto"!=o.height&&(u.css("height",a+o.jitter),p.verbose("Specifying height during animation",a))},nextSide:function(e){f=e,a=g.filter(e),f=g.index(a),0===a.length&&(p.set.defaultSide(),p.error(i.side)),p.verbose("Next side manually set to",a)},active:function(){p.verbose("Setting new side to active",a),g.removeClass(s.active),a.addClass(s.active),o.onChange.call(a[0]),p.set.defaultSide()}},flip:{up:function(){var e;!p.is.complete()||p.is.animating()||o.allowRepeats?p.is.animating()?p.queue("flip up"):(p.debug("Flipping up",a),e=p.get.transform.up(),p.set.stageSize(),p.stage.above(),p.animate(e)):p.debug("Side already visible",a)},down:function(){var e;!p.is.complete()||p.is.animating()||o.allowRepeats?p.is.animating()?p.queue("flip down"):(p.debug("Flipping down",a),e=p.get.transform.down(),p
|