mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-02 14:24:19 +01:00
Update FileSaver.js v2014-08-29.
This commit is contained in:
parent
7ded2d185d
commit
924c68f8bb
@ -129,7 +129,7 @@ module.exports = function (grunt) {
|
|||||||
'docs/assets/js/vendor/jszip.min.js',
|
'docs/assets/js/vendor/jszip.min.js',
|
||||||
'docs/assets/js/vendor/uglify.min.js',
|
'docs/assets/js/vendor/uglify.min.js',
|
||||||
'docs/assets/js/vendor/Blob.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/raw-files.min.js',
|
||||||
'docs/assets/js/src/customizer.js'
|
'docs/assets/js/src/customizer.js'
|
||||||
],
|
],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* FileSaver.js
|
/* FileSaver.js
|
||||||
* A saveAs() FileSaver implementation.
|
* A saveAs() FileSaver implementation.
|
||||||
* 2014-07-21
|
* 2014-08-29
|
||||||
*
|
*
|
||||||
* By Eli Grey, http://eligrey.com
|
* By Eli Grey, http://eligrey.com
|
||||||
* License: X11/MIT
|
* License: X11/MIT
|
||||||
@ -31,7 +31,7 @@ var saveAs = saveAs
|
|||||||
return view.URL || view.webkitURL || view;
|
return view.URL || view.webkitURL || view;
|
||||||
}
|
}
|
||||||
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
, 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) {
|
, click = function(node) {
|
||||||
var event = doc.createEvent("MouseEvents");
|
var event = doc.createEvent("MouseEvents");
|
||||||
event.initMouseEvent(
|
event.initMouseEvent(
|
||||||
@ -53,13 +53,18 @@ var saveAs = saveAs
|
|||||||
// the reasoning behind the timeout and revocation flow
|
// the reasoning behind the timeout and revocation flow
|
||||||
, arbitrary_revoke_timeout = 10
|
, arbitrary_revoke_timeout = 10
|
||||||
, revoke = function(file) {
|
, revoke = function(file) {
|
||||||
setTimeout(function() {
|
var revoker = function() {
|
||||||
if (typeof file === "string") { // file is an object URL
|
if (typeof file === "string") { // file is an object URL
|
||||||
get_URL().revokeObjectURL(file);
|
get_URL().revokeObjectURL(file);
|
||||||
} else { // file is a File
|
} else { // file is a File
|
||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
}, arbitrary_revoke_timeout);
|
};
|
||||||
|
if (view.chrome) {
|
||||||
|
revoker();
|
||||||
|
} else {
|
||||||
|
setTimeout(revoker, arbitrary_revoke_timeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
, dispatch = function(filesaver, event_types, event) {
|
, dispatch = function(filesaver, event_types, event) {
|
||||||
event_types = [].concat(event_types);
|
event_types = [].concat(event_types);
|
||||||
@ -95,7 +100,11 @@ var saveAs = saveAs
|
|||||||
if (target_view) {
|
if (target_view) {
|
||||||
target_view.location.href = object_url;
|
target_view.location.href = object_url;
|
||||||
} else {
|
} 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;
|
filesaver.readyState = filesaver.DONE;
|
||||||
dispatch_all();
|
dispatch_all();
|
Loading…
Reference in New Issue
Block a user