MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / createPopup

Method createPopup

data/src/emulator.js:1645–1681  ·  view source on GitHub ↗
(popupTitle, buttons, hidden)

Source from the content-addressed store, hash-verified

1643 }
1644 //creates a full box popup.
1645 createPopup(popupTitle, buttons, hidden) {
1646 if (!hidden) this.closePopup();
1647 const popup = this.createElement("div");
1648 popup.classList.add("ejs_popup_container");
1649 this.elements.parent.appendChild(popup);
1650 const title = this.createElement("h4");
1651 title.innerText = this.localization(popupTitle);
1652 const main = this.createElement("div");
1653 main.classList.add("ejs_popup_body");
1654
1655 popup.appendChild(title);
1656 popup.appendChild(main);
1657
1658 const padding = this.createElement("div");
1659 padding.style["padding-top"] = "10px";
1660 popup.appendChild(padding);
1661
1662 for (let k in buttons) {
1663 const button = this.createElement("a");
1664 if (buttons[k] instanceof Function) {
1665 button.addEventListener("click", (e) => {
1666 buttons[k]();
1667 e.preventDefault();
1668 });
1669 }
1670 button.classList.add("ejs_button");
1671 button.innerText = this.localization(k);
1672 popup.appendChild(button);
1673 }
1674 if (!hidden) {
1675 this.currentPopup = popup;
1676 } else {
1677 popup.style.display = "none";
1678 }
1679
1680 return main;
1681 }
1682 selectFile() {
1683 return new Promise((resolve, reject) => {
1684 const file = this.createElement("input");

Callers 8

checkStartedMethod · 0.95
bindListenersMethod · 0.95
createContextMenuMethod · 0.95
createBottomMenuBarMethod · 0.95
openCacheMenuMethod · 0.95
createNetplayMenuMethod · 0.95
createCheatsMenuMethod · 0.95

Calls 4

closePopupMethod · 0.95
createElementMethod · 0.95
localizationMethod · 0.95
addEventListenerMethod · 0.80

Tested by

no test coverage detected