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