Merge branch 'v0.1.0' of https://github.com/Pax1601/DCSOlympus into v0.1.0

This commit is contained in:
dpassoni
2023-03-07 14:21:12 +01:00
6 changed files with 172 additions and 46 deletions

View File

@@ -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 => {