UNPKG

mixfill

Version:
1 lines 4.11 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}}();