UNPKG

17.3 kBJavaScriptView Raw
1Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},o=function(){return n.apply(this instanceof r?this:e,t.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(r.prototype=this.prototype),o.prototype=new r,o}),function(){var e,t,n,r,o=Object.prototype,i=Function.call,c=i.bind(o.hasOwnProperty),l=i.bind(o.propertyIsEnumerable),a=i.bind(o.toString),u=c(o,"__defineGetter__");u&&(e=i.bind(o.__defineGetter__),t=i.bind(o.__defineSetter__),n=i.bind(o.__lookupGetter__),r=i.bind(o.__lookupSetter__));var p=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){var t=e.__proto__;return t||null===t?t:"[object Function]"===a(e.constructor)?e.constructor.prototype:e instanceof Object?o:null}),Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length;return function(o){if("object"!=typeof o&&("function"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var i,c,l=[];for(i in o)e.call(o,i)&&l.push(i);if(t)for(c=0;c<r;c++)e.call(o,n[c])&&l.push(n[c]);return l}}()),Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){if(e!==Object(e))throw TypeError("Object.getOwnPropertyNames called on non-object: "+e);return Object.keys(e)});var f,s=function(e){try{return e.sentinel=0,0===Object.getOwnPropertyDescriptor(e,"sentinel").value}catch(t){return!1}};if(Object.defineProperty){var y=s({});("undefined"==typeof document||s(document.createElement("div")))&&y||(f=Object.getOwnPropertyDescriptor)}if(!Object.getOwnPropertyDescriptor||f){Object.getOwnPropertyDescriptor=function(e,t){if(p(e))throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+e);if(f)try{return f.call(Object,e,t)}catch(b){}var i;if(!c(e,t))return i;if(i={enumerable:l(e,t),configurable:!0},u){var a=e.__proto__,s=e!==o;s&&(e.__proto__=o);var y=n(e,t),d=r(e,t);if(s&&(e.__proto__=a),y||d)return y&&(i.get=y),d&&(i.set=d),i}return i.value=e[t],i.writable=!0,i}}var d=function(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){return!1}};if(Object.defineProperty){var b=d({}),h="undefined"==typeof document||d(document.createElement("div"));if(!b||!h)var v=Object.defineProperty,m=Object.defineProperties}if(!Object.defineProperty||v){Object.defineProperty=function(i,c,l){if(p(i))throw new TypeError("Object.defineProperty called on non-object: "+i);if(p(l))throw new TypeError("Property description must be an object: "+l);if(v)try{return v.call(Object,i,c,l)}catch(y){}if("value"in l)if(u&&(n(i,c)||r(i,c))){var a=i.__proto__;i.__proto__=o,delete i[c],i[c]=l.value,i.__proto__=a}else i[c]=l.value;else{var f="get"in l,s="set"in l;if(!u&&(f||s))return i;f&&e(i,c,l.get),s&&t(i,c,l.set)}return i}}if(Object.defineProperties&&!m||(Object.defineProperties=function(e,t){if(m)try{return m.call(Object,e,t)}catch(i){}for(var n=Object.keys(t),r=0;r<n.length;r++){var o=n[r];"__proto__"!==o&&Object.defineProperty(e,o,t[o])}return e}),!Object.create){var g,O=!({__proto__:null}instanceof Object),w=function(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(e){return!1}},j=function(){var e,t;t=new ActiveXObject("htmlfile");return t.write("<script><\/script>"),t.close(),e=t.parentWindow.Object.prototype,t=null,e},E=function(){var e,t=document.createElement("iframe"),n=document.body||document.documentElement;return t.style.display="none",n.appendChild(t),t.src="javascript:",e=t.contentWindow.Object.prototype,n.removeChild(t),t=null,e};g=O||"undefined"==typeof document?function(){return{__proto__:null}}:function(){var e=w()?j():E();delete e.constructor,delete e.hasOwnProperty,delete e.propertyIsEnumerable,delete e.isPrototypeOf,delete e.toLocaleString,delete e.toString,delete e.valueOf;var t=function(){};return t.prototype=e,g=function(){return new t},new t},Object.create=function(e,t){var n,r=function(){};if(null===e)n=g();else{if(null!==e&&p(e))throw new TypeError("Object prototype may only be an Object or null");r.prototype=e,n=new r,n.__proto__=e}return void 0!==t&&Object.defineProperties(n,t),n}}Object.seal||(Object.seal=function(e){if(Object(e)!==e)throw new TypeError("Object.seal can only be called on Objects.");return e}),Object.freeze||(Object.freeze=function(e){if(Object(e)!==e)throw new TypeError("Object.freeze can only be called on Objects.");return e});try{Object.freeze(function(){})}catch(_){Object.freeze=function(e){return function(t){return"function"==typeof t?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){if(Object(e)!==e)throw new TypeError("Object.preventExtensions can only be called on Objects.");return e}),Object.isSealed||(Object.isSealed=function(e){if(Object(e)!==e)throw new TypeError("Object.isSealed can only be called on Objects.");return!1}),Object.isFrozen||(Object.isFrozen=function(e){if(Object(e)!==e)throw new TypeError("Object.isFrozen can only be called on Objects.");return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)!==e)throw new TypeError("Object.isExtensible can only be called on Objects.");for(var t="";c(e,t);)t+="?";e[t]=!0;var n=c(e,t);return delete e[t],n})}(),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var n,r;if(void 0===this||null===this)throw new TypeError("Array.prototype.forEach called on null or undefined");var o=Object(this),i=o.length>>>0;if("[object Function]"!=Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r<i;){var c;r in o&&(c=o[r],e.call(n,c,r,o)),r++}}),Array.prototype.every||(Array.prototype.every=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.every called on null or undefined");var t=Object(this),n=t.length>>>0;if("[object Function]"!=Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");for(var r=arguments.length>=2?arguments[1]:void 0,o=0;o<n;o++)if(o in t&&!e.call(r,t[o],o,t))return!1;return!0}),Array.prototype.fill||(Array.prototype.fill=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.fill called on null or undefined");for(var t=Object(this),n=t.length>>>0,r=arguments[1],o=r>>0,i=o<0?Math.max(n+o,0):Math.min(o,n),c=arguments[2],l=c===undefined?n:c>>0,a=l<0?Math.max(n+l,0):Math.min(l,n);i<a;)t[i]=e,i++;return t}),Array.prototype.filter||(Array.prototype.filter=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.filter called on null or undefined");var t=Object(this),n=t.length>>>0;if("[object Function]"!=Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");for(var r=[],o=arguments.length>=2?arguments[1]:void 0,i=0;i<n;i++)if(i in t){var c=t[i];e.call(o,c,i,t)&&r.push(c)}return r}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){if(void 0===this||null===this)throw new TypeError("Array.prototype.indexOf called on null or undefined");var n,r=Object(this),o=r.length>>>0;if(0===o)return-1;var i=0|t;if(i>=o)return-1;for(n=Math.max(i>=0?i:o-Math.abs(i),0);n<o;){if(n in r&&r[n]===e)return n;n++}return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.lastIndexOf called on null or undefined");var t,n,r=Object(this),o=r.length>>>0;if(0===o)return-1;for(t=o-1,arguments.length>1&&(t=Number(arguments[1]),t!==t?t=0:0!=t&&t!=1/0&&t!=-1/0&&(t=(t>0||-1)*Math.floor(Math.abs(t)))),n=t>=0?Math.min(t,o-1):o-Math.abs(t);n>=0;n--)if(n in r&&r[n]===e)return n;return-1}),Array.prototype.map||(Array.prototype.map=function(e,t){if(void 0===this||null===this)throw new TypeError("Array.prototype.map called on null or undefined");var n,r,o,i=Object(this),c=i.length>>>0;if("[object Function]"!==Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");for(t&&(n=t),r=new Array(c),o=0;o<c;){var l,a;o in i&&(l=i[o],a=e.call(n,l,o,i),r[o]=a),o++}return r}),Array.prototype.reduce||(Array.prototype.reduce=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("[object Function]"!==Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");var t,n=Object(this),r=n.length>>>0,o=0;if(arguments.length>=2)t=arguments[1];else{for(;o<r&&!(o in n);)o++;if(o>=r)throw new TypeError("Reduce of empty array with no initial value");t=n[o++]}for(;o<r;o++)o in n&&(t=e(t,n[o],o,n));return t}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.reduceRight called on null or undefined");if("[object Function]"!==Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");var t,n=Object(this),r=n.length>>>0,o=r-1;if(arguments.length>=2)t=arguments[1];else{for(;o>=0&&!(o in n);)o--;if(o<0)throw new TypeError("Reduce of empty array with no initial value");t=n[o--]}for(;o>=0;o--)o in n&&(t=e(t,n[o],o,n));return t}),Array.prototype.some||(Array.prototype.some=function(e){if(void 0===this||null===this)throw new TypeError("Array.prototype.reduceRight called on null or undefined");if("[object Function]"!==Object.prototype.toString.call(e))throw new TypeError(e+" is not a function");for(var t=Object(this),n=t.length>>>0,r=arguments.length>=2?arguments[1]:void 0,o=0;o<n;o++)if(o in t&&e.call(r,t[o],o,t))return!0;return!1}),function(e){"TextRectangle"in e&&!("width"in e.TextRectangle.prototype)&&Object.defineProperties(e.TextRectangle.prototype,{"width":{get:function(){return this.right-this.left}},"height":{get:function(){return this.bottom-this.top}}})}(window),Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toISOString||function(){function pad(e){return e<10?"0"+e:e}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+pad(this.getUTCMonth()+1)+"-"+pad(this.getUTCDate())+"T"+pad(this.getUTCHours())+":"+pad(this.getUTCMinutes())+":"+pad(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}(),function(e){if("document"in e){var t=e.document;if(!t.getElementsByClassName&&t.querySelectorAll){var n=function(e){return e=String(e).replace(/^|\s+/g,"."),this.querySelectorAll(e)};[HTMLDocument,Element].forEach(function(e){e.prototype.getElementsByClassName=n})}if(!("CustomEvent"in e)||"function"!=typeof e.CustomEvent){var r=function(e,n){n=n||{bubbles:!1,cancelable:!1,detail:undefined};var r=t.createEvent("CustomEvent");return r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r};r.prototype=e.Event.prototype,e.CustomEvent=r}!function(){if("Element"in e&&!Element.prototype.matches){for(var n=["ms","o","moz","webkit"],r=0;r<n.length;r++){var o=n[r]+"MatchesSelector";if(o in Element.prototype)return void(Element.prototype.matches=Element.prototype[o])}t.querySelectorAll&&(Element.prototype.matches=function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1})}}(),Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(Element.prototype,"textContent").get&&function(){var e=Object.getOwnPropertyDescriptor(Element.prototype,"innerText");Object.defineProperty(Element.prototype,"textContent",{get:function(){return e.get.call(this)},set:function(t){return e.set.call(this,t)}})}()}}(window),function(e){if(!("Event"in e&&"function"==typeof e.Event)){var t={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1},n=e.Event&&e.Event.prototype||null;if(e.Event=Window.prototype.Event=function(e,t){if(!e)throw new Error("Not enough arguments");var n;if("createEvent"in document){n=document.createEvent("Event");var r=!(!t||t.bubbles===undefined)&&t.bubbles,o=!(!t||t.cancelable===undefined)&&t.cancelable;return n.initEvent(e,r,o),n}return n=document.createEventObject(),n.type=e,n.bubbles=!(!t||t.bubbles===undefined)&&t.bubbles,n.cancelable=!(!t||t.cancelable===undefined)&&t.cancelable,n},n&&Object.defineProperty(e.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:n}),!("createEvent"in document)){var r=function(n,r){var o=this;if(o===e&&n in t)throw new Error("In IE8 the event: "+n+" is not available on the window object.");o._events||(o._events={}),o._events[n]||(o._events[n]=function(e){var t,n=o._events[e.type].list,r=n.slice(),i=-1,c=r.length;for(e.preventDefault=function(){!1!==e.cancelable&&(e.returnValue=!1)},e.stopPropagation=function(){e.cancelBubble=!0},e.stopImmediatePropagation=function(){e.cancelBubble=!0,e.cancelImmediate=!0},e.currentTarget=o,e.target=e.target||e.srcElement||o,e.relatedTarget=e.fromElement?e.fromElement===e.target?e.toElement:e.fromElement:null,e.timeStamp=(new Date).getTime(),e.clientX&&(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop);++i<c&&!e.cancelImmediate;)i in r&&(t=r[i],-1!==n.indexOf(t)&&"function"==typeof t&&t.call(o,e))},o._events[n].list=[],o.attachEvent&&o.attachEvent("on"+n,o._events[n])),o._events[n].list.push(r)},o=function(e,t){var n,r=this;r._events&&r._events[e]&&r._events[e].list&&-1!==(n=r._events[e].list.indexOf(t))&&(r._events[e].list.splice(n,1),r._events[e].list.length||(r.detachEvent&&r.detachEvent("on"+e,r._events[e]),delete r._events[e]))},i=function(e){if(!arguments.length)throw new Error("Not enough arguments");if(!e||"string"!=typeof e.type)throw new Error("DOM Events Exception 0");var t=this,n=e.type;try{if(!e.bubbles){e.cancelBubble=!0;var r=function(e){e.cancelBubble=!0,(t||window).detachEvent("on"+n,r)};this.attachEvent("on"+n,r)}this.fireEvent("on"+n,e)}catch(o){e.target=t;do{e.currentTarget=t,"_events"in t&&"function"==typeof t._events[n]&&t._events[n].call(t,e),"function"==typeof t["on"+n]&&t["on"+n].call(t,e),t=9===t.nodeType?t.parentWindow:t.parentNode}while(t&&!e.cancelBubble)}return!0};[Window,HTMLDocument,Element].forEach(function(e){e.prototype.addEventListener=r,e.prototype.removeEventListener=o,e.prototype.dispatchEvent=i}),document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))})}}}(window),function(e){function getPixelSize(e,t,n,r){var o,i=t[n],c=parseFloat(i),l=i.split(/\d/)[0];return r=null!==r?r:/%|em/.test(l)&&e.parentElement?getPixelSize(e.parentElement,e.parentElement.currentStyle,"fontSize",null):16,o="fontSize"===n?r:/width/i.test(n)?e.clientWidth:e.clientHeight,"em"===l?c*r:"in"===l?96*c:"pt"===l?96*c/72:"%"===l?c/100*o:c}function setShortStyleProperty(e,t){var n="border"===t?"Width":"",r=t+"Top"+n,o=t+"Right"+n,i=t+"Bottom"+n,c=t+"Left"+n;e[t]=(e[r]==e[o]==e[i]==e[c]?[e[r]]:e[r]==e[i]&&e[c]==e[o]?[e[r],e[o]]:e[c]==e[o]?[e[r],e[o],e[i]]:[e[r],e[o],e[i],e[c]]).join(" ")}function CSSStyleDeclaration(e){var t=e.currentStyle||{},n=this,r=getPixelSize(e,t,"fontSize",null);for(var o in t)/width|height|margin.|padding.|border.+W/.test(o)&&"auto"!==n[o]?n[o]=getPixelSize(e,t,o,r)+"px":"styleFloat"===o?n["float"]=t[o]:n[o]=t[o];return setShortStyleProperty(n,"margin"),setShortStyleProperty(n,"padding"),setShortStyleProperty(n,"border"),n.fontSize=r+"px",n}"getComputedStyle"in e&&"function"==typeof e.getComputedStyle||(CSSStyleDeclaration.prototype={constructor:CSSStyleDeclaration,getPropertyPriority:function(){},getPropertyValue:function(e){return this[e]||""},item:function(){},removeProperty:function(){},setProperty:function(){},getPropertyCSSValue:function(){}},e.getComputedStyle=function(e){return new CSSStyleDeclaration(e)})}(window),document.head=document.head||document.getElementsByTagName("head")[0],["abbr","article","aside","audio","bdi","canvas","data","datalist","details","dialog","figcaption","figure","footer","header","hgroup","main","mark","meter","nav","output","picture","progress","section","summary","template","time","video"].forEach(function(e){document.createElement(e)}),String.prototype.trim||(String.prototype.trim=function(){return String(this).replace(/^\s+/,"").replace(/\s+$/,"")}),function(e){function scrollX(){return(n.scrollLeft||r.scrollLeft||0)-(n.clientLeft||r.clientLeft||0)}function scrollY(){return(n.scrollTop||r.scrollTop||0)-(n.clientTop||r.clientTop||0)}if(!("innerWidth"in e&&"innerHeight"in e&&"pageXOffset"in e&&"pageYOffset"in e)){var t=e.document,n=t.documentElement,r=t.body||t.createElement("body");Object.defineProperties(e,{innerWidth:{get:function(){return n.clientWidth}},innerHeight:{get:function(){return n.clientHeight}},pageXOffset:{get:scrollX},pageYOffset:{get:scrollY},scrollX:{get:scrollX},scrollY:{get:scrollY}})}}(window);
\No newline at end of file