mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Some styling to the unit control panel and changeable unit name.
This commit is contained in:
@@ -101,6 +101,31 @@ function setup() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
const unitName = document.getElementById( "unit-name" );
|
||||
|
||||
if ( unitName instanceof HTMLInputElement ) {
|
||||
|
||||
unitName.addEventListener( "change", ev => {
|
||||
unitName.setAttribute( "disabled", "true" );
|
||||
unitName.setAttribute( "readonly", "true" );
|
||||
|
||||
// Do something with this:
|
||||
console.log( unitName.value );
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener( "editUnitName", ev => {
|
||||
|
||||
unitName.removeAttribute( "disabled" );
|
||||
unitName.removeAttribute( "readonly" );
|
||||
unitName.focus();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.addEventListener( "toggleCoalitionVisibility", ( ev:CustomEventInit ) => {
|
||||
document.body.toggleAttribute( "data-hide-" + ev.detail.coalition );
|
||||
|
||||
@@ -25,15 +25,15 @@ export class UnitControlPanel extends Panel {
|
||||
/* Option buttons */
|
||||
this.#optionButtons["ROE"] = ROEs.map((option: string) => {
|
||||
var button = document.createElement("button");
|
||||
button.innerText = option;
|
||||
button.addEventListener("click", () => getUnitsManager().selectedUnitsSetROE(button.value));
|
||||
button.title = option;
|
||||
button.addEventListener("click", () => getUnitsManager().selectedUnitsSetROE(button.title));
|
||||
return button;
|
||||
})
|
||||
|
||||
this.#optionButtons["reactionToThreat"] = reactionsToThreat.map((option: string) => {
|
||||
var button = document.createElement("button");
|
||||
button.innerText = option;
|
||||
button.addEventListener("click", () => getUnitsManager().selectedUnitsSetROE(button.value));
|
||||
button.title = option;
|
||||
button.addEventListener("click", () => getUnitsManager().selectedUnitsSetROE(button.title));
|
||||
return button;
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user