Merge pull request #757 from GGodPL/main

Update betterMenuScreens.js
This commit is contained in:
slweeb 2024-08-08 12:08:33 -04:00 committed by GitHub
commit 8516931e1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -214,6 +214,11 @@ class MenuScreen {
return this;
}
setMenuTextId(id) {
this.menuTextId = id;
return this;
}
/**
* Adds a node to the menu screen content
* @param {Node|Node[]} node Any HTML node/element or array of HTML nodes/elements
@ -262,12 +267,13 @@ class MenuScreen {
parent.style.display = "none";
const inner = document.createElement("div");
inner.className = this.innerDivClass ?? "menuScreen";
inner.id = this.innerDivId;
inner.innerHTML = `${this.showCloseButton ? `<button class="${this.closeButtonClass ?? "XButton"}" onclick="closeMenu();">${this.closeButtonText}` : ""}</button>
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText">` + this.innerHtml + "</div>";
<span class="menuTitle"${this.titleId ? ` id="${this.titleId}"` : ""}>${this.title ?? "Menu Screen"}</span><br><br><div class="menuText" id="${this.menuTextId}">` + this.innerHtml + "</div>";
this.nodes.forEach(n => inner.querySelector(".menuText").appendChild(n));
parent.appendChild(inner);
document.getElementById(id).appendChild(parent);
}
}
runAfterLoadList.push(inject);
runAfterLoadList.push(inject);