mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Minor bug fixing, added patcher for Export.lua, added plugin options to enable/disable mod
This commit is contained in:
@@ -20,10 +20,10 @@ export class Dropdown {
|
||||
open() {
|
||||
if (this.#container != null) {
|
||||
this.#open = true;
|
||||
this.#container.classList.add("olympus-dropdown-open");
|
||||
this.#container.classList.remove("olympus-dropdown-closed");
|
||||
this.#container.classList.add("ol-dropdown-open");
|
||||
this.#container.classList.remove("ol-dropdown-closed");
|
||||
this.#content = document.createElement("div");
|
||||
this.#content.classList.add("olympus-dropdown-content");
|
||||
this.#content.classList.add("ol-dropdown-content");
|
||||
this.#content.style.width = (this.#container.offsetWidth - this.#container.offsetHeight) + "px";
|
||||
|
||||
this.#content.style.left = this.#container.offsetLeft + "px";
|
||||
@@ -34,7 +34,7 @@ export class Dropdown {
|
||||
var height = 2;
|
||||
for (let optionID in this.#options) {
|
||||
var node = document.createElement("div");
|
||||
node.classList.add("olympus-dropdown-element");
|
||||
node.classList.add("ol-dropdown-element");
|
||||
node.appendChild(document.createTextNode(this.#options[optionID]));
|
||||
this.#content.appendChild(node);
|
||||
height += node.offsetHeight + 2;
|
||||
@@ -53,8 +53,8 @@ export class Dropdown {
|
||||
close() {
|
||||
if (this.#container != null) {
|
||||
this.#open = false;
|
||||
this.#container?.classList.remove("olympus-dropdown-open");
|
||||
this.#container?.classList.add("olympus-dropdown-closed");
|
||||
this.#container?.classList.remove("ol-dropdown-open");
|
||||
this.#container?.classList.add("ol-dropdown-closed");
|
||||
if (this.#content != null)
|
||||
document.body.removeChild(this.#content);
|
||||
}
|
||||
|
||||
@@ -20,18 +20,17 @@ export class SelectionScroll {
|
||||
this.hide();
|
||||
|
||||
if (this.#container != null && options.length >= 1) {
|
||||
var titleDiv = this.#container.querySelector("#olympus-selection-scroll-top-bar")?.querySelector(".olympus-selection-scroll-title");
|
||||
var titleDiv = this.#container.querySelector("#ol-selection-scroll-top-bar")?.querySelector(".ol-selection-scroll-title");
|
||||
if (titleDiv)
|
||||
titleDiv.innerHTML = title;
|
||||
this.#container.style.display = this.#display;
|
||||
this.#container.style.left = x - this.#container.offsetWidth / 2 + "px";
|
||||
this.#container.style.top = y - 20 + "px";
|
||||
var scroll = this.#container.querySelector(".olympus-selection-scroll");
|
||||
|
||||
var scroll = this.#container.querySelector(".ol-selection-scroll");
|
||||
if (scroll != null)
|
||||
{
|
||||
for (let optionID in options) {
|
||||
var node = document.createElement("div");
|
||||
node.classList.add("olympus-selection-scroll-element");
|
||||
node.classList.add("ol-selection-scroll-element");
|
||||
if (typeof options[optionID] === 'string' || options[optionID] instanceof String){
|
||||
node.appendChild(document.createTextNode(options[optionID]));
|
||||
node.addEventListener('click', () => callback(options[optionID]));
|
||||
@@ -45,7 +44,7 @@ export class SelectionScroll {
|
||||
}
|
||||
|
||||
/* Hide the coalition switch if required */
|
||||
var switchContainer = <HTMLElement>this.#container.querySelector("#olympus-selection-scroll-top-bar")?.querySelector("#coalition-switch-container");
|
||||
var switchContainer = <HTMLElement>this.#container.querySelector("#ol-selection-scroll-top-bar")?.querySelector("#coalition-switch-container");
|
||||
if (showCoalition == false) {
|
||||
switchContainer.style.display = "none";
|
||||
document.documentElement.style.setProperty('--active-coalition-color', getComputedStyle(this.#container).getPropertyValue("--neutral-coalition-color"));
|
||||
@@ -57,14 +56,26 @@ export class SelectionScroll {
|
||||
else
|
||||
document.documentElement.style.setProperty('--active-coalition-color', getComputedStyle(this.#container).getPropertyValue("--red-coalition-color"));
|
||||
}
|
||||
|
||||
if (x - this.#container.offsetWidth / 2 + this.#container.offsetWidth < window.innerWidth)
|
||||
this.#container.style.left = x - this.#container.offsetWidth / 2 + "px";
|
||||
else
|
||||
this.#container.style.left = window.innerWidth - this.#container.offsetWidth + "px";
|
||||
|
||||
console.log(y - 20 + this.#container.offsetHeight)
|
||||
if (y - 20 + this.#container.offsetHeight < window.innerHeight)
|
||||
this.#container.style.top = y - 20 + "px";
|
||||
else
|
||||
this.#container.style.top = window.innerHeight - this.#container.offsetHeight + "px";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (this.#container != null) {
|
||||
this.#container.style.display = "none";
|
||||
var buttons = this.#container.querySelectorAll(".olympus-selection-scroll-element");
|
||||
var scroll = this.#container.querySelector(".olympus-selection-scroll");
|
||||
var buttons = this.#container.querySelectorAll(".ol-selection-scroll-element");
|
||||
var scroll = this.#container.querySelector(".ol-selection-scroll");
|
||||
if (scroll != null)
|
||||
{
|
||||
for (let child of buttons) {
|
||||
|
||||
Reference in New Issue
Block a user