parent
0613cb03c6
commit
3374bc134b
1 changed files with 21 additions and 26 deletions
47
main.user.js
47
main.user.js
|
@ -25,8 +25,8 @@ function generateCards() {
|
||||||
Array.from(cards_root.children).forEach((child) => {
|
Array.from(cards_root.children).forEach((child) => {
|
||||||
const card = child.firstElementChild;
|
const card = child.firstElementChild;
|
||||||
const header = card.firstElementChild;
|
const header = card.firstElementChild;
|
||||||
const title = getHeaderTitle(header)
|
const title = getHeaderTitle(header);
|
||||||
const unit_count = getUnitCount(title)
|
const unit_count = getUnitCount(title);
|
||||||
|
|
||||||
const marker_section = document.createElement("div");
|
const marker_section = document.createElement("div");
|
||||||
marker_section.style.display = "grid";
|
marker_section.style.display = "grid";
|
||||||
|
@ -56,35 +56,30 @@ function generateCards() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateRules() {
|
function generateRules() {
|
||||||
const rules_root = document.getElementsByClassName("MuiContainer-root")[0]
|
const rules_root =
|
||||||
.lastElementChild
|
document.getElementsByClassName("MuiContainer-root")[0].lastElementChild
|
||||||
.firstElementChild
|
.firstElementChild.firstElementChild.firstElementChild.firstElementChild
|
||||||
.firstElementChild
|
.lastElementChild.firstElementChild.firstElementChild.firstElementChild
|
||||||
.firstElementChild
|
.firstElementChild.firstElementChild;
|
||||||
.firstElementChild
|
|
||||||
.lastElementChild
|
|
||||||
.firstElementChild
|
|
||||||
.firstElementChild
|
|
||||||
.firstElementChild
|
|
||||||
.firstElementChild
|
|
||||||
.firstElementChild
|
|
||||||
|
|
||||||
rules_root.style.display = "flex"
|
rules_root.style.display = "flex";
|
||||||
rules_root.style.flexDirection = "column"
|
rules_root.style.flexDirection = "column";
|
||||||
rules_root.style.gap = "1rem"
|
rules_root.style.gap = "1rem";
|
||||||
|
|
||||||
html2canvas(rules_root, { scale: 15, backgroundColor: null }).then((canvas) => {
|
html2canvas(rules_root, { scale: 15, backgroundColor: null }).then(
|
||||||
const link = document.createElement("a");
|
(canvas) => {
|
||||||
link.download = "Rules.png";
|
const link = document.createElement("a");
|
||||||
link.href = canvas.toDataURL();
|
link.download = "Rules.png";
|
||||||
document.body.appendChild(link);
|
link.href = canvas.toDataURL();
|
||||||
link.click();
|
document.body.appendChild(link);
|
||||||
});
|
link.click();
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUnitCount(str) {
|
function getUnitCount(str) {
|
||||||
const match = str.match(/^\d+/);
|
const match = str.match(/^\d+/);
|
||||||
return match ? parseInt(match[0], 10) : 1;
|
return match ? parseInt(match[0], 10) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHeaderTitle(pElement) {
|
function getHeaderTitle(pElement) {
|
||||||
|
|
Loading…
Reference in a new issue