mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-01-24 04:08:04 -08:00
Remove Deprecated IE11 msSaveBlob Code
This commit is contained in:
18
src/parse.js
18
src/parse.js
@@ -525,17 +525,13 @@ function getFilesFromPeers() {
|
|||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/a/36899900/2700296
|
|
||||||
function saveTorrent() {
|
function saveTorrent() {
|
||||||
let data = toTorrentFile(parsed);
|
const data = toTorrentFile(parsed);
|
||||||
if (data !== null && navigator.msSaveBlob) return navigator.msSaveBlob(new Blob([data], { type: 'application/x-bittorrent' }), parsed.name + '.torrent');
|
const blob = new Blob([data], { type: 'application/x-bittorrent' });
|
||||||
let a = document.createElement('a');
|
const url = URL.createObjectURL(blob);
|
||||||
a.style.display = 'none';
|
const a = document.createElement('a');
|
||||||
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/x-bittorrent' }));
|
a.href = url;
|
||||||
a.setAttribute('href', url);
|
a.download = parsed.name + '.torrent';
|
||||||
a.setAttribute('download', parsed.name + '.torrent');
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
a.remove();
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user