raspberrymatic-addon-rmupdate/addon/www/css/components/shape.min.js

1 line
10 KiB
JavaScript
Raw Normal View History

2018-12-22 16:58:57 +01:00
!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,o,t=x.selector||"",s=H.isPlainObject(v)?H.extend(!0,{},H.fn.shape.settings,v):H.extend({},H.fn.shape.settings),e=s.namespace,r=s.selector,i=s.error,l=s.className,d="."+e,u="module-"+e,c=H(this),g=c.find(r.sides),f=c.find(r.side),m=!1,h=this,p=c.data(u);o={initialize:function(){o.verbose("Initializing module for",h),o.set.defaultSide(),o.instantiate()},instantiate:function(){o.verbose("Storing instance of module",o),p=o,c.data(u,p)},destroy:function(){o.verbose("Destroying previous module for",h),c.removeData(u).off(d)},refresh:function(){o.verbose("Refreshing selector cache for",h),c=H(h),g=H(this).find(r.shape),f=H(this).find(r.side)},repaint:function(){o.verbose("Forcing repaint event");(g[0]||T.createElement("div")).offsetWidth},animate:function(e,t){o.verbose("Animating box with properties",e),t=t||function(e){o.verbose("Executing animation callback"),e!==Z&&e.stopPropagation(),o.reset(),o.set.active()},s.beforeChange.call(a[0]),o.get.transitionEvent()?(o.verbose("Starting CSS animation"),c.addClass(l.animating),g.css(e).one(o.get.transitionEvent(),t),o.set.duration(s.duration),F(function(){c.addClass(l.animating),n.addClass(l.hidden)})):t()},queue:function(e){o.debug("Queueing animation of",e),g.one(o.get.transitionEvent(),function(){o.debug("Executing queued animation"),setTimeout(function(){c.shape(e)},0)})},reset:function(){o.verbose("Animating states reset"),c.removeClass(l.animating).attr("style","").removeAttr("style"),g.attr("style","").removeAttr("style"),f.attr("style","").removeAttr("style").removeClass(l.hidden),a.removeClass(l.animating).attr("style","").removeAttr("style")},is:{complete:function(){return f.filter("."+l.active)[0]==a[0]},animating:function(){return c.hasClass(l.animating)}},set:{defaultSide:function(){n=c.find("."+s.className.active),a=0<n.next(r.side).length?n.next(r.side):c.find(r.side).first(),m=!1,o.verbose("Active side set to",n),o.verbose("Next side set to",a)},duration:function(e){e="number"==typeof(e=e||s.duration)?e+"ms":e,o.verbose("Setting animation duration",e),(s.duration||0===s.duration)&&g.add(f).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=c.find("."+s.className.active),t=e.outerWidth(!0),i=e.outerHeight(!0);c.css({width:t,height:i})},stageSize:function(){var e=c.clone().addClass(l.loading),t=e.find("."+s.className.active),i=m?e.find(r.side).eq(m):0<t.next(r.side).length?t.next(r.side):e.find(r.side).first(),n="next"==s.width?i.outerWidth(!0):"initial"==s.width?c.width():s.width,a="next"==s.height?i.outerHeight(!0):"initial"==s.height?c.height():s.height;t.removeClass(l.active),i.addClass(l.active),e.insertAfter(c),e.remove(),"auto"!=s.width&&(c.css("width",n+s.jitter),o.verbose("Specifying width during animation",n)),"auto"!=s.height&&(c.css("height",a+s.jitter),o.verbose("Specifying height during animation",a))},nextSide:function(e){m=e,a=f.filter(e),m=f.index(a),0===a.length&&(o.set.defaultSide(),o.error(i.side)),o.verbose("Next side manually set to",a)},active:function(){o.verbose("Setting new side to active",a),f.removeClass(l.active),a.addClass(l.active),s.onChange.call(a[0]),o.set.defaultSide()}},flip:{up:function(){if(!o.is.complete()||o.is.animating()||s.allowRepeats)if(o.is.animating())o.queue("flip up");else{o.debug("Flipping up",a);var e=o.get.transform.up();o.set.stageSize(),o.stage.above(),o.animate(e)}else o.debug("Side already visible",a)},down:function(){if(!o.is.complete()||o.is.animating()||s.allowRepeats)if(o.is.animating())o.queue("flip down");else{o.debug("Flipping down",a);var e=o