()
| 4341 | this.saveSettings(); |
| 4342 | } |
| 4343 | setupDisksMenu() { |
| 4344 | this.disksMenu = this.createElement("div"); |
| 4345 | this.disksMenu.classList.add("ejs_settings_parent"); |
| 4346 | const nested = this.createElement("div"); |
| 4347 | nested.classList.add("ejs_settings_transition"); |
| 4348 | this.disks = {}; |
| 4349 | |
| 4350 | const home = this.createElement("div"); |
| 4351 | home.style.overflow = "auto"; |
| 4352 | const menus = []; |
| 4353 | this.handleDisksResize = () => { |
| 4354 | let needChange = false; |
| 4355 | if (this.disksMenu.style.display !== "") { |
| 4356 | this.disksMenu.style.opacity = "0"; |
| 4357 | this.disksMenu.style.display = ""; |
| 4358 | needChange = true; |
| 4359 | } |
| 4360 | let height = this.elements.parent.getBoundingClientRect().height; |
| 4361 | let w2 = this.diskParent.parentElement.getBoundingClientRect().width; |
| 4362 | let disksX = this.diskParent.getBoundingClientRect().x; |
| 4363 | if (w2 > window.innerWidth) disksX += (w2 - window.innerWidth); |
| 4364 | const onTheRight = disksX > (w2 - 15) / 2; |
| 4365 | if (height > 375) height = 375; |
| 4366 | home.style["max-height"] = (height - 95) + "px"; |
| 4367 | nested.style["max-height"] = (height - 95) + "px"; |
| 4368 | for (let i = 0; i < menus.length; i++) { |
| 4369 | menus[i].style["max-height"] = (height - 95) + "px"; |
| 4370 | } |
| 4371 | this.disksMenu.classList.toggle("ejs_settings_center_left", !onTheRight); |
| 4372 | this.disksMenu.classList.toggle("ejs_settings_center_right", onTheRight); |
| 4373 | if (needChange) { |
| 4374 | this.disksMenu.style.display = "none"; |
| 4375 | this.disksMenu.style.opacity = ""; |
| 4376 | } |
| 4377 | } |
| 4378 | |
| 4379 | home.classList.add("ejs_setting_menu"); |
| 4380 | nested.appendChild(home); |
| 4381 | let funcs = []; |
| 4382 | this.changeDiskOption = (title, newValue) => { |
| 4383 | this.disks[title] = newValue; |
| 4384 | funcs.forEach(e => e(title)); |
| 4385 | } |
| 4386 | let allOpts = {}; |
| 4387 | |
| 4388 | // TODO - Why is this duplicated? |
| 4389 | const addToMenu = (title, id, options, defaultOption) => { |
| 4390 | const span = this.createElement("span"); |
| 4391 | span.innerText = title; |
| 4392 | |
| 4393 | const current = this.createElement("div"); |
| 4394 | current.innerText = ""; |
| 4395 | current.classList.add("ejs_settings_main_bar_selected"); |
| 4396 | span.appendChild(current); |
| 4397 | |
| 4398 | const menu = this.createElement("div"); |
| 4399 | menus.push(menu); |
| 4400 | menu.setAttribute("hidden", ""); |
no test coverage detected