fix exporting larger srts
This commit is contained in:
parent
4c7afc7428
commit
328b3752fc
1 changed files with 8 additions and 6 deletions
14
js/app.js
14
js/app.js
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue