diff --git a/public/assets/js/csvxmlV2.js b/public/assets/js/csvxmlV2.js
index 4c9333a..f158b0a 100644
--- a/public/assets/js/csvxmlV2.js
+++ b/public/assets/js/csvxmlV2.js
@@ -450,28 +450,48 @@ class CsvxmlPage {
zipUploadToXml(validator) {
- let zip = new JSZip();
+ // Wrap zipping in function to postload it
+ function runZipping() {
+
+ let zip = new JSZip();
+
+ let xmlFiles = validator.generateXml();
+ const serializer = new XMLSerializer();
+ let lineCounter = 0;
+ for (let xml of xmlFiles) {
+ zip.file(lineCounter + ".xml", serializer.serializeToString(xml));
+ lineCounter++;
+ }
+
+ zip.generateAsync({type:"blob"})
+ .then(function(content) {
+ const triggerLink = document.createElement('a');
+ triggerLink.href = window.URL.createObjectURL(content);
+ triggerLink.setAttribute('download', "csvxml.zip");
+
+ triggerLink.style.display = 'none';
+
+ document.body.appendChild(triggerLink);
+ triggerLink.click();
+ document.body.removeChild(triggerLink);
+ });
- let xmlFiles = validator.generateXml();
- const serializer = new XMLSerializer();
- let lineCounter = 0;
- for (let xml of xmlFiles) {
- zip.file(lineCounter + ".xml", serializer.serializeToString(xml));
- lineCounter++;
}
- zip.generateAsync({type:"blob"})
- .then(function(content) {
- const triggerLink = document.createElement('a');
- triggerLink.href = window.URL.createObjectURL(content);
- triggerLink.setAttribute('download', "csvxml.zip");
+ if (typeof JSZip === "undefined") {
- triggerLink.style.display = 'none';
+ const loadScript = document.createElement("script");
+ loadScript.setAttribute("src", "assets/js/jszip/dist/jszip.min.js");
+ loadScript.addEventListener('load', function() {
+ // console.log("Post-loaded OpenLayers");
+ runZipping();
+ }, {passive: true, once: true});
- document.body.appendChild(triggerLink);
- triggerLink.click();
- document.body.removeChild(triggerLink);
- });
+ document.body.appendChild(loadScript);
+ }
+ else {
+ runZipping();
+ }
}
diff --git a/public/index.php b/public/index.php
index db2edde..6704ccf 100644
--- a/public/index.php
+++ b/public/index.php
@@ -40,8 +40,6 @@ echo '
-
-