This commit is contained in:
Mirco Wittrien 2019-08-06 13:12:31 +02:00
parent 12f0382339
commit 2746c1651a
2 changed files with 13 additions and 31 deletions

View File

@ -3,7 +3,7 @@
class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.4.8";}
getVersion () {return "3.4.9";}
getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class EditUsers {
initConstructor () {
this.changelog = {
"fixed":[["Typing","Fixed the issue where changes would disappear when a user is typing"],["New Structure","Fixed issues that will occur once the avatar/name changes from canary will hit stable/ptb"]]
"fixed":[["TRE issue","Fixed"]]
};
this.labels = {};
@ -887,7 +887,7 @@ class EditUsers {
}
changeBotTags (data, username, member) {
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) {
for (let tag of username.parentElement.parentElement.querySelectorAll(BDFDB.dotCN.bottag)) if (!BDFDB.containsClass(tag, "TRE-tag")) {
let isBRCenabled = BDFDB.isPluginEnabled("BetterRoleColors");
let invert = tag.className.indexOf(BDFDB.disCN.bottaginvert) > -1;
let tagcolor = BDFDB.colorCONVERT(data.color1 || (isBRCenabled || BDFDB.containsClass(tag, "owner-tag-rolecolor") ? member.colorString : null), "RGB");

View File

@ -3,7 +3,7 @@
class TopRoleEverywhere {
getName () {return "TopRoleEverywhere";}
getVersion () {return "2.8.3";}
getVersion () {return "2.8.4";}
getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class TopRoleEverywhere {
initConstructor () {
this.changelog = {
"fixed":[["Overflow","Long role names now properly overflow with overflow ellipsis"]]
"fixed":[["Classes & Positioning","Fixes some display issues"]]
};
this.patchModules = {
@ -21,36 +21,15 @@ class TopRoleEverywhere {
};
this.css = `
.TRE-tag {
border-radius: 3px;
box-sizing: border-box;
display: inline-block;
flex-shrink: 0;
font-size: 10px;
font-weight: 500;
height: 15px;
line-height: 12px;
margin-left: 6px;
padding: 1px 2px;
position: relative;
text-indent: 0px !important;
vertical-align: top;
white-space: nowrap;
}
.TRE-tag .role-inner {
overflow: hidden;
text-overflow: ellipsis;
text-transform: uppercase;
}
${BDFDB.dotCN.messagegroup} .TRE-tag {
bottom: 2px;
}
.BE-badges + .TRE-tag {
margin-left: 0;
}`;
this.tagMarkup = `<div class="TRE-tag"><div class="role-inner"></div></div>`;
this.defaults = {
settings: {
showInChat: {value:true, description:"Show Tag in Chat Window."},
@ -144,7 +123,7 @@ class TopRoleEverywhere {
processChannelMember (instance, wrapper) {
if (instance.props && BDFDB.getData("showInMemberList", this, "settings")) {
this.addRoleTag(instance.props.user, wrapper.querySelector(BDFDB.dotCN.memberusername), "list");
this.addRoleTag(instance.props.user, wrapper.querySelector(BDFDB.dotCN.memberusername), "list", BDFDB.disCN.bottagnametag);
}
}
@ -152,7 +131,10 @@ class TopRoleEverywhere {
let message = BDFDB.getReactValue(instance, "props.message");
if (message) {
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
if (username && BDFDB.getData("showInChat", this, "settings")) this.addRoleTag(message.author, username, "chat");
if (username && BDFDB.getData("showInChat", this, "settings")) {
let messagegroup = BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper);
this.addRoleTag(message.author, username, "chat", BDFDB.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact);
}
}
}
@ -164,7 +146,7 @@ class TopRoleEverywhere {
}
}
addRoleTag (info, username, type) {
addRoleTag (info, username, type, selector) {
if (!info || !username) return;
BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
let guild = this.GuildStore.getGuild(this.UserGuildState.getGuildId());
@ -176,7 +158,7 @@ class TopRoleEverywhere {
let roleName = role ? role.name : "";
let oldwidth;
if (type == "list") oldwidth = BDFDB.getRects(username).width;
let tag = BDFDB.htmlToElement(this.tagMarkup);
let tag = BDFDB.htmlToElement(`<span class="TRE-tag ${BDFDB.disCN.bottagregular + (selector ? (" " + selector) : "")}"><span class="role-inner"></span></span>`);
username.parentElement.insertBefore(tag, username.parentElement.querySelector("svg[name=MobileDevice]"));
let borderColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.5)";
@ -203,7 +185,7 @@ class TopRoleEverywhere {
}
else if (settings.showOwnerRole && info.id == guild.ownerId) roleText = "Owner";
BDFDB.addClass(tag, type + "-tag");
tag.style.setProperty("border", "1px solid " + borderColor);
if (!settings.useOtherStyle) tag.style.setProperty("border", "1px solid " + borderColor);
tag.style.setProperty("background", bgColor);
tag.style.setProperty("order", 11, "important");
let inner = tag.querySelector(".role-inner");