Started work on userlist profile tooltips and context menus.
This commit is contained in:
parent
9df7f52e9e
commit
9a8def18d7
16 changed files with 372 additions and 22 deletions
|
|
@ -140,6 +140,10 @@ class chatBox{
|
|||
this.displayAutocomplete();
|
||||
}
|
||||
|
||||
tokeWith(user){
|
||||
this.commandPreprocessor.preprocess(user == this.client.user.user ? "!toke up fuckers" : `!toke up ${user}`);
|
||||
}
|
||||
|
||||
send(event){
|
||||
if((!event || !event.key || event.key == "Enter") && this.chatPrompt.value){
|
||||
this.commandPreprocessor.preprocess(this.chatPrompt.value);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ class userList{
|
|||
var highLevel = document.createElement('p');
|
||||
highLevel.classList.add("user-list-high-level","high-level");
|
||||
highLevel.innerHTML = `${user.highLevel}`;
|
||||
userSpan.appendChild(highLevel);
|
||||
|
||||
//Create nameplate
|
||||
var userEntry = document.createElement('p');
|
||||
|
|
@ -115,10 +114,30 @@ class userList{
|
|||
//Add classes to classList
|
||||
userEntry.classList.add("chat-panel-users","user-entry",flair);
|
||||
|
||||
//Add high-level username to nameplate
|
||||
userSpan.appendChild(highLevel);
|
||||
userSpan.appendChild(userEntry);
|
||||
|
||||
//Setup profile tooltip
|
||||
userSpan.addEventListener('mouseenter',(event)=>{utils.ux.displayTooltip(event, `profile?user=${user.user}`, true, null, true);});
|
||||
|
||||
//Setup profile context menu
|
||||
userSpan.addEventListener('click', renderContextMenu.bind(this));
|
||||
userSpan.addEventListener('contextmenu', renderContextMenu.bind(this));
|
||||
|
||||
this.userList.appendChild(userSpan);
|
||||
|
||||
function renderContextMenu(event){
|
||||
//Setup menu map
|
||||
let menuMap = new Map([
|
||||
["Profile", ()=>{this.client.cPanel.setActivePanel(new panelObj(client, `${user.user}`, `/panel/profile?user=${user.user}`))}],
|
||||
["Mention", ()=>{client.chatBox.catChat(`${user.user} `)}],
|
||||
["Toke With", ()=>{client.chatBox.tokeWith(user.user)}],
|
||||
]);
|
||||
|
||||
//Display the menu
|
||||
utils.ux.displayContextMenu(event, user.user, menuMap);
|
||||
}
|
||||
}
|
||||
|
||||
toggleUI(show = !this.userDiv.checkVisibility()){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue