feat: add another script for olm.vn
This commit is contained in:
parent
09328660a0
commit
b3cf9776f2
24
web/olm.vn/screenshot-answer-custom.js
Normal file
24
web/olm.vn/screenshot-answer-custom.js
Normal 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();
|
Loading…
Reference in New Issue
Block a user