mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
More svg injection, removing stringed html from code
This commit is contained in:
@@ -5,8 +5,7 @@ import { ContextMenu } from "./contextmenu";
|
||||
export class AirbaseContextMenu extends ContextMenu {
|
||||
#airbase: Airbase | null = null;
|
||||
|
||||
constructor(id: string)
|
||||
{
|
||||
constructor(id: string) {
|
||||
super(id);
|
||||
document.addEventListener("contextMenuSpawnAirbase", (e: any) => {
|
||||
this.showSpawnMenu();
|
||||
@@ -19,8 +18,7 @@ export class AirbaseContextMenu extends ContextMenu {
|
||||
})
|
||||
}
|
||||
|
||||
setAirbase(airbase: Airbase)
|
||||
{
|
||||
setAirbase(airbase: Airbase) {
|
||||
this.#airbase = airbase;
|
||||
this.setName(airbase.getName());
|
||||
this.setProperties(airbase.getProperties());
|
||||
@@ -29,24 +27,21 @@ export class AirbaseContextMenu extends ContextMenu {
|
||||
this.enableLandButton(getUnitsManager().getSelectedUnitsType() === "Aircraft" && (getUnitsManager().getSelectedUnitsCoalition() === airbase.getCoalition() || airbase.getCoalition() === "neutral"))
|
||||
}
|
||||
|
||||
setName(airbaseName: string)
|
||||
{
|
||||
setName(airbaseName: string) {
|
||||
var nameDiv = <HTMLElement>this.getContainer()?.querySelector("#airbase-name");
|
||||
if (nameDiv != null)
|
||||
nameDiv.innerText = airbaseName;
|
||||
nameDiv.innerText = airbaseName;
|
||||
}
|
||||
|
||||
setProperties(airbaseProperties: string[])
|
||||
{
|
||||
setProperties(airbaseProperties: string[]) {
|
||||
this.getContainer()?.querySelector("#airbase-properties")?.replaceChildren(...airbaseProperties.map((property: string) => {
|
||||
var div = document.createElement("div");
|
||||
div.innerText = property;
|
||||
return div;
|
||||
}), );
|
||||
}),);
|
||||
}
|
||||
|
||||
setParkings(airbaseParkings: string[])
|
||||
{
|
||||
setParkings(airbaseParkings: string[]) {
|
||||
this.getContainer()?.querySelector("#airbase-parking")?.replaceChildren(...airbaseParkings.map((parking: string) => {
|
||||
var div = document.createElement("div");
|
||||
div.innerText = parking;
|
||||
@@ -54,22 +49,18 @@ export class AirbaseContextMenu extends ContextMenu {
|
||||
}));
|
||||
}
|
||||
|
||||
setCoalition(coalition: string)
|
||||
{
|
||||
setCoalition(coalition: string) {
|
||||
(<HTMLElement>this.getContainer()?.querySelector("#spawn-airbase-aircraft-button")).dataset.activeCoalition = coalition;
|
||||
}
|
||||
|
||||
enableLandButton(enableLandButton: boolean)
|
||||
{
|
||||
enableLandButton(enableLandButton: boolean) {
|
||||
this.getContainer()?.querySelector("#land-here-button")?.classList.toggle("hide", !enableLandButton);
|
||||
}
|
||||
|
||||
showSpawnMenu()
|
||||
{
|
||||
if (this.#airbase != null)
|
||||
{
|
||||
showSpawnMenu() {
|
||||
if (this.#airbase != null) {
|
||||
setActiveCoalition(this.#airbase.getCoalition());
|
||||
getMap().showMapContextMenu({originalEvent: {x: this.getX(), y: this.getY(), latlng: this.getLatLng()}});
|
||||
getMap().showMapContextMenu({ originalEvent: { x: this.getX(), y: this.getY(), latlng: this.getLatLng() } });
|
||||
getMap().getMapContextMenu().hideUpperBar();
|
||||
getMap().getMapContextMenu().showSubMenu("aircraft");
|
||||
getMap().getMapContextMenu().setAirbaseName(this.#airbase.getName());
|
||||
|
||||
Reference in New Issue
Block a user