0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Update FileSaver.js v2014-08-29.

This commit is contained in:
XhmikosR 2014-07-25 08:40:14 +03:00 committed by XhmikosR
parent 7ded2d185d
commit 924c68f8bb
2 changed files with 15 additions and 6 deletions

View File

@ -129,7 +129,7 @@ module.exports = function (grunt) {
'docs/assets/js/vendor/jszip.min.js',
'docs/assets/js/vendor/uglify.min.js',
'docs/assets/js/vendor/Blob.js',
'docs/assets/js/vendor/filesaver.js',
'docs/assets/js/vendor/FileSaver.js',
'docs/assets/js/raw-files.min.js',
'docs/assets/js/src/customizer.js'
],

View File

@ -1,6 +1,6 @@
/* FileSaver.js
* A saveAs() FileSaver implementation.
* 2014-07-21
* 2014-08-29
*
* By Eli Grey, http://eligrey.com
* License: X11/MIT
@ -31,7 +31,7 @@ var saveAs = saveAs
return view.URL || view.webkitURL || view;
}
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
, can_use_save_link = !view.externalHost && "download" in save_link
, can_use_save_link = "download" in save_link
, click = function(node) {
var event = doc.createEvent("MouseEvents");
event.initMouseEvent(
@ -53,13 +53,18 @@ var saveAs = saveAs
// the reasoning behind the timeout and revocation flow
, arbitrary_revoke_timeout = 10
, revoke = function(file) {
setTimeout(function() {
var revoker = function() {
if (typeof file === "string") { // file is an object URL
get_URL().revokeObjectURL(file);
} else { // file is a File
file.remove();
}
}, arbitrary_revoke_timeout);
};
if (view.chrome) {
revoker();
} else {
setTimeout(revoker, arbitrary_revoke_timeout);
}
}
, dispatch = function(filesaver, event_types, event) {
event_types = [].concat(event_types);
@ -95,7 +100,11 @@ var saveAs = saveAs
if (target_view) {
target_view.location.href = object_url;
} else {
view.open(object_url, "_blank");
var new_tab = view.open(object_url, "_blank");
if (new_tab == undefined && typeof safari !== "undefined") {
//Apple do not allow window.open, see http://bit.ly/1kZffRI
view.location.href = object_url
}
}
filesaver.readyState = filesaver.DONE;
dispatch_all();