make emoji menu pop up faster
This commit is contained in:
parent
7ed14dbb18
commit
c19e0673f1
4 changed files with 17 additions and 11 deletions
|
@ -87,6 +87,8 @@ class ContextButton<x, y> implements menuPart<x, y> {
|
|||
}
|
||||
|
||||
intext.onclick = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
menu.remove();
|
||||
this.onClick.call(obj1, obj2, e);
|
||||
};
|
||||
|
@ -107,6 +109,9 @@ class Seperator<x, y> implements menuPart<x, y> {
|
|||
}
|
||||
makeContextHTML(obj1: x, obj2: y, menu: HTMLDivElement): void {
|
||||
if (!this.visable || this.visable(obj1, obj2)) {
|
||||
if (menu.children[menu.children.length - 1].tagName === "HR") {
|
||||
return;
|
||||
}
|
||||
menu.append(document.createElement("hr"));
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +160,9 @@ class Contextmenu<x, y> {
|
|||
for (const button of this.buttons) {
|
||||
button.makeContextHTML(addinfo, other, div);
|
||||
}
|
||||
if (div.children[div.children.length - 1].tagName === "HR") {
|
||||
div.children[div.children.length - 1].remove();
|
||||
}
|
||||
//NOTE I don't know if this'll ever actually happen in reality
|
||||
if (div.childNodes.length === 0) return;
|
||||
|
||||
|
|
|
@ -187,14 +187,12 @@ class Emoji {
|
|||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (Contextmenu.currentmenu != "") {
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
document.body.append(menu);
|
||||
Contextmenu.currentmenu = menu;
|
||||
Contextmenu.keepOnScreen(menu);
|
||||
}, 10);
|
||||
if (Contextmenu.currentmenu !== "") {
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
document.body.append(menu);
|
||||
Contextmenu.currentmenu = menu;
|
||||
Contextmenu.keepOnScreen(menu);
|
||||
|
||||
let i = 0;
|
||||
for (const thing of Emoji.emojis) {
|
||||
|
|
|
@ -724,6 +724,8 @@ class Message extends SnowFlake {
|
|||
container.append(reply);
|
||||
buttons.append(container);
|
||||
container.onclick = (e) => {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
Emoji.emojiPicker(e.x, e.y, this.localuser).then((_) => {
|
||||
this.reactionToggle(_);
|
||||
});
|
||||
|
|
|
@ -176,9 +176,7 @@ class User extends SnowFlake {
|
|||
},
|
||||
);
|
||||
|
||||
this.contextmenu.addSeperator((user) => {
|
||||
return user.id !== user.localuser.user.id;
|
||||
});
|
||||
this.contextmenu.addSeperator();
|
||||
|
||||
this.contextmenu.addButton(
|
||||
() => I18n.getTranslation("user.block"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue