Add the unfetch polyfill, so that we can function on ancient iPads.
authorChris Jaekl <chris@localhost>
Thu, 30 Dec 2021 21:09:35 +0000 (16:09 -0500)
committerChris Jaekl <chris@localhost>
Thu, 30 Dec 2021 21:09:35 +0000 (16:09 -0500)
README
app/index.html
app/modernizr-custom.js
app/unfetch.js [new file with mode: 0644]
js/Main.js

diff --git a/README b/README
index 24d88bc087d5e8bdb4b258a65bb570ff1fddcac0..779f2af78fcb7b488c8d2179a35e15d5a74d651b 100644 (file)
--- a/README
+++ b/README
@@ -7,3 +7,18 @@ General Public Licence version 3 (or, at your option, any later version).
 
 Chris Jaekl
 cejaekl@yahoo.com
 
 Chris Jaekl
 cejaekl@yahoo.com
+
+------------8<------------8<------------8<------------8<------------8<----------
+This software includes:
+
+UNFETCH
+
+The MIT License (MIT)
+
+Copyright (c) 2017 Jason Miller
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
index 00d155e95f50d9fcc8bd218afbb38dfcf88e3122..faa558ccb13d54febd13bbcf2f8621b73f473e1e 100644 (file)
@@ -41,6 +41,7 @@
     </div>
 
     <script src="modernizr-custom.js"></script>
     </div>
 
     <script src="modernizr-custom.js"></script>
+    <script src="unfetch.js"></script>
     <script src="lib.min.js"></script>
   </body>
 </html>
     <script src="lib.min.js"></script>
   </body>
 </html>
