diff --git a/main.user.js b/main.user.js index 692f574..fc1c522 100644 --- a/main.user.js +++ b/main.user.js @@ -3,7 +3,7 @@ // @namespace https://git.euph.dev/Snoweuph // @match https://army-forge.onepagerules.com/view* // @grant none -// @version 1.0.0 +// @version 1.0.1 // @author Snoweuph // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://html2canvas.hertzen.com/dist/html2canvas.min.js @@ -13,11 +13,12 @@ document.addEventListener("keydown", (event) => { if (event.ctrlKey && event.key === "s") { event.preventDefault(); - generate(); + generateCards(); + generateRules(); } }); -function generate() { +function generateCards() { const cards_root = document.getElementsByClassName("MuiContainer-root")[0].firstElementChild; @@ -50,6 +51,23 @@ function generate() { }); } +function generateRules() { + const rules_root = + document.getElementsByClassName("MuiContainer-root")[1].firstElementChild.firstElementChild.firstElementChild.firstElementChild.lastElementChild; + rules_root.style.displa = "flex" + rules_root.style.flexDirection = "column" + rules_root.style.gap = "1rem" + + html2canvas(rules_root, { scale: 15, backgroundColor: null }).then((canvas) => { + const link = document.createElement("a"); + link.download = "Rules.png"; + link.href = canvas.toDataURL(); + document.body.appendChild(link); + link.click(); + }); +} + + // Extract Title of Card function getHeaderTitle(pElement) { let textContent = "";