1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-21 23:53:55 +01:00
LocalCDN-Firefox-Chrome-Brave/resources/mirage2/latest/mirage2.min.jsm

2 lines
38 KiB
JavaScript
Raw Normal View History

2020-06-07 07:49:51 +02:00
var mirage=function(t){"use strict";function e(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function r(t){return Object.prototype.toString.call(t)}function n(t){return[].slice.call(t)}function i(){return(new Date).getTime()}function o(t){return null!=t&&"object"==typeof t&&t.nodeType===Node.ELEMENT_NODE&&"object"==typeof t.style&&"object"==typeof t.ownerDocument}function s(t,e){for(var r=0;r<t.length;r++)if(e===t[r])return r;return-1}function a(){var t,e;return{promise:new G(function(r,n){t=r,e=n}),resolve:t,reject:e}}function u(){try{return!!window.addEventListener}catch(t){return!1}}function c(t,e){if(t)return $<8&&"style"===e?t.style.cssText:"getAttribute"in t?t.getAttribute(e):t.attributes[e]}function h(t,e,r){if(t){if(!($<8&&"style"===e))return"setAttribute"in t?t.setAttribute(e,r):t.attributes[e]=r;t.style.cssText=r}}function l(t,e){if(t){if(!($<8&&"style"===e))return"removeAttribute"in t?t.removeAttribute(e):delete t.attributes[e];t.style.cssText=""}}function f(t,e){return c(t,"data-"+e)}function p(t,e,r){return h(t,"data-"+e,r)}function d(t,e,r,n){return u()?t.addEventListener(e,r,n):t.attachEvent("on"+e,r)}function g(t,e,r,n){return u()?t.removeEventListener(e,r,n):t.detachEvent("on"+e,r)}function _(){var t={};try{void 0!==window.innerWidth?(t.width=window.innerWidth,t.height=window.innerHeight):void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(t.width=document.documentElement.clientWidth,t.height=document.documentElement.clientHeight):(t.width=document.getElementsByTagName("body")[0].clientWidth,t.height=document.getElementsByTagName("body")[0].clientHeight)}catch(e){t.width=void 0,t.height=void 0}return t}function m(t,e,r){for(var n=[],i=0;i<t.length;i++)n.push(e.call(r,t[i],i,t));return n}function y(t,e,r){for(var n=0;n<t.length;n++)e.call(r,t[n],n,t)}function v(t,e,r){for(var n=0;n<t.length;n++)if(e.call(r,t[n],n,t))return t[n]}function w(t,e,r){for(var n in t)e.call(r,t[n],n,t)}function b(t,e,r){for(var n=[],i=0;i<t.length;i++)e.call(r,t[i],i,t)&&n.push(t[i]);return n}function S(t){if(!(this instanceof S))return new S(t);if(!t||!o(t))throw new Error("A DOM element reference is required");return this.element=t,this.tokens=t.classList,this}function E(t,e){return new S(t).remove(e)}function T(t,e){return new S(t).has(e)}function O(){return Promise.resolve(navigator.connection||navigator.mozConnection||navigator.webkitConnection||A()).then(function(t){var e=window.navigator.userAgent||"";return!!/Android|iPhone|iPod|iPad/.test(e)&&("string"==typeof t.effectiveType?"2g"===t.effectiveType||"slow-2g"===t.effectiveType:!isNaN(t.bandwidth)&&t.bandwidth<It)})}function A(){return new Promise(function(t){var e="___MIRAGE_STORAGE_TEST___";try{localStorage.setItem(e,e),localStorage.getItem(e),localStorage.removeItem(e)}catch(e){return t(St)}var r;try{r=JSON.parse(window.localStorage.getItem(Et))}catch(t){}r&&t(r),t(I().then(function(t){try{window.localStorage.setItem(Et,JSON.stringify(t))}catch(t){}return t},function(t){return bt("Speedtest failed",t.message),St}))})}function I(){return new Promise(function(t,e){var r=new XMLHttpRequest,n=i();wt("Approximating network connection.."),r.open("get",At+n),r.onreadystatechange=function(){if(4===r.readyState){try{if(r.status)var o=+r.status}catch(t){}1223===o&&(o=204),200===o?t(L(n,i(),r)):e(Error("Unexpected HTTP status: "+o))}},r.send()})}function L(t,e,r){var n=window.parseInt(r.getResponseHeader(Tt),10),i=window.parseInt(r.getResponseHeader(Ot),10);return isNaN(n)||isNaN(i)?St:{effectiveType:C(2*(n-t),i/(e-n)/1e3)}}function C(t,e){return t>=2e3&&e<=50?"slow-2g":t>=1400&&e<=70?"2g":t>=270&&e<=700?"3g":"4g"}function x(t,e,r){var n,i,o,s,a=t.byteLength;if(e=~~e,r=void 0===r?a:~~r,"function"==typeof t.slice)return t.slice(e,r);if(e<0?(e+=a)<0&&(e=0):e>a&&(e=a),r<0?(r+=a)<0&&(r=0):r>a&&(r=a),r<e&&(r=e),0===(n=r-e))return new Uint8Array(n);for(i=new DataView(t,e,n),o=new Uint8Array(n),s=0;s<n;s++)o[s]=i.getUint8(s);return o.buffer}function N(t,e,r){var n,i=t[