mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Add ability to switch between menus
This commit is contained in:
parent
0c6e5fe5c8
commit
606bc844e3
1 changed files with 22 additions and 8 deletions
|
@ -1439,14 +1439,15 @@ class EmulatorJS {
|
||||||
this.settingsMenu.style.display = "none";
|
this.settingsMenu.style.display = "none";
|
||||||
this.settingsMenu.classList.add("ejs_settings_parent");
|
this.settingsMenu.classList.add("ejs_settings_parent");
|
||||||
const nested = this.createElement("div");
|
const nested = this.createElement("div");
|
||||||
|
this.settings = {};
|
||||||
|
|
||||||
//const home = this.createElement("div");
|
const home = this.createElement("div");
|
||||||
//home.classList.add("ejs_setting_home");
|
home.classList.add("ejs_setting_home");
|
||||||
//home.classList.add("ejs_setting_menu");
|
home.classList.add("ejs_setting_menu");
|
||||||
//nested.appendChild(home);
|
nested.appendChild(home);
|
||||||
|
|
||||||
const addToMenu = (title, options) => {
|
const addToMenu = (title, options) => {
|
||||||
/*
|
|
||||||
const menuOption = this.createElement("div");
|
const menuOption = this.createElement("div");
|
||||||
menuOption.classList.add("ejs_settings_main_bar");
|
menuOption.classList.add("ejs_settings_main_bar");
|
||||||
const span = this.createElement("span");
|
const span = this.createElement("span");
|
||||||
|
@ -1459,9 +1460,21 @@ class EmulatorJS {
|
||||||
|
|
||||||
menuOption.appendChild(span);
|
menuOption.appendChild(span);
|
||||||
home.appendChild(menuOption);
|
home.appendChild(menuOption);
|
||||||
*/
|
|
||||||
|
|
||||||
const menu = this.createElement("div");
|
const menu = this.createElement("div");
|
||||||
|
menu.setAttribute("hidden", "");
|
||||||
const button = this.createElement("button");
|
const button = this.createElement("button");
|
||||||
|
|
||||||
|
this.addEventListener(menuOption, "click", (e) => {
|
||||||
|
menu.removeAttribute("hidden", "");
|
||||||
|
home.setAttribute("hidden", "");
|
||||||
|
})
|
||||||
|
this.addEventListener(button, "click", (e) => {
|
||||||
|
menu.setAttribute("hidden", "");
|
||||||
|
home.removeAttribute("hidden", "");
|
||||||
|
})
|
||||||
|
|
||||||
button.type = "button";
|
button.type = "button";
|
||||||
button.classList.add("ejs_back_button");
|
button.classList.add("ejs_back_button");
|
||||||
menu.appendChild(button);
|
menu.appendChild(button);
|
||||||
|
@ -1482,6 +1495,7 @@ class EmulatorJS {
|
||||||
optionButton.classList.add("ejs_option_row");
|
optionButton.classList.add("ejs_option_row");
|
||||||
optionButton.classList.add("ejs_button_style");
|
optionButton.classList.add("ejs_button_style");
|
||||||
|
|
||||||
|
|
||||||
const msg = this.createElement("span");
|
const msg = this.createElement("span");
|
||||||
msg.innerText = options[i];
|
msg.innerText = options[i];
|
||||||
optionButton.appendChild(msg);
|
optionButton.appendChild(msg);
|
||||||
|
@ -1496,8 +1510,8 @@ class EmulatorJS {
|
||||||
}
|
}
|
||||||
|
|
||||||
addToMenu("Test", [1, 2, 3]);
|
addToMenu("Test", [1, 2, 3]);
|
||||||
//addToMenu("Test2", [4, 5, 6]);
|
addToMenu("Test2", [4, 5, 6]);
|
||||||
//addToMenu("Testertthgfd", [7, 8, 9]);
|
addToMenu("Testertthgfd", [7, 8, 9]);
|
||||||
|
|
||||||
this.settingsMenu.appendChild(nested);
|
this.settingsMenu.appendChild(nested);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue