Skip to content

Instantly share code, notes, and snippets.

@SagiriHimoto
Last active December 27, 2022 10:44
Show Gist options
  • Save SagiriHimoto/7d9555c3044eaa2c7a9eb9832beb77d7 to your computer and use it in GitHub Desktop.
Save SagiriHimoto/7d9555c3044eaa2c7a9eb9832beb77d7 to your computer and use it in GitHub Desktop.
Allows you to export pony town toy textures with ease
/* Download Function */
const downloadURI = (uri, name) => {
const link = document.createElement("a");
link.download = name;
link.href = uri;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
/* Locate toy and download function */
function GetToyURIDownload(toynomber) {
const childnumber = toynomber + 2
var sourceCanvas = document.querySelector("body > modal-container > div.modal-dialog.undefined > div > toys-modal > div.modal-body > div.selection-container > div > div > div > div:nth-child("+childnumber+") > toy-canvas > canvas");
sourceImageData = sourceCanvas.toDataURL("image/png");
downloadURI(""+sourceImageData+"", "Toy "+toynomber+"");
}
/* Put toy nomber in brackets */
/* If you are missing some toys in the list, then subtract the amount of missing toys from the toy number */
GetToyURIDownload()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment