This commit is contained in:
Mirco Wittrien 2019-08-06 20:53:56 +02:00
parent 41fdbda5f7
commit ba2ebf6c08
2 changed files with 17 additions and 19 deletions

View File

@ -3,7 +3,7 @@
class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.4.9";}
getVersion () {return "3.5.0";}
getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class EditUsers {
initConstructor () {
this.changelog = {
"fixed":[["TRE issue","Fixed"]]
"fixed":[["Coloring issues","Fixed some coloring issues with inverted tags"]]
};
this.labels = {};
@ -56,12 +56,11 @@ class EditUsers {
${BDFDB.dotCN.userpopoutheaderbottagwithnickname} {
bottom: 4px;
}
${BDFDB.dotCNS.userpopoutheadertagwithnickname + BDFDB.dotCN.userpopoutheaderbottagwithnickname} {
${BDFDB.dotCN.userpopoutheaderbottagwithnickname} {
bottom: 0px;
}
${BDFDB.dotCN.userprofilebottag} {
bottom: 3px;
}
${BDFDB.dotCNS.userpopoutheadernamewrapper + BDFDB.dotCN.bottag},
${BDFDB.dotCN.userprofilebottag},
${BDFDB.dotCN.bottagmessagecozy} {
bottom: 2px;
}
@ -546,7 +545,7 @@ class EditUsers {
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagnametag);
this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagnametag, wrapper);
}
}
@ -555,7 +554,7 @@ class EditUsers {
if (username) {
this.changeName(instance.props.user, username);
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
this.addTag(instance.props.user, username.parentElement, BDFDB.disCN.bottagnametag);
this.addTag(instance.props.user, username.parentElement, BDFDB.disCNS.userprofilebottag + BDFDB.disCN.bottagnametag, wrapper);
}
}
@ -889,10 +888,9 @@ class EditUsers {
changeBotTags (data, username, member) {
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");
tagcolor = BDFDB.colorISBRIGHT(tagcolor) ? BDFDB.colorCHANGE(tagcolor, -0.3) : tagcolor;
tag.style.setProperty(invert ? "color" : "background-color", tagcolor, "important");
tag.style.setProperty(BDFDB.containsClass(tag, BDFDB.disCN.bottaginvert) ? "color" : "background-color", tagcolor, "important");
}
}
@ -936,7 +934,7 @@ class EditUsers {
}
}
addTag (info, wrapper, selector = "") {
addTag (info, wrapper, selector = "", container) {
if (!info || !wrapper || !wrapper.parentElement || BDFDB.containsClass(wrapper, BDFDB.disCN.accountinfodetails) || BDFDB.containsClass(wrapper, "discord-tag")) return;
BDFDB.removeEles(wrapper.querySelectorAll(".EditUsers-tag"));
let data = this.getUserData(info.id, wrapper);
@ -945,10 +943,11 @@ class EditUsers {
let color3 = BDFDB.colorCONVERT(!data.ignoreTagColor ? data.color3 : member.colorString, "RGB");
let color4 = !data.ignoreTagColor && data.color4 ? BDFDB.colorCONVERT(data.color4, "RGB") : (color3 ? (BDFDB.colorISBRIGHT(color3) ? "black" : "white") : null);
let tag = document.createElement("span");
tag.className = "EditUsers-tag " + BDFDB.disCN.bottagregular + (selector ? (" " + selector) : "");
let invert = container && !color3 && !color4 && container.firstElementChild && !(BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
tag.className = "EditUsers-tag " + (!invert ? BDFDB.disCN.bottagregular : BDFDB.disCN.bottaginvert) + (selector ? (" " + selector) : "");
tag.innerText = data.tag;
tag.style.setProperty("background-color", color3, "important");
tag.style.setProperty("color", color4, "important");
tag.style.setProperty("background-color", !invert ? color3 : color4, "important");
tag.style.setProperty("color", !invert ? color4 : color3, "important");
wrapper.appendChild(tag);
}
}

View File

@ -3,7 +3,7 @@
class OwnerTag {
getName () {return "OwnerTag";}
getVersion () {return "1.1.4";}
getVersion () {return "1.1.5";}
getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class OwnerTag {
initConstructor () {
this.changelog = {
"fixed":[["New Structure","Fixed issues that will occur once the avatar/name changes from canary will hit stable/ptb"]]
"fixed":[["Coloring issues","Fixed some coloring issues with inverted tags"]]
};
this.patchModules = {
@ -153,7 +153,7 @@ class OwnerTag {
}
processUserProfile (instance, wrapper) {
if (instance.props && BDFDB.getData("addInUserProfil", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCN.bottagnametag, wrapper);
if (instance.props && BDFDB.getData("addInUserProfil", this, "settings")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCNS.bottagnametag + BDFDB.disCN.userprofilebottag, wrapper);
}
processMessageUsername (instance, wrapper, methodnames) {
@ -189,8 +189,7 @@ class OwnerTag {
let EditUsersData = BDFDB.isPluginEnabled("EditUsers") ? window.bdplugins.EditUsers.plugin.getUserData(info.id, wrapper) : {};
if (!settings.useCrown) {
let tag = BDFDB.htmlToElement(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.getData(isowner ? "ownTagName" : "ownAdminTagName", this, "inputs")}</span>`);
let invert = false;
if (container && container.firstElementChild && !BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal, BDFDB.disCN.userprofiletopsectionnormal), false) invert = true;
let invert = container && container.firstElementChild && !(BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
BDFDB.addClass(tag, invert ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular);
let tagcolor = BDFDB.colorCONVERT(EditUsersData.color1 || member.colorString, "RGB");
let isbright = BDFDB.colorISBRIGHT(tagcolor);