From 8ac3c9b3d73c7e383b875996e07c0168d782395c Mon Sep 17 00:00:00 2001 From: Simko Date: Tue, 11 Oct 2016 11:11:26 +0200 Subject: [PATCH] add basic auth and update uglify --- dist/jszip-utils-ie.js | 2 +- dist/jszip-utils-ie.min.js | 6 +++-- dist/jszip-utils.js | 10 ++++++--- dist/jszip-utils.min.js | 45 ++++++++++++++++++++++++++++++++++++-- lib/index.js | 6 ++++- lib/license_header.js | 2 +- package.json | 4 ++-- 7 files changed, 63 insertions(+), 12 deletions(-) diff --git a/dist/jszip-utils-ie.js b/dist/jszip-utils-ie.js index 43dbc09..8ecb85a 100644 --- a/dist/jszip-utils-ie.js +++ b/dist/jszip-utils-ie.js @@ -1,4 +1,4 @@ -/*! +/* JSZipUtils - A collection of cross-browser utilities to go along with JSZip. diff --git a/dist/jszip-utils-ie.min.js b/dist/jszip-utils-ie.min.js index 3cdbbf8..e90eb05 100644 --- a/dist/jszip-utils-ie.min.js +++ b/dist/jszip-utils-ie.min.js @@ -1,4 +1,4 @@ -/*! +/* JSZipUtils - A collection of cross-browser utilities to go along with JSZip. @@ -7,4 +7,6 @@ JSZipUtils - A collection of cross-browser utilities to go along with JSZip. Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. */ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); \ No newline at end of file +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n"; +// inject VBScript +document.write(e),d.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;d<256;d++)for(var e=0;e<256;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); \ No newline at end of file diff --git a/dist/jszip-utils.js b/dist/jszip-utils.js index 948471a..41227cc 100644 --- a/dist/jszip-utils.js +++ b/dist/jszip-utils.js @@ -1,4 +1,4 @@ -/*! +/* JSZipUtils - A collection of cross-browser utilities to go along with JSZip. @@ -34,7 +34,7 @@ function createActiveXHR() { } // Create the request object -var createXHR = window.ActiveXObject ? +var createXHR = (typeof window !== "undefined" && window.ActiveXObject) ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available @@ -49,7 +49,7 @@ var createXHR = window.ActiveXObject ? -JSZipUtils.getBinaryContent = function(path, callback) { +JSZipUtils.getBinaryContent = function(path, callback, auth) { /* * Here is the tricky part : getting the data. * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined' @@ -70,6 +70,10 @@ JSZipUtils.getBinaryContent = function(path, callback) { xhr.open('GET', path, true); + if (auth) { + xhr.setRequestHeader("Authorization", "Basic " + auth); + } + // recent browsers if ("responseType" in xhr) { xhr.responseType = "arraybuffer"; diff --git a/dist/jszip-utils.min.js b/dist/jszip-utils.min.js index 223cedb..f80a885 100644 --- a/dist/jszip-utils.min.js +++ b/dist/jszip-utils.min.js @@ -1,4 +1,4 @@ -/*! +/* JSZipUtils - A collection of cross-browser utilities to go along with JSZip. @@ -7,4 +7,45 @@ JSZipUtils - A collection of cross-browser utilities to go along with JSZip. Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. */ -!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g diff --git a/package.json b/package.json index 417927c..04d8e82 100644 --- a/package.json +++ b/package.json @@ -36,9 +36,9 @@ "browserify": "~2.35.0", "grunt-browserify": "~1.3.0", "grunt-contrib-jshint": "~0.6.4", - "grunt-contrib-uglify": "~0.2.4" + "grunt-contrib-uglify": "~1.0.2" }, "dependencies":{ }, - "license": "MIT or GPLv3" + "license": "(MIT OR GPL-3.0)" }