mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added visibility switches that 'should' work - at least for aircraft.
This commit is contained in:
@@ -62,14 +62,37 @@ function setup() {
|
||||
document.addEventListener( "click", ( ev ) => {
|
||||
|
||||
if ( ev instanceof PointerEvent && ev.target instanceof HTMLElement ) {
|
||||
if ( ev.target.classList.contains( "olympus-dialog-close" ) ) {
|
||||
ev.target.closest( "div.olympus-dialog" )?.classList.add( "hide" );
|
||||
|
||||
const target = ev.target;
|
||||
|
||||
if ( target.classList.contains( "olympus-dialog-close" ) ) {
|
||||
target.closest( "div.olympus-dialog" )?.classList.add( "hide" );
|
||||
}
|
||||
|
||||
if ( target.dataset.hasOwnProperty( "onClick" ) ) {
|
||||
const eventName:string = target.dataset.onClick || "";
|
||||
const params:string = target.dataset.onClickParams || "{}";
|
||||
|
||||
if ( eventName ) {
|
||||
document.dispatchEvent( new CustomEvent( eventName, {
|
||||
detail: JSON.parse( params )
|
||||
} ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener( "toggleVisibility", ( ev:CustomEventInit ) => {
|
||||
|
||||
document.body.toggleAttribute( "data-hide-" + ev.detail.unitType )
|
||||
|
||||
});
|
||||
|
||||
|
||||
/** Olympus UI ***/
|
||||
document.querySelectorAll( ".ol-select" ).forEach( select => {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user