fix backup file download
This commit is contained in:
parent
839344a0b5
commit
0c786ebd6a
2 changed files with 6 additions and 26 deletions
|
|
@ -694,19 +694,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
self.csvHistory = function() {
|
self.csvHistory = function() {
|
||||||
|
|
||||||
function saveFile(name, data) {
|
|
||||||
var chooser = document.querySelector(name);
|
|
||||||
chooser.addEventListener("change", function(evt) {
|
|
||||||
var fs = require('fs');
|
|
||||||
fs.writeFile(this.value, data, function(err) {
|
|
||||||
if (err) {
|
|
||||||
$log.debug(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, false);
|
|
||||||
chooser.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDate(date) {
|
function formatDate(date) {
|
||||||
var dateObj = new Date(date);
|
var dateObj = new Date(date);
|
||||||
if (!dateObj) {
|
if (!dateObj) {
|
||||||
|
|
|
||||||
|
|
@ -31,25 +31,18 @@ angular.module('copayApp.services')
|
||||||
});
|
});
|
||||||
$log.debug("case 3");
|
$log.debug("case 3");
|
||||||
} else {
|
} else {
|
||||||
// We're screwed, blob constructor unsupported entirely
|
// We're screwed, blob constructor unsupported entirely
|
||||||
$log.debug("Error");
|
$log.debug("Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
var a = document.createElement("a");
|
var a = angular.element('<a></a>');
|
||||||
document.body.appendChild(a);
|
|
||||||
a.style.display = "none";
|
|
||||||
|
|
||||||
var blob = new NewBlob(ew, 'text/plain;charset=utf-8');
|
var blob = new NewBlob(ew, 'text/plain;charset=utf-8');
|
||||||
var url = window.URL.createObjectURL(blob);
|
a.attr('href',window.URL.createObjectURL(blob));
|
||||||
a.href = url;
|
a.attr('download', filename);
|
||||||
a.download = filename;
|
a[0].click();
|
||||||
a.click();
|
|
||||||
$timeout(function() {
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
}, 250);
|
|
||||||
return cb();
|
return cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -92,4 +85,4 @@ angular.module('copayApp.services')
|
||||||
_download(ew, filename, cb)
|
_download(ew, filename, cb)
|
||||||
};
|
};
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue