fix exporting larger srts

This commit is contained in:
j 2015-12-25 19:17:47 +05:30
parent 4c7afc7428
commit 328b3752fc

View file

@ -266,17 +266,19 @@ function saveTxt() {
} }
function saveContent(content, type, path) { function saveContent(content, type, path) {
var uriContent = 'data:'+type+';base64,' + btoa(content); var blob = new Blob([content], {type: type});
var pom = document.createElement('a'); var url = window.URL.createObjectURL(blob);
pom.setAttribute('href', content); var a = document.createElement('a');
pom.setAttribute('download', path); a.href = url;
a.download = path;
if (document.createEvent) { if (document.createEvent) {
var event = document.createEvent('MouseEvents'); var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true); event.initEvent('click', true, true);
pom.dispatchEvent(event); a.dispatchEvent(event);
} else { } else {
pom.click(); a.click();
} }
window.URL.revokeObjectURL(url);
} }
function stDialog(titleTxt, text) { function stDialog(titleTxt, text) {