index 9fdeb1ca2be44c424467fb5f8499e54ae87a83c1..91f918016f573825bc22c19f2e108a2ddb8c30e4 100644 (file)
@@ -1,3 +1,3 @@
-/*! modernizr 3.5.0 (Custom Build) | MIT *
- * https://modernizr.com/download/?-fetch-setclasses !*/
-!function(n,e,s){ function o(n,e){ return typeof n===e; } function a(){ var n,e,s,a,t,l,r; for(var c in f) if(f.hasOwnProperty(c)) { if(n=[],e=f[c],e.name && (n.push(e.name.toLowerCase()),e.options && e.options.aliases && e.options.aliases.length)) for(s=0;s<e.options.aliases.length;s++) n.push(e.options.aliases[s].toLowerCase()); for(a=o(e.fn,'function')?e.fn():e.fn,t=0;t<n.length;t++) l=n[t],r=l.split('.'),1===r.length?Modernizr[r[0]]=a:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=a),i.push((a?'':'no-')+r.join('-'));}} function t(n){var e=r.className,s=Modernizr._config.classPrefix||'';if(c&&(e=e.baseVal),Modernizr._config.enableJSClass){var o=new RegExp('(^|\\s)'+s+'no-js(\\s|$)');e=e.replace(o,'$1'+s+'js$2');}Modernizr._config.enableClasses&&(e+=' '+s+n.join(' '+s),c?r.className.baseVal=e:r.className=e);}var i=[],f=[],l={_version:'3.5.0',_config:{classPrefix:'',enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(n,e){var s=this;setTimeout(function(){e(s[n]);},0);},addTest:function(n,e,s){f.push({name:n,fn:e,options:s});},addAsyncTest:function(n){f.push({name:null,fn:n});}},Modernizr=function(){};Modernizr.prototype=l,Modernizr=new Modernizr;var r=e.documentElement,c='svg'===r.nodeName.toLowerCase();Modernizr.addTest('fetch','fetch'in n),a(),t(i),delete l.addTest,delete l.addAsyncTest;for(var u=0;u<Modernizr._q.length;u++)Modernizr._q[u]();n.Modernizr=Modernizr;}(window,document);
+/*! modernizr 3.6.0 (Custom Build) | MIT *
+ * https://modernizr.com/download/?-fetch-promises-setclasses !*/
+!function(e,n,s){function o(e){var n=l.className,s=Modernizr._config.classPrefix||"";if(c&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+s+"no-js(\\s|$)");n=n.replace(o,"$1"+s+"js$2")}Modernizr._config.enableClasses&&(n+=" "+s+e.join(" "+s),c?l.className.baseVal=n:l.className=n)}function i(e,n){return typeof e===n}function a(){var e,n,s,o,a,f,l;for(var c in r)if(r.hasOwnProperty(c)){if(e=[],n=r[c],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(s=0;s<n.options.aliases.length;s++)e.push(n.options.aliases[s].toLowerCase());for(o=i(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)f=e[a],l=f.split("."),1===l.length?Modernizr[l[0]]=o:(!Modernizr[l[0]]||Modernizr[l[0]]instanceof Boolean||(Modernizr[l[0]]=new Boolean(Modernizr[l[0]])),Modernizr[l[0]][l[1]]=o),t.push((o?"":"no-")+l.join("-"))}}var t=[],r=[],f={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var s=this;setTimeout(function(){n(s[e])},0)},addTest:function(e,n,s){r.push({name:e,fn:n,options:s})},addAsyncTest:function(e){r.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=f,Modernizr=new Modernizr,Modernizr.addTest("promises",function(){return"Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var n;return new e.Promise(function(e){n=e}),"function"==typeof n}()}),Modernizr.addTest("fetch","fetch"in e);var l=n.documentElement,c="svg"===l.nodeName.toLowerCase();a(),o(t),delete f.addTest,delete f.addAsyncTest;for(var u=0;u<Modernizr._q.length;u++)Modernizr._q[u]();e.Modernizr=Modernizr}(window,document);
diff --git a/app/unfetch.js b/app/unfetch.js
new file mode 100644 (file)
index 0000000..728eb4b
--- /dev/null
@@ -0,0 +1 @@
+self.fetch||(self.fetch=function(e,n){return n=n||{},new Promise(function(t,s){var r=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(r.status/100|0),statusText:r.statusText,status:r.status,url:r.responseURL,text:function(){return Promise.resolve(r.responseText)},json:function(){return Promise.resolve(r.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([r.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var c in r.open(n.method||"get",e,!0),r.onload=function(){r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+","+t:t}),t(a())},r.onerror=s,r.withCredentials="include"==n.credentials,n.headers)r.setRequestHeader(c,n.headers[c]);r.send(n.body||null)})});
index 22e7dd6b734212fc54fc79f9a8807318e2f7be5f..46c77b00547c0ed1af86758b967f5511f9d7ca72 100644 (file)
@@ -20,14 +20,14 @@ BooksView.init(BooksModel);
 PagingController.init(BooksModel);
 SearchController.init(BooksModel);
 
 PagingController.init(BooksModel);
 SearchController.init(BooksModel);
 
-if (Modernizr.fetch) {
+if (Modernizr.promises) {
     console.log('quanweb:  browser feature check:  OK');
 }
 else {
     // If we cared about supporting older browsers (at this point, IE11 and Adroid 4.x's built-in browser,
     // neither of which is due to receive security patch support for much longer), then we would insert a 
     console.log('quanweb:  browser feature check:  OK');
 }
 else {
     // If we cared about supporting older browsers (at this point, IE11 and Adroid 4.x's built-in browser,
     // neither of which is due to receive security patch support for much longer), then we would insert a 
-    // shim here to implement the fetch API.  But, in this case, we don't and won't.
-    alert('Sorry, this page will not work in your browser.\nPlease use a recent version of Chrome, Edge or Firefox instead.');
+    // shim here to implement promises.  But, in this case, we don't and won't.
+    alert('Sorry, this page will not work in your browser.\nPlease use a recent version of Chrome, Edge, Firefox or Safari instead.');
 }
 
 // ================
 }
 
 // ================