cordis/client/webapp/elements/events-connection.ts

17 lines
700 B
TypeScript
Raw Normal View History

2021-10-30 17:26:41 +00:00
import ElementsUtil from './require/elements-util.js';
import Q from '../q-module.js';
import UI from '../ui.js';
2021-11-07 21:57:09 +00:00
import createConnectionContextMenu from './context-menu-conn';
2021-10-30 17:26:41 +00:00
export default function bindConnectionEvents(document: Document, q: Q, ui: UI): void {
q.$('#connection').addEventListener('click', () => {
if (ui.activeServer === null) return;
if (!ui.activeServer.isVerified) return;
2021-10-30 17:26:41 +00:00
let contextMenu = createConnectionContextMenu(document, q, ui, ui.activeServer);
2021-10-30 17:26:41 +00:00
document.body.appendChild(contextMenu);
ElementsUtil.alignContextElement(contextMenu, q.$('#connection'), { bottom: 'top', centerX: 'centerX' });
2021-10-30 17:26:41 +00:00
});
}