roles in user menu
This commit is contained in:
parent
d4a8393f69
commit
69de205064
2 changed files with 49 additions and 8 deletions
|
@ -170,7 +170,7 @@ class User {
|
||||||
console.log(_);
|
console.log(_);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.profileclick(html);
|
this.profileclick(html, guild);
|
||||||
User.contextmenu.bind(html, this);
|
User.contextmenu.bind(html, this);
|
||||||
}
|
}
|
||||||
static async resolve(id, localuser) {
|
static async resolve(id, localuser) {
|
||||||
|
@ -201,7 +201,7 @@ class User {
|
||||||
createjankpromises() {
|
createjankpromises() {
|
||||||
new Promise(_ => { });
|
new Promise(_ => { });
|
||||||
}
|
}
|
||||||
async buildprofile(x, y) {
|
async buildprofile(x, y, guild) {
|
||||||
if (Contextmenu.currentmenu != "") {
|
if (Contextmenu.currentmenu != "") {
|
||||||
Contextmenu.currentmenu.remove();
|
Contextmenu.currentmenu.remove();
|
||||||
}
|
}
|
||||||
|
@ -258,6 +258,27 @@ class User {
|
||||||
userbody.appendChild(rule);
|
userbody.appendChild(rule);
|
||||||
const biohtml = this.bio.makeHTML();
|
const biohtml = this.bio.makeHTML();
|
||||||
userbody.appendChild(biohtml);
|
userbody.appendChild(biohtml);
|
||||||
|
{
|
||||||
|
Member.resolveMember(this, guild).then(member => {
|
||||||
|
if (!member)
|
||||||
|
return;
|
||||||
|
const roles = document.createElement("div");
|
||||||
|
roles.classList.add("rolesbox");
|
||||||
|
for (const role of member.roles) {
|
||||||
|
const div = document.createElement("div");
|
||||||
|
div.classList.add("rolediv");
|
||||||
|
const color = document.createElement("div");
|
||||||
|
div.append(color);
|
||||||
|
color.style.setProperty("--role-color", "#" + role.color.toString(16).padStart(6, "0"));
|
||||||
|
color.classList.add("colorrolediv");
|
||||||
|
const span = document.createElement("span");
|
||||||
|
div.append(span);
|
||||||
|
span.textContent = role.name;
|
||||||
|
roles.append(div);
|
||||||
|
}
|
||||||
|
userbody.append(roles);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log(div);
|
console.log(div);
|
||||||
if (x !== -1) {
|
if (x !== -1) {
|
||||||
|
@ -267,9 +288,9 @@ class User {
|
||||||
}
|
}
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
profileclick(obj) {
|
profileclick(obj, guild) {
|
||||||
obj.onclick = e => {
|
obj.onclick = e => {
|
||||||
this.buildprofile(e.clientX, e.clientY);
|
this.buildprofile(e.clientX, e.clientY, guild);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ class User{
|
||||||
console.log(_)
|
console.log(_)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.profileclick(html);
|
this.profileclick(html,guild);
|
||||||
User.contextmenu.bind(html,this);
|
User.contextmenu.bind(html,this);
|
||||||
}
|
}
|
||||||
static async resolve(id:string,localuser:Localuser){
|
static async resolve(id:string,localuser:Localuser){
|
||||||
|
@ -202,7 +202,7 @@ class User{
|
||||||
createjankpromises(){
|
createjankpromises(){
|
||||||
new Promise(_=>{})
|
new Promise(_=>{})
|
||||||
}
|
}
|
||||||
async buildprofile(x:number,y:number){
|
async buildprofile(x:number,y:number,guild:Guild){
|
||||||
if(Contextmenu.currentmenu!=""){
|
if(Contextmenu.currentmenu!=""){
|
||||||
Contextmenu.currentmenu.remove();
|
Contextmenu.currentmenu.remove();
|
||||||
}
|
}
|
||||||
|
@ -263,6 +263,26 @@ class User{
|
||||||
userbody.appendChild(rule);
|
userbody.appendChild(rule);
|
||||||
const biohtml=this.bio.makeHTML();
|
const biohtml=this.bio.makeHTML();
|
||||||
userbody.appendChild(biohtml);
|
userbody.appendChild(biohtml);
|
||||||
|
{
|
||||||
|
Member.resolveMember(this,guild).then(member=>{
|
||||||
|
if(!member) return;
|
||||||
|
const roles=document.createElement("div");
|
||||||
|
roles.classList.add("rolesbox");
|
||||||
|
for(const role of member.roles){
|
||||||
|
const div=document.createElement("div");
|
||||||
|
div.classList.add("rolediv");
|
||||||
|
const color=document.createElement("div");
|
||||||
|
div.append(color);
|
||||||
|
color.style.setProperty("--role-color","#"+role.color.toString(16).padStart(6,"0"))
|
||||||
|
color.classList.add("colorrolediv");
|
||||||
|
const span=document.createElement("span");
|
||||||
|
div.append(span);
|
||||||
|
span.textContent=role.name;
|
||||||
|
roles.append(div);
|
||||||
|
}
|
||||||
|
userbody.append(roles);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log(div);
|
console.log(div);
|
||||||
|
|
||||||
|
@ -273,9 +293,9 @@ class User{
|
||||||
}
|
}
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
profileclick(obj:HTMLElement){
|
profileclick(obj:HTMLElement,guild:Guild){
|
||||||
obj.onclick=e=>{
|
obj.onclick=e=>{
|
||||||
this.buildprofile(e.clientX,e.clientY);
|
this.buildprofile(e.clientX,e.clientY,guild);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue