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

Method createNetplayMenu

data/src/emulator.js:5129–5256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5127 return [popup, popupMsg];
5128 }
5129 createNetplayMenu() {
5130 const body = this.createPopup("Netplay", {
5131 "Create a Room": () => {
5132 if (this.isNetplay) {
5133 this.netplay.leaveRoom();
5134 } else {
5135 this.netplay.showOpenRoomDialog();
5136 }
5137 },
5138 "Close": () => {
5139 this.netplayMenu.style.display = "none";
5140 this.netplay.updateList.stop();
5141 }
5142 }, true);
5143 this.netplayMenu = body.parentElement;
5144 const createButton = this.netplayMenu.getElementsByTagName("a")[0];
5145 const rooms = this.createElement("div");
5146 const title = this.createElement("strong");
5147 title.innerText = this.localization("Rooms");
5148 const table = this.createElement("table");
5149 table.classList.add("ejs_netplay_table");
5150 table.style.width = "100%";
5151 table.setAttribute("cellspacing", "0");
5152 const thead = this.createElement("thead");
5153 const row = this.createElement("tr");
5154 const addToHeader = (text) => {
5155 const item = this.createElement("td");
5156 item.innerText = text;
5157 item.style["text-align"] = "center";
5158 row.appendChild(item);
5159 return item;
5160 }
5161 thead.appendChild(row);
5162 addToHeader("Room Name").style["text-align"] = "left";
5163 addToHeader("Players").style.width = "80px";
5164 addToHeader("").style.width = "80px"; //"join" button
5165 table.appendChild(thead);
5166 const tbody = this.createElement("tbody");
5167
5168 table.appendChild(tbody);
5169 rooms.appendChild(title);
5170 rooms.appendChild(table);
5171
5172 const joined = this.createElement("div");
5173 const title2 = this.createElement("strong");
5174 title2.innerText = "{roomname}";
5175 const password = this.createElement("div");
5176 password.innerText = "Password: ";
5177 const table2 = this.createElement("table");
5178 table2.classList.add("ejs_netplay_table");
5179 table2.style.width = "100%";
5180 table2.setAttribute("cellspacing", "0");
5181 const thead2 = this.createElement("thead");
5182 const row2 = this.createElement("tr");
5183 const addToHeader2 = (text) => {
5184 const item = this.createElement("td");
5185 item.innerText = text;
5186 row2.appendChild(item);

Callers 1

bindListenersMethod · 0.95

Calls 7

createPopupMethod · 0.95
createElementMethod · 0.95
localizationMethod · 0.95
createSubPopupMethod · 0.95
addEventListenerMethod · 0.95
removeMethod · 0.45

Tested by

no test coverage detected