mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 20:47:15 +01:00
17 lines
46 KiB
JavaScript
17 lines
46 KiB
JavaScript
|
/**
|
||
|
* Muuri v0.7.1
|
||
|
* https://github.com/haltu/muuri
|
||
|
* Copyright (c) 2015-present, Haltu Oy
|
||
|
* Released under the MIT license
|
||
|
* https://github.com/haltu/muuri/blob/master/LICENSE.md
|
||
|
* @license MIT
|
||
|
*
|
||
|
* Muuri Packer
|
||
|
* Copyright (c) 2016-present, Niklas Rämö <inramo@gmail.com>
|
||
|
* @license MIT
|
||
|
*
|
||
|
* Muuri Ticker / Muuri Emitter / Muuri Queue
|
||
|
* Copyright (c) 2018-present, Niklas Rämö <inramo@gmail.com>
|
||
|
* @license MIT
|
||
|
*/
|
||
|
!function(t,i){if("object"==typeof exports&&"undefined"!=typeof module){var e;try{e=require("hammerjs")}catch(t){}module.exports=i(e)}else t.Muuri=i(t.Hammer)}(this,function(t){"use strict";var i="Muuri",e={},s="layoutEnd";function n(){this._events={},this._queue=[],this._counter=0,this._isDestroyed=!1}n.prototype.on=function(t,i){if(this._isDestroyed)return this;var e=this._events[t];return e||(e=this._events[t]=[]),e.push(i),this},n.prototype.once=function(t,i){if(this._isDestroyed)return this;var e=function(){this.off(t,e),i.apply(null,arguments)}.bind(this);return this.on(t,e)},n.prototype.off=function(t,i){if(this._isDestroyed)return this;var e=this._events[t];if(!e||!e.length)return this;if(!i)return e.length=0,this;for(var s=e.length;s--;)i===e[s]&&e.splice(s,1);return this},n.prototype.emit=function(t,i,e,s){if(this._isDestroyed)return this;var n=this._events[t];if(!n||!n.length)return this;var r,o=this._queue,h=o.length,a=arguments.length-1;for(r=0;r<n.length;r++)o.push(n[r]);for(++this._counter,r=h,h=o.length;r<h;r++)if(0===a?o[r]():1===a?o[r](i):2===a?o[r](i,e):o[r](i,e,s),this._isDestroyed)return this;return--this._counter,this._counter||(o.length=0),this},n.prototype.destroy=function(){if(this._isDestroyed)return this;var t,i=this._events;for(t in this._isDestroyed=!0,this._queue.length=this._counter=0,i)i[t]&&(i[t].length=0,i[t]=void 0);return this};var r=!1,o="transform",h="transform";["","Webkit","Moz","O","ms"].forEach(function(t){if(!r){var i=t?t+"Transform":"transform";void 0!==document.documentElement.style[i]&&(t=t.toLowerCase(),o=t?"-"+t+"-transform":"transform",h=i,r=!0)}});var a="function"==typeof WeakMap?new WeakMap:null;function _(t,i){var e=a&&a.get(t);return e||(e=window.getComputedStyle(t,null),a&&a.set(t,e)),e.getPropertyValue("transform"===i?o:i)}var l=/([A-Z])/g;function d(t){return t.replace(l,"-$1").toLowerCase()}function f(t,i){for(var e in i)t.style["transform"===e?h:e]=i[e]}function u(t){this._element=t,this._animation=null,this._callback=null,this._props=[],this._values=[],this._keyframes=[],this._options={},this._isDestroyed=!1,this._onFinish=this._onFinish.bind(this)}u.prototype.start=function(t,i,e){if(!this._isDestroyed){var s=this._animation,n=this._props,r=this._values,o=e||0,h=!1;if(s){var a,_=0;for(var l in i)if(++_,-1===(a=n.indexOf(l))||i[l]!==r[a]){h=!0;break}h||_===n.length||(h=!0)}if(h&&s.cancel(),this._callback="function"==typeof o.onFinish?o.onFinish:null,!s||h){for(l in n.length=r.length=0,i)n.push(l),r.push(i[l]);var d=this._keyframes;d[0]=t,d[1]=i;var u=this._options;u.duration=o.duration||300,u.easing=o.easing||"ease";var c=this._element;(s=c.animate(d,u)).onfinish=this._onFinish,this._animation=s,f(c,i)}}},u.prototype.stop=function(t){if(!this._isDestroyed&&this._animation){var i,e,s,n=this._element,r=this._props,o=this._values;if(t)f(n,t);else for(s=0;s<r.length;s++)e=_(n,d(i=r[s])),n.style["transform"===i?h:i]=e;this._animation.cancel(),this._animation=this._callback=null,r.length=o.length=0}},u.prototype.isAnimating=function(){return!!this._animation},u.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=this._options=this._keyframes=null,this._isDestroyed=!0)},u.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()};var c=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,16)}).bind(window);function p(){this._nextTick=null,this._queue=[],this._reads={},this._writes={},this._batch=[],this._batchReads={},this._batchWrites={},this._flush=this._flush.bind(this)}p.prototype.add=function(t,i,e,s){var n=this._queue.indexOf(t);n>-1&&(this._queue[n]=void 0),s?this._queue.unshift(t):this._queue.push(t),this._reads[t]=i,this._writes[t]=e,this._nextTick||(this._nextTick=c(this._flush))},p.prototype.cancel=function(t){var i=this._queue.indexOf(t);i>-1&&(this._queue[i]=void 0,this._reads[t]=void 0,this._writes[t]=void 0)},p.prototype._flush=function(){
|