Last active
November 6, 2016 07:45
-
-
Save saschanaz/2fc3032878568772632df6d90d4d77b8 to your computer and use it in GitHub Desktop.
bluehouse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toBlob(canvas) { | |
return new Promise((resolve, reject) => { | |
if (canvas.toBlob) { | |
canvas.toBlob(blob => resolve(blob)); | |
} | |
else if (canvas.msToBlob) { | |
resolve(canvas.msToBlob()); | |
} | |
}); | |
} | |
(() => { | |
const passcanvas = document.getElementById("passcanvas"); | |
const section = document.getElementsByTagName("section")[0]; | |
const img = new Image(); | |
img.margin = "1em"; | |
img.style.width = "calc(100% - 1.25em)"; | |
section.insertBefore(img, passcanvas); | |
passcanvas.remove(); | |
toBlob(passcanvas).then(blob => { | |
img.src = URL.createObjectURL(blob, { oneTimeOnly: true }); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment