diff --git a/web/olm.vn/screenshot-answer-custom.js b/web/olm.vn/screenshot-answer-custom.js new file mode 100644 index 0000000..007cb1b --- /dev/null +++ b/web/olm.vn/screenshot-answer-custom.js @@ -0,0 +1,24 @@ +// Dependencies +eval( + await ( + await fetch("https://html2canvas.hertzen.com/dist/html2canvas.min.js") + ).text(), +); + +async function screenshotAnswer(answerElement) { + console.log(answerElement); + const canvas = await html2canvas(answerElement); + return await canvas.toDataURL(); +} + +const answerCol = document.querySelector("#list-question"); +// Patch the style to make it show all answers +answerCol.style.maxHeight = "10000vh"; +const answerImgData = await screenshotAnswer(answerCol); +// Create an image +const img = new Image(); +img.src = answerImgData; +const w = window.open(""); +// Write the image to the new window +w.document.write(img.outerHTML); +w.document.close();