Skip to content

Instantly share code, notes, and snippets.

@bathos
Created May 24, 2017 02:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bathos/0e86802eba185783f5c3e7147bda6197 to your computer and use it in GitHub Desktop.
Save bathos/0e86802eba185783f5c3e7147bda6197 to your computer and use it in GitHub Desktop.
clippen-majik.js
document.querySelectorAll('canvas')[1].getContext('2d').drawImage = function(canvas) {
const downloadButton = document.getElementById('download');
const anchor = document.createElement('a');
anchor.download = 'poop.png';
anchor.innerText = 'POOP';
anchor.setAttribute('class', downloadButton.getAttribute('class'));
downloadButton.parentElement.replaceChild(anchor, downloadButton);
anchor.addEventListener('click', event => {
anchor.href = canvas.toDataURL();
});
delete this.drawImage;
this.drawImage(...arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment