21 lines
958 B
TypeScript
21 lines
958 B
TypeScript
import Q from '../q-module.js';
|
|
import UI from '../ui.js';
|
|
import createServerTitleContextMenu from './context-menu-server-title.js';
|
|
import ElementsUtil from './require/elements-util.js';
|
|
|
|
export default function bindAddServerTitleEvents(document: Document, q: Q, ui: UI) {
|
|
q.$('#server-name-container').addEventListener('click', () => {
|
|
if (ui.activeConnection === null) return;
|
|
if (ui.activeServer === null) return;
|
|
if (!ui.activeServer.isVerified) return;
|
|
if (
|
|
!ui.activeConnection.privileges.includes('modify_profile') &&
|
|
!ui.activeConnection.privileges.includes('modify_members')
|
|
) return;
|
|
|
|
let contextMenu = createServerTitleContextMenu(document, q, ui, ui.activeServer);
|
|
document.body.appendChild(contextMenu);
|
|
ElementsUtil.alignContextElement(contextMenu, q.$('#server-name-container'), { top: 'bottom', centerX: 'centerX' });
|
|
});
|
|
}
|