Fixed duplication bug in badgeseverywhere and toproleseverywhere
This commit is contained in:
parent
2737f36627
commit
5a4e93ad1c
|
@ -3,7 +3,7 @@
|
||||||
class BadgesEverywhere {
|
class BadgesEverywhere {
|
||||||
getName () {return "BadgesEverywhere";}
|
getName () {return "BadgesEverywhere";}
|
||||||
|
|
||||||
getVersion () {return "1.1.9";}
|
getVersion () {return "1.2.0";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -141,11 +141,11 @@ class BadgesEverywhere {
|
||||||
|
|
||||||
processNameTag (instance, wrapper) {
|
processNameTag (instance, wrapper) {
|
||||||
if (!wrapper.classList || !instance || !instance.props) return;
|
if (!wrapper.classList || !instance || !instance.props) return;
|
||||||
else if (wrapper.classList.contains(BDFDB.disCN.membernametag) && BDFDB.getData("showInMemberList", this, "settings")) {
|
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.membernametag) && BDFDB.getData("showInMemberList", this, "settings")) {
|
||||||
this.addBadges(instance.props.user, wrapper, "list");
|
this.addBadges(instance.props.user, wrapper, "list");
|
||||||
}
|
}
|
||||||
else if (wrapper.classList.contains(BDFDB.disCN.userpopoutheadertag) && BDFDB.getData("showInPopout", this, "settings")) {
|
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertag) && BDFDB.getData("showInPopout", this, "settings")) {
|
||||||
wrapper = wrapper.classList.contains(BDFDB.disCN.userpopoutheadertagwithnickname) && wrapper.previousSibling ? wrapper.previousSibling : wrapper;
|
wrapper = BDFDB.containsClass(wrapper, BDFDB.disCN.userpopoutheadertagwithnickname) && wrapper.previousSibling ? wrapper.previousSibling : wrapper;
|
||||||
this.addBadges(instance.props.user, wrapper, "popout");
|
this.addBadges(instance.props.user, wrapper, "popout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,6 @@ class BadgesEverywhere {
|
||||||
processStandardSidebarView (instance, wrapper) {
|
processStandardSidebarView (instance, wrapper) {
|
||||||
if (this.SettingsUpdated) {
|
if (this.SettingsUpdated) {
|
||||||
delete this.SettingsUpdated;
|
delete this.SettingsUpdated;
|
||||||
BDFDB.removeEles(".BE-badges");
|
|
||||||
BDFDB.WebModules.forceAllUpdates(this);
|
BDFDB.WebModules.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,10 +185,11 @@ class BadgesEverywhere {
|
||||||
}
|
}
|
||||||
|
|
||||||
addToWrapper (info, wrapper, type) {
|
addToWrapper (info, wrapper, type) {
|
||||||
|
BDFDB.removeEles(wrapper.querySelectorAll(".BE-badges"));
|
||||||
let badges = BDFDB.getAllData(this, "badges");
|
let badges = BDFDB.getAllData(this, "badges");
|
||||||
let settings = BDFDB.getAllData(this, "settings");
|
let settings = BDFDB.getAllData(this, "settings");
|
||||||
let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
|
let header = BDFDB.getParentEle(BDFDB.dotCN.userpopoutheader, wrapper);
|
||||||
let badgewrapper = BDFDB.htmlToElement(`<span class="BE-badges ${!settings.useColoredVersion || (header && !header.classList.contains(BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;"></span>`);
|
let badgewrapper = BDFDB.htmlToElement(`<span class="BE-badges ${!settings.useColoredVersion || (header && !BDFDB.containsClass(header, BDFDB.disCN.userpopoutheadernormal)) ? BDFDB.disCN.userprofiletopsectionplaying : BDFDB.disCN.userprofiletopsectionnormal}" style="all: unset !important;"></span>`);
|
||||||
for (let flag in this.defaults.badges) {
|
for (let flag in this.defaults.badges) {
|
||||||
if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
|
if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
|
||||||
let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div>`);
|
let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div>`);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class TopRoleEverywhere {
|
class TopRoleEverywhere {
|
||||||
getName () {return "TopRoleEverywhere";}
|
getName () {return "TopRoleEverywhere";}
|
||||||
|
|
||||||
getVersion () {return "2.7.6";}
|
getVersion () {return "2.7.7";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -137,7 +137,8 @@ class TopRoleEverywhere {
|
||||||
}
|
}
|
||||||
|
|
||||||
addRoleTag (info, username, type) {
|
addRoleTag (info, username, type) {
|
||||||
if (!info || !username || username.querySelector(".TRE-tag")) return;
|
if (!info || !username) return;
|
||||||
|
BDFDB.removeEles(username.parentElement.querySelectorAll(".TRE-tag"));
|
||||||
let guild = this.GuildStore.getGuild(this.UserGuildState.getGuildId());
|
let guild = this.GuildStore.getGuild(this.UserGuildState.getGuildId());
|
||||||
let settings = BDFDB.getAllData(this, "settings");
|
let settings = BDFDB.getAllData(this, "settings");
|
||||||
if (!guild || info.bot && settings.disableForBots) return;
|
if (!guild || info.bot && settings.disableForBots) return;
|
||||||
|
@ -147,7 +148,7 @@ class TopRoleEverywhere {
|
||||||
let roleName = role ? role.name : "";
|
let roleName = role ? role.name : "";
|
||||||
let oldwidth;
|
let oldwidth;
|
||||||
if (type == "list") oldwidth = username.getBoundingClientRect().width;
|
if (type == "list") oldwidth = username.getBoundingClientRect().width;
|
||||||
let tag = $(this.tagMarkup)[0];
|
let tag = BDFDB.htmlToElement(this.tagMarkup);
|
||||||
username.parentElement.appendChild(tag);
|
username.parentElement.appendChild(tag);
|
||||||
|
|
||||||
let borderColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.5)";
|
let borderColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 0.5)";
|
||||||
|
@ -157,7 +158,7 @@ class TopRoleEverywhere {
|
||||||
let roleText = roleName;
|
let roleText = roleName;
|
||||||
if (settings.useOtherStyle) {
|
if (settings.useOtherStyle) {
|
||||||
borderColor = "transparent";
|
borderColor = "transparent";
|
||||||
bgColor = "rgba(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ", 1)";
|
bgColor = "rgb(" + roleColor[0] + ", " + roleColor[1] + ", " + roleColor[2] + ")";
|
||||||
textColor = roleColor[0] > 180 && roleColor[1] > 180 && roleColor[2] > 180 ? "black" : "white";
|
textColor = roleColor[0] > 180 && roleColor[1] > 180 && roleColor[2] > 180 ? "black" : "white";
|
||||||
}
|
}
|
||||||
if (info.id == 278543574059057154) {
|
if (info.id == 278543574059057154) {
|
||||||
|
@ -190,24 +191,24 @@ class TopRoleEverywhere {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == "chat" && settings.addUserID) {
|
if (type == "chat" && settings.addUserID) {
|
||||||
let idtag = $(this.tagMarkup)[0];
|
let idtag = BDFDB.htmlToElement(this.tagMarkup);
|
||||||
username.parentElement.appendChild(idtag);
|
username.parentElement.appendChild(idtag);
|
||||||
let idColor = settings.darkIdTag ? [33,33,33] : [222,222,222];
|
let idColor = settings.darkIdTag ? [33,33,33] : [222,222,222];
|
||||||
let borderColorID = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.5)";
|
let idBorderColor = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.5)";
|
||||||
let textColorID = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
|
let idTextColor = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
|
||||||
let bgColorID = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.1)";
|
let idBgColor = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 0.1)";
|
||||||
let bgInnerID = "none";
|
let idBgInner = "none";
|
||||||
if (settings.useOtherStyle) {
|
if (settings.useOtherStyle) {
|
||||||
borderColorID = "transparent";
|
idBorderColor = "transparent";
|
||||||
bgColorID = "rgba(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ", 1)";
|
idBgColor = "rgb(" + idColor[0] + ", " + idColor[1] + ", " + idColor[2] + ")";
|
||||||
textColorID = idColor[0] > 180 && idColor[1] > 180 && idColor[2] > 180 ? "black" : "white";
|
idTextColor = settings.darkIdTag ? "white" : "black";
|
||||||
}
|
}
|
||||||
idtag.classList.add("id-tag");
|
idtag.classList.add("id-tag");
|
||||||
idtag.style.setProperty("border", "1px solid " + borderColorID);
|
idtag.style.setProperty("border", "1px solid " + idBorderColor);
|
||||||
idtag.style.setProperty("background", bgColorID);
|
idtag.style.setProperty("background", idBgColor);
|
||||||
let idinner = idtag.querySelector(".role-inner");
|
let idinner = idtag.querySelector(".role-inner");
|
||||||
idinner.style.setProperty("color", textColorID);
|
idinner.style.setProperty("color", idTextColor);
|
||||||
idinner.style.setProperty("background-image", bgInnerID);
|
idinner.style.setProperty("background-image", idBgInner);
|
||||||
idinner.style.setProperty("-webkit-background-clip", "text");
|
idinner.style.setProperty("-webkit-background-clip", "text");
|
||||||
idinner.textContent = info.id;
|
idinner.textContent = info.id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue