From 5104ec1c6366cd072743edac6e4e42d09ee9235c Mon Sep 17 00:00:00 2001 From: reviewher Date: Mon, 20 Sep 2021 20:41:37 -0700 Subject: [PATCH] require.js demo cleanup [ci skip] --- demos/requirejs/Makefile | 4 ++-- demos/requirejs/app.js | 16 +++++----------- demos/requirejs/browser.html | 1 - demos/requirejs/optimizer.html | 1 - jszip.js | 2 +- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/demos/requirejs/Makefile b/demos/requirejs/Makefile index ea72104..584e26f 100644 --- a/demos/requirejs/Makefile +++ b/demos/requirejs/Makefile @@ -4,7 +4,7 @@ all: $(TOOL).js .PHONY: $(TOOL).js $(TOOL).js: - if [ ! -e require.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/comments/require.js; fi - if [ ! -e r.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/r.js; fi + if [ ! -e require.js ]; then curl -LO http://requirejs.org/docs/release/2.3.3/comments/require.js; fi + if [ ! -e r.js ]; then curl -LO http://requirejs.org/docs/release/2.3.3/r.js; fi rm -f xlsx.full.min.js; ln -s ../../dist/xlsx.full.min.js node r.js -o build.js paths.requireLib=./require include=requireLib diff --git a/demos/requirejs/app.js b/demos/requirejs/app.js index fcbc8dc..ea6dc98 100644 --- a/demos/requirejs/app.js +++ b/demos/requirejs/app.js @@ -87,10 +87,6 @@ var b64it = window.b64it = (function() { })(); var do_file = (function() { - var rABS = typeof FileReader !== "undefined" && (FileReader.prototype||{}).readAsBinaryString; - var domrabs = document.getElementsByName("userabs")[0]; - if(!rABS) domrabs.disabled = !(domrabs.checked = false); - var use_worker = false && typeof Worker !== 'undefined'; var domwork = document.getElementsByName("useworker")[0]; if(!use_worker) domwork.disabled = !(domwork.checked = false); @@ -104,23 +100,21 @@ var do_file = (function() { case XW.msg: cb(JSON.parse(e.data.d)); break; } }; - worker.postMessage({d:data,b:rABS?'binary':'array'}); + worker.postMessage({d:data,b:'array'}); }; return function do_file(files) { - rABS = domrabs.checked; use_worker = domwork.checked; var f = files[0]; var reader = new FileReader(); reader.onload = function(e) { - if(typeof console !== 'undefined') console.log("onload", new Date(), rABS, use_worker); + if(typeof console !== 'undefined') console.log("onload", new Date(), use_worker); var data = e.target.result; - if(!rABS) data = new Uint8Array(data); + data = new Uint8Array(data); if(use_worker) xw(data, process_wb); - else process_wb(X.read(data, {type: rABS ? 'binary' : 'array'})); + else process_wb(X.read(data, {type: 'array'})); }; - if(rABS) reader.readAsBinaryString(f); - else reader.readAsArrayBuffer(f); + reader.readAsArrayBuffer(f); }; })(); diff --git a/demos/requirejs/browser.html b/demos/requirejs/browser.html index 22c28b6..690b18a 100644 --- a/demos/requirejs/browser.html +++ b/demos/requirejs/browser.html @@ -41,7 +41,6 @@ Output Format:
Advanced Demo Options: Use Web Workers: (when available) -Use readAsBinaryString: (when available)

 
diff --git a/demos/requirejs/optimizer.html b/demos/requirejs/optimizer.html index 248bd10..a65d469 100644 --- a/demos/requirejs/optimizer.html +++ b/demos/requirejs/optimizer.html @@ -41,7 +41,6 @@ Output Format:
Advanced Demo Options: Use Web Workers: (when available) -Use readAsBinaryString: (when available)

 
diff --git a/jszip.js b/jszip.js index 0f03c10..ad31cac 100644 --- a/jszip.js +++ b/jszip.js @@ -14,7 +14,7 @@ Note: since JSZip 3 removed critical functionality, this version assigns to the */ (function(e){ if("object"==typeof exports&&"undefined"!=typeof module&&"undefined"==typeof DO_NOT_EXPORT_JSZIP)module.exports=e(); - else if("function"==typeof define&&define.amd&&"undefined"==typeof DO_NOT_EXPORT_JSZIP){JSZipSync=e();define([],e);} + else if("function"==typeof define&&define.amd&&"undefined"==typeof DO_NOT_EXPORT_JSZIP){JSZipSync=e();define('j',[],e);} else{ var f; "undefined"!=typeof globalThis?f=globalThis: