diff --git a/FileSaver.js b/FileSaver.js index fe9265d..ba40736 100644 --- a/FileSaver.js +++ b/FileSaver.js @@ -1,4 +1,4 @@ -/*! FileSaver.js v1.3.5 +/*! FileSaver.js v1.3.6 * * A saveAs() FileSaver implementation. * @@ -151,7 +151,7 @@ ; // IE 10+ (native saveAs) if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { - return function (blob, name, no_auto_bom) { + saveAs = function (blob, name, no_auto_bom) { name = name || blob.name || "download"; if (!no_auto_bom) { diff --git a/FileSaver.min.js b/FileSaver.min.js index 7c75b31..02cbd22 100644 --- a/FileSaver.min.js +++ b/FileSaver.min.js @@ -1,4 +1,4 @@ -/*! FileSaver.js v1.3.5 +/*! FileSaver.js v1.3.6 * * A saveAs() FileSaver implementation. * @@ -7,4 +7,4 @@ * * License: MIT (https://github.com/clarketm/FileSaver.js/blob/master/LICENSE.md) */ -(function(e,t){if(typeof exports==="object"&&typeof exports.nodeName!=="string"){module.exports=e.document?t(e,true):function(e){if(!e.document){throw new Error("FileSaver requires a window with a document")}return t(e)}}else{t(e)}})(window||this,function(e,t){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var n=e.document,r=function(){return e.URL||e.webkitURL||e},o=n.createElementNS("http://www.w3.org/1999/xhtml","a"),i="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},f=/constructor/i.test(e.HTMLElement)||e.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent),c=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},d="application/octet-stream",s=1e3*40,l=function(e){var t=function(){if(typeof e==="string"){r().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,s)},p=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(e){c(e)}}}},w=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},m=function(t,n,c){if(!c){t=w(t)}var s=this,m=t.type,v=m===d,y,h=function(){p(s,"writestart progress write writeend".split(" "))},S=function(){if((u||v&&f)&&e.FileReader){var n=new FileReader;n.onloadend=function(){var t=u?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");var r=e.open(t,"_blank");if(!r)e.location.href=t;t=undefined;s.readyState=s.DONE;h()};n.readAsDataURL(t);s.readyState=s.INIT;return}if(!y){y=r().createObjectURL(t)}if(v){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}s.readyState=s.DONE;h();l(y)};s.readyState=s.INIT;if(i){y=r().createObjectURL(t);setTimeout(function(){o.href=y;o.download=n;a(o);h();l(y);s.readyState=s.DONE});return}S()},v=m.prototype,y=function(e,t,n){return new m(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=w(e)}return navigator.msSaveOrOpenBlob(e,t)}}v.abort=function(){};v.readyState=v.INIT=0;v.WRITING=1;v.DONE=2;v.error=v.onwritestart=v.onprogress=v.onwrite=v.onabort=v.onerror=v.onwriteend=null;if(typeof define==="function"&&define.amd){define("file-saverjs",[],function(){return y})}if(typeof t==="undefined"){e.saveAs=y}return y}); +(function(e,t){if(typeof exports==="object"&&typeof exports.nodeName!=="string"){module.exports=e.document?t(e,true):function(e){if(!e.document){throw new Error("FileSaver requires a window with a document")}return t(e)}}else{t(e)}})(window||this,function(e,t){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var n=e.document,r=function(){return e.URL||e.webkitURL||e},o=n.createElementNS("http://www.w3.org/1999/xhtml","a"),i="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},f=/constructor/i.test(e.HTMLElement)||e.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent),c=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},d="application/octet-stream",s=1e3*40,l=function(e){var t=function(){if(typeof e==="string"){r().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,s)},p=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(e){c(e)}}}},w=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},m=function(t,n,c){if(!c){t=w(t)}var s=this,m=t.type,v=m===d,y,h=function(){p(s,"writestart progress write writeend".split(" "))},S=function(){if((u||v&&f)&&e.FileReader){var n=new FileReader;n.onloadend=function(){var t=u?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");var r=e.open(t,"_blank");if(!r)e.location.href=t;t=undefined;s.readyState=s.DONE;h()};n.readAsDataURL(t);s.readyState=s.INIT;return}if(!y){y=r().createObjectURL(t)}if(v){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}s.readyState=s.DONE;h();l(y)};s.readyState=s.INIT;if(i){y=r().createObjectURL(t);setTimeout(function(){o.href=y;o.download=n;a(o);h();l(y);s.readyState=s.DONE});return}S()},v=m.prototype,y=function(e,t,n){return new m(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){y=function(e,t,n){t=t||e.name||"download";if(!n){e=w(e)}return navigator.msSaveOrOpenBlob(e,t)}}v.abort=function(){};v.readyState=v.INIT=0;v.WRITING=1;v.DONE=2;v.error=v.onwritestart=v.onprogress=v.onwrite=v.onabort=v.onerror=v.onwriteend=null;if(typeof define==="function"&&define.amd){define("file-saverjs",[],function(){return y})}if(typeof t==="undefined"){e.saveAs=y}return y}); diff --git a/bower.json b/bower.json index df69321..d2179c1 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "file-saverjs", "main": "FileSaver.js", - "version": "1.3.5", + "version": "1.3.6", "homepage": "https://github.com/clarketm/FileSaver.js#readme", "authors": [ "clarketm ", diff --git a/demo/demo.js b/demo/demo.js old mode 100755 new mode 100644 diff --git a/demo/demo.min.js b/demo/demo.min.js old mode 100755 new mode 100644 diff --git a/package.json b/package.json index 89c3445..df55f6c 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "file-saverjs", - "version": "1.3.5", + "version": "1.3.6", "description": "An HTML5 saveAs() FileSaver implementation", "main": "FileSaver.js", "scripts": { "test": "exit 0", - "build": "node_modules/.bin/uglifyjs FileSaver.js --mangle --comments '/^!|@preserve|@license|@cc_on/i' > FileSaver.min.js" + "build": "uglifyjs FileSaver.js --mangle --comments '/^!|@preserve|@license|@cc_on/i' > FileSaver.min.js" }, "repository": { "type": "git",