UNPKG

mixfill

Version:
1 lines 6.47 kB
!function(){if(!document.addEventListener&&window.Element&&window.Event){var a="__events",b="__immediateStopped";Event.prototype.NONE=Event.NONE=0,Event.prototype.CAPTURING_PHASE=Event.CAPTURING_PHASE=1,Event.prototype.AT_TARGET=Event.AT_TARGET=2,Event.prototype.BUBBLING_PHASE=Event.BUBBLING_PHASE=3,Event.prototype.preventDefault=function(){this.cancelable!==!1&&(this.returnValue=!1)},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},Event.prototype.stopImmediatePropagation=function(){this[b]=this.cancelBubble=!0};for(var c=function(a,b){return a.timeStamp=+new Date,a.target||(a.target=a.srcElement||b),a.pageX=a.clientX+document.documentElement.scrollLeft,a.pageY=a.clientY+document.documentElement.scrollTop,a.relatedTarget="mouseover"==a.type?a.fromElement:"mouseout"==a.type?a.toElement:null,a},d=function(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];if(e.useCapture==c&&e.listener==b)return d}return-1},e=function(a,b,c){a.currentTarget=c,"function"==typeof b?b.call(c,a):b.handleEvent(a)},f=function(a){for(var b=[];a.parentNode;)b.unshift(a.parentNode),a=a.parentNode;return b},g=function(c,d,f){c.eventPhase=f;for(var g=0;g<d.length;g++){for(var h=d[g],i=[],j=(h[a]||{})[c.type]||[],k=0;k<j.length;k++){var l=j[k];l.useCapture&&f==Event.BUBBLING_PHASE||(l.useCapture||f!=Event.CAPTURING_PHASE)&&i.push(l.listener)}for(k=0;k<i.length;)try{for(;k<i.length;){var m=i[k++];if(e(c,m,h),c[b])return!0}}catch(n){setTimeout(function(){throw n},0)}if(c.cancelBubble)return!0}return!1},h=function(a){c(a,this);var b=f(a.target);return b.length&&g(a,b,Event.CAPTURING_PHASE)?a.returnValue:g(a,[a.target],Event.AT_TARGET)?a.returnValue:b.length&&a.bubbles!==!1&&(b.reverse(),g(a,b,Event.BUBBLING_PHASE))?a.returnValue:(a.stopPropagation(),a.returnValue)},i=({addEventListener:function(b,c,e){var f=(this[a]||{})[b]||[],g=f.length;if(!(d(f,c,e)>-1)){if(a in this)var i=this[a];else{var i={_handler:h.bind(this)};this[a]=i}b in i||(i[b]=[]),i[b].push({listener:c,useCapture:e}),g||this.attachEvent("on"+b,i._handler)}},removeEventListener:function(b,c,e){var f=(this[a]||{})[b]||[],g=d(f,c,e);-1!=g&&(f.splice(g,1),f.length||this.detachEvent("on"+b,this[a]._handler))},dispatchEvent:function(a){return a.returnValue=!0,h.call(this,a)}}),j=[Element,window.constructor,document.constructor];j.length;){var k=j.pop();for(var l in i)k.prototype[l]=i[l]}}}(),function(){if(!window.CustomEvent&&document.createEventObject)return void(window.CustomEvent=function(a,b){if(!arguments.length)throw new Error("Not enough arguments");var c={type:a,bubbles:!1,cancelable:!1,detail:null},d=document.createEventObject();for(var e in c)d[e]=c[e];for(var e in b)d[e]=b[e];return d});try{new CustomEvent("test")}catch(a){var b=function(a,b){if(!arguments.length)throw new Error("Not enough arguments");var c={bubbles:!1,cancelable:!1,detail:null};for(var d in b)c[d]=b[d];var e=document.createEvent("CustomEvent");return e.initCustomEvent(a,c.bubbles,c.cancelable,c.detail),e};b.prototype=(window.CustomEvent||window.Event).prototype,window.CustomEvent=b}}(),function(){document.addEventListener("readystatechange",function(){if("complete"==document.readyState){var a=new CustomEvent("DOMContentLoaded");document.dispatchEvent(a)}})}(),function(){if(!window.MouseEvent)return void(window.MouseEvent=function(a,b){if(!arguments.length)throw new Error("Not enough arguments");var c={type:a,cancelable:!1,bubbles:!1},d=document.createEventObject();for(var e in c)d[e]=c[e];for(var e in b)d[e]=b[e];return d});try{new MouseEvent("click")}catch(a){var b=function(a,b){if(!arguments.length)throw new Error("Not enough arguments");var c={type:a,bubbles:!1,cancelable:!1,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altLey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null};for(var d in b)c[d]=b[d];var e=document.createEvent("MouseEvent");return e.initMouseEvent(c.type,c.bubbles,c.cancelable,c.view,c.detail,c.screenX,c.screenY,c.clientX,c.clientY,c.ctrlKey,c.altKey,c.shiftKey,c.metaKey,c.button,c.relatedTarget),e};b.prototype=window.MouseEvent.prototype,window.MouseEvent=b}}(),function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void j(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}"undefined"!=typeof module&&module.exports?module.exports=a.Promise?a.Promise:c:a.Promise||(a.Promise=c);var j=a.setImmediate||function(a){setTimeout(a,1)},k=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&k(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},c.resolve=function(a){return a&&"object"==typeof a&&a.constructor===c?a:new c(function(b){b(a)})},c.reject=function(a){return new c(function(b,c){c(a)})},c.race=function(a){return new c(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})}}(this);