feat: add another script for olm.vn

This commit is contained in:
tretrauit 2024-04-04 16:51:45 +07:00
parent 09328660a0
commit b3cf9776f2

View File

@ -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();