Burocratas, emailconfirmed, Administradores da interface, Administradores (Semantic MediaWiki), Curadores (Semantic MediaWiki), Editores (Semantic MediaWiki), Supressores, Administradores
1 023
edições
Sem resumo de edição |
Sem resumo de edição |
||
/* jshint esversion:
/**
* Convert a base64 string in a Blob according to the data and contentType.
*/
function cardToImage() {
function b64toBlob(b64Data, contentType = '', sliceSize = 512) {▼
const byteCharacters = atob(b64Data);
▲function b64toBlob(b64Data, contentType, sliceSize) {
for (let offset =
const slice = byteCharacters.slice(offset, offset + sliceSize);
▲ let byteArrays = [];
const
for (let i = 0; i
const
▲ byteNumbers[i] = slice.charCodeAt(i);
▲ }
}
▲ byteArrays.push(byteArray);
return
}
// Generate screenshot and download▼
▲ let blob = new Blob(byteArrays, {type: contentType});
▲// Generate screenshot and download
▲let opt = {
scrollX: -window.scrollX,
scrollY: -window.scrollY,
};
html2canvas(element, opt).then(function (canvas) {
// Generate the base64 representation of the canvas
// Split the base64 string in data and contentType
// Get the content type
// get the real base64 content of the file
// Convert b64 to blob and store it into a variable (with real base64 as value)
// Generate file download
window.saveAs(canvasBlob,
});
}
|