From e028d0add0d698061086d813657d72d869366eca Mon Sep 17 00:00:00 2001 From: GGod <46885632+GGodPL@users.noreply.github.com> Date: Fri, 5 Jan 2024 00:37:02 +0100 Subject: [PATCH] add titleId to betterMenuScreens.js --- mods/betterMenuScreens.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/betterMenuScreens.js b/mods/betterMenuScreens.js index 1c0509f1..355ff770 100644 --- a/mods/betterMenuScreens.js +++ b/mods/betterMenuScreens.js @@ -106,7 +106,7 @@ const inject = () => { /** * - * @param {string} menu Menu do be opened + * @param {string} menu Menu to be opened * @param {boolean} [closeCurrent] Whether it should forcefully close the current screen */ const openMenu = (menu, closeCurrent = false) => { @@ -130,6 +130,7 @@ class MenuScreen { this.showCloseButton = true; this.closeButtonText = "-"; this.closeButtonClass = "XButton"; + this.titleId = null; } /** @@ -141,6 +142,15 @@ class MenuScreen { return this; } + /** + * Sets screen title ID + * @param {string} [id] Screen title. "New Menu Screen" by default + */ + setTitleId(id) { + this.titleId = id; + return this; + } + /** * Sets close button visibility. When false the close button will not be added to the menu screen * @param {boolean} show Visibility of the close button @@ -253,7 +263,7 @@ class MenuScreen { const inner = document.createElement("div"); inner.className = this.innerDivClass ?? "menuScreen"; inner.innerHTML = `${this.showCloseButton ? ` - ${this.title ?? "Menu Screen"}

"; + ${this.title ?? "Menu Screen"}

"; this.nodes.forEach(n => inner.querySelector(".menuText").appendChild(n)); parent.appendChild(inner); document.getElementById(id).appendChild(parent);