Use Blob.js and FileSaver.js for providing file downloads across platforms lacking blob and HTML5 download links.
This commit is contained in:
1 parent
984ab06100
commit
1391f628a8
8 files changed
+478
-22
No files matched your search
@@ -750,25 +750,19 @@ GuacUI.Download = function(filename) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Given the mimetype and URL for the final download, removes the progress
|
||||
* indicator and replaces it with a download link for the completed file.
|
||||
*
|
||||
* @param {String} mimetype The mimetype of the download.
|
||||
* @param {String} url The URL of the download.
|
||||
* Removes the progress indicator and replaces it with a download button.
|
||||
*/
|
||||
this.complete = function(mimetype, url) {
|
||||
this.complete = function() {
|
||||
|
||||
element.removeChild(progress);
|
||||
GuacUI.addClass(element, "complete");
|
||||
|
||||
var link = GuacUI.createChildElement(
|
||||
GuacUI.createChildElement(element, "div", "download"),
|
||||
"a");
|
||||
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.type = mimetype;
|
||||
link.textContent = "Download";
|
||||
var download = GuacUI.createChildElement(element, "div", "download");
|
||||
download.textContent = "Download";
|
||||
download.onclick = function() {
|
||||
if (guac_download.ondownload)
|
||||
guac_download.ondownload();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -785,4 +779,10 @@ GuacUI.Download = function(filename) {
|
||||
*/
|
||||
this.onclose = null;
|
||||
|
||||
/**
|
||||
* Called when the download button of this notification is clicked.
|
||||
* @event
|
||||
*/
|
||||
this.ondownload = null;
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user