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
var params = new URLSearchParams(window.location.search);
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?
function fixUri(input) {
@@ -1296,16 +1296,13 @@ async function downloadCard() {
imageName += '.png';
downloadElement.download = imageName;
downloadElement.href = cardCanvas.toDataURL();
if (debugging) {
console.log(imageName);
console.log(downloadElement.href.split(';')[0]);
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);
downloadElement.target = '_blank';
if (!debugging) {downloadElement.style.display = 'none';} else {
downloadElement.innerHTML = 'Try clicking me :)'
}
document.body.appendChild(downloadElement);
await downloadElement.click();
if (debugging) {return}
downloadElement.remove();
}
}