From e4e40fab4904ee9c655504e12e54d0b64b1f2121 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 12 Feb 2021 23:33:53 +0300 Subject: [PATCH] v1.5.24 - don't append link on save --- modules/save-and-load.js | 4 ---- modules/ui/3d.js | 1 - modules/ui/emblems-editor.js | 2 -- modules/ui/heightmap-editor.js | 1 - 4 files changed, 8 deletions(-) diff --git a/modules/save-and-load.js b/modules/save-and-load.js index 45ab02f0..4e785d7c 100644 --- a/modules/save-and-load.js +++ b/modules/save-and-load.js @@ -8,7 +8,6 @@ async function saveSVG() { const link = document.createElement("a"); link.download = getFileName() + ".svg"; link.href = url; - document.body.appendChild(link); link.click(); tip(`${link.download} is saved. Open "Downloads" screen (crtl + J) to check. You can set image scale in options`, true, "success", 5000); @@ -33,7 +32,6 @@ async function savePNG() { link.download = getFileName() + ".png"; canvas.toBlob(function(blob) { link.href = window.URL.createObjectURL(blob); - document.body.appendChild(link); link.click(); window.setTimeout(function() { canvas.remove(); @@ -64,7 +62,6 @@ async function saveJPEG() { const link = document.createElement("a"); link.download = getFileName() + ".jpeg"; link.href = URL; - document.body.appendChild(link); link.click(); tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000); window.setTimeout(() => window.URL.revokeObjectURL(URL), 5000); @@ -378,7 +375,6 @@ async function saveMap() { const link = document.createElement("a"); link.download = getFileName() + ".map"; link.href = URL; - document.body.appendChild(link); link.click(); tip(`${link.download} is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000); window.URL.revokeObjectURL(URL); diff --git a/modules/ui/3d.js b/modules/ui/3d.js index bd88decc..c7fa9aa0 100644 --- a/modules/ui/3d.js +++ b/modules/ui/3d.js @@ -121,7 +121,6 @@ const saveScreenshot = async function() { const link = document.createElement("a"); link.download = getFileName() + ".jpeg"; link.href = URL; - document.body.appendChild(link); link.click(); tip(`Screenshot is saved. Open "Downloads" screen (CTRL + J) to check`, true, "success", 7000); window.setTimeout(() => window.URL.revokeObjectURL(URL), 5000); diff --git a/modules/ui/emblems-editor.js b/modules/ui/emblems-editor.js index c3f08d8d..938c40c7 100644 --- a/modules/ui/emblems-editor.js +++ b/modules/ui/emblems-editor.js @@ -245,7 +245,6 @@ function editEmblem(type, id, el) { function downloadSVG(url, link) { link.href = url; - document.body.appendChild(link); link.click(); window.setTimeout(() => window.URL.revokeObjectURL(URL), 5000); } @@ -266,7 +265,6 @@ function editEmblem(type, id, el) { ctx.drawImage(img, 0, 0, canvas.width, canvas.height); const URL = await canvas.toDataURL("image/" + format, .92); link.href = URL; - document.body.appendChild(link); link.click(); window.setTimeout(() => window.URL.revokeObjectURL(URL), 5000); } diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js index 66fba656..73a8006e 100644 --- a/modules/ui/heightmap-editor.js +++ b/modules/ui/heightmap-editor.js @@ -1311,7 +1311,6 @@ function editHeightmap() { const link = document.createElement("a"); link.download = getFileName("Heightmap") + ".png"; link.href = imgBig; - document.body.appendChild(link); link.click(); canvas.remove(); }