Update creator-17.js

This commit is contained in:
Kyle
2021-05-10 17:06:33 -07:00
parent df327086d8
commit 87934d5ced

View File

@@ -1,7 +1,7 @@
//URL Params //URL Params
var params = new URLSearchParams(window.location.search); var params = new URLSearchParams(window.location.search);
const debugging = params.get('debug') != null; const debugging = params.get('debug') != null;
if (debugging) {alert('debugging - 2.4');} if (debugging) {alert('debugging - 2.5');}
//To save the server from being overloaded? Maybe? //To save the server from being overloaded? Maybe?
function fixUri(input) { function fixUri(input) {
@@ -1296,16 +1296,13 @@ async function downloadCard() {
imageName += '.png'; imageName += '.png';
downloadElement.download = imageName; downloadElement.download = imageName;
downloadElement.href = cardCanvas.toDataURL(); downloadElement.href = cardCanvas.toDataURL();
if (debugging) { downloadElement.target = '_blank';
console.log(imageName); if (!debugging) {downloadElement.style.display = 'none';} else {
console.log(downloadElement.href.split(';')[0]); downloadElement.innerHTML = 'Try clicking me :)'
downloadElement.href = downloadElement.href.replace(/^data:image\/png/, `data:application/octet-stream;headers=Content-Disposition%3A%20attachment%3B%20filename=${imageName}`);
console.log(downloadElement.href.split(';')[0]);
console.log(downloadElement.href.split(';')[1]);
console.log(downloadElement);
} }
document.body.appendChild(downloadElement); document.body.appendChild(downloadElement);
await downloadElement.click(); await downloadElement.click();
if (debugging) {return}
downloadElement.remove(); downloadElement.remove();
} }
} }