diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac6df9..5245018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Visor +## 3.0.1 - 2020-07-27 + +### Fixed +- Remove support for browsers that do not have `fetch` (IE 11) + ## 3.0.0 - 2020-07-27 > {warning} Visor 3 is a full rewrite of the plugin to play nicely with full-page static caching solutions like [Blitz](https://plugins.craftcms.com/blitz). Please ensure you are familiar with the [caveats to providing full-page static caching support](https://github.com/trendyminds/visor#caveats) diff --git a/resources/visor.js b/resources/visor.js index 91a3a4d..b474380 100644 --- a/resources/visor.js +++ b/resources/visor.js @@ -1,4 +1,11 @@ (() => { + // If the browser does not support fetch, exit out (modern only!) + const fetchSupport = "fetch" in window; + + if (!fetchSupport) { + return false; + } + fetch("/actions/visor/default/access") .then((res) => { // Did we encounter a non 200 status code? If so, exit diff --git a/src/resources/visor.js b/src/resources/visor.js index d7a6bfb..b2e7e1a 100644 --- a/src/resources/visor.js +++ b/src/resources/visor.js @@ -3,7 +3,7 @@ var t=null;function e(){return t||(t=n()),t}function n(){try{throw new Error}cat },{}],"TUK3":[function(require,module,exports) { var r=require("./bundle-url").getBundleURL;function e(r){Array.isArray(r)||(r=[r]);var e=r[r.length-1];try{return Promise.resolve(require(e))}catch(n){if("MODULE_NOT_FOUND"===n.code)return new s(function(n,i){t(r.slice(0,-1)).then(function(){return require(e)}).then(n,i)});throw n}}function t(r){return Promise.all(r.map(u))}var n={};function i(r,e){n[r]=e}module.exports=exports=e,exports.load=t,exports.register=i;var o={};function u(e){var t;if(Array.isArray(e)&&(t=e[1],e=e[0]),o[e])return o[e];var i=(e.substring(e.lastIndexOf(".")+1,e.length)||e).toLowerCase(),u=n[i];return u?o[e]=u(r()+e).then(function(r){return r&&module.bundle.register(t,r),r}).catch(function(r){throw delete o[e],r}):void 0}function s(r){this.executor=r,this.promise=null}s.prototype.then=function(r,e){return null===this.promise&&(this.promise=new Promise(this.executor)),this.promise.then(r,e)},s.prototype.catch=function(r){return null===this.promise&&(this.promise=new Promise(this.executor)),this.promise.catch(r)}; },{"./bundle-url":"FheM"}],"fkLp":[function(require,module,exports) { -fetch("/actions/visor/default/access").then(function(e){return 200===e.status&&e.text()}).then(function(e){e&&(document.body.insertAdjacentHTML("beforeend",e),require("_bundle_loader")(require.resolve("./init")).then(function(e){return new e.default}))}); +!function(){if(!("fetch"in window))return!1;fetch("/actions/visor/default/access").then(function(e){return 200===e.status&&e.text()}).then(function(e){e&&(document.body.insertAdjacentHTML("beforeend",e),require("_bundle_loader")(require.resolve("./init")).then(function(e){return new e.default}))})}(); },{"_bundle_loader":"TUK3","./init":[["init.9d6cb373.js","FyzG"],"init.9d6cb373.css","FyzG"]}],"dZuk":[function(require,module,exports) { module.exports=function(e){return new Promise(function(n,o){var r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onerror=function(e){r.onerror=r.onload=null,o(e)},r.onload=function(){r.onerror=r.onload=null,n()},document.getElementsByTagName("head")[0].appendChild(r)})}; },{}],"Yi9z":[function(require,module,exports) {