This commit is contained in:
Mirco Wittrien 2019-08-29 10:44:05 +02:00
parent 1e128f79a7
commit 53891a2a69
2 changed files with 49 additions and 14 deletions

View File

@ -22,6 +22,7 @@ class EditUsers {
"UserPopout":["componentDidMount","componentDidUpdate"],
"UserProfile":["componentDidMount","componentDidUpdate"],
"FriendRow":"componentDidMount",
"VoiceUser":["componentDidMount","componentDidUpdate"],
"Account":["componentDidMount","componentDidUpdate"],
"AuditLog":"componentDidMount",
"BannedCard":"componentDidMount",
@ -565,6 +566,14 @@ class EditUsers {
this.changeAvatar(instance.props.user, this.getAvatarDiv(wrapper));
}
}
processVoiceUser (instance, wrapper) {
let user = instance.props.user;
if (user && wrapper.className) {
this.changeVoiceUser(user, wrapper.querySelector(BDFDB.dotCN.voicename), instance.props.speaking);
this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
processAccount (instance, wrapper) {
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.child.stateNode.props.currentUser");
@ -737,13 +746,6 @@ class EditUsers {
else if (props && props.userId) this.changeMention(this.UserUtils.getUser(props.userId), wrapper);
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.voiceuser) > -1) {
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.user");
if (user) {
this.changeVoiceUser(user, wrapper.querySelector(BDFDB.dotCN.voicename));
this.changeAvatar(user, this.getAvatarDiv(wrapper));
}
}
else if (instance.props.tag == "div" && instance.props.className.indexOf(BDFDB.disCN.quickswitchresult) > -1) {
let user = BDFDB.getReactValue(instance, "_reactInternalFiber.return.return.memoizedProps.user");
if (user) {
@ -1069,7 +1071,7 @@ class EditUsers {
}
}
changeVoiceUser (info, username) {
changeVoiceUser (info, username, speaking) {
if (!info || !username || !username.parentElement) return;
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect();
username.removeEventListener("mouseover", username.mouseoverListenerEditUsers);
@ -1092,7 +1094,7 @@ class EditUsers {
username.parentElement.parentElement.addEventListener("mouseout", username.mouseoutListenerEditUsers);
username.EditUsersChangeObserver = new MutationObserver((changes, _) => {
username.EditUsersChangeObserver.disconnect();
this.changeVoiceUser(info, username);
this.changeVoiceUser(info, username, speaking);
});
username.EditUsersChangeObserver.observe(username, {attributes:true});
}
@ -1100,11 +1102,11 @@ class EditUsers {
function colorDefault() {
if (BDFDB.isObject(data.color1)) {
username.style.removeProperty("color");
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(!BDFDB.containsClass(username, BDFDB.disCN.voicenamespeaking) ? BDFDB.colorCHANGE(data.color1, -50) : data.color1)} !important;">${BDFDB.encodeToHTML(data.name || member.nick || info.username)}</span>`));
BDFDB.setInnerText(username, BDFDB.htmlToElement(`<span style="pointer-events: none; -webkit-background-clip: text !important; color: transparent !important; background-image: ${BDFDB.colorGRADIENT(!speaking ? BDFDB.colorCHANGE(data.color1, -50) : data.color1)} !important;">${BDFDB.encodeToHTML(data.name || member.nick || info.username)}</span>`));
}
else {
var color1 = data.color1 || (BDFDB.isPluginEnabled("BetterRoleColors") ? member.colorString : "");
username.style.setProperty("color", !BDFDB.containsClass(username, BDFDB.disCN.voicenamespeaking) ? BDFDB.colorCHANGE(color1, -50, "RGB") : BDFDB.colorCONVERT(color1, "RGB"), "important");
username.style.setProperty("color", !speaking ? BDFDB.colorCHANGE(color1, -50, "RGB") : BDFDB.colorCONVERT(color1, "RGB"), "important");
BDFDB.setInnerText(username, data.name || member.nick || info.username);
}
}
@ -1132,13 +1134,21 @@ class EditUsers {
getUserData (id, wrapper) {
let data = BDFDB.loadData(id, this, "users");
if (!data) return {};
if (!data) {
delete wrapper.EditUsersCachedDataState;
return {};
}
else if (wrapper.EditUsersCachedDataState) {
return data;
}
let allenabled = true, settings = BDFDB.getAllData(this, "settings");
for (let i in settings) if (!settings[i]) {
allenabled = false;
break;
}
if (allenabled) return data;
let key = null;
if (!BDFDB.containsClass(wrapper, BDFDB.disCN.mention) && BDFDB.getParentEle(BDFDB.dotCN.messagegroup, wrapper)) key = "changeInChatWindow";
else if (BDFDB.containsClass(wrapper, BDFDB.disCN.mention)) key = "changeInMentions";
@ -1161,8 +1171,14 @@ class EditUsers {
else if (BDFDB.getParentEle(BDFDB.dotCN.searchpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.searchpopoutdmaddpopout, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.quickswitcher, wrapper)) key = "changeInSearchPopout";
else if (BDFDB.getParentEle(BDFDB.dotCN.accountinfo, wrapper)) key = "changeInUserAccount";
else if (wrapper.parentElement == document.head) key = "changeInAppTitle";
return !key || settings[key] ? data : {};
if (!key || settings[key]) {
wrapper.EditUsersCachedDataState = true;
return data;
}
else {
return {};
}
}
addAutoCompleteMenu (textarea, channel) {

View File

@ -722,6 +722,7 @@
<div class="content-3xS9Lh">
<div class="avatarContainer-2inGBK avatar-3elDyV avatarSmall-2CW6I1" style="background-image: url(REPLACE_AVATAR);"></div>
<div class="usernameFont-aFalyR username-lm8y6T">(default) REPLACE_USERNAME</div>
<div class="icons-3q-_6z"><div class="iconSpacing-3LzVxF"><div class="liveRed-lUmv1v live-2o_S8y liveSmall-HChhc3">Live</div></div></div>
</div>
</div>
</div>
@ -1149,6 +1150,24 @@
</button>
</div>
</div>
<div class="panel-VoWSbJ activityPanel-28dQGo">
<div class="body-1II2X1">
<div class="gameWrapper-36OLxh">
<div class="gameIcon-gg34Dz noUserDrag-5Mb43F medium-2wqF9d gameIcon-2kx3DM" style="background-image: url(https://discordapp.com/assets/a5eba102f5b5e413df2b65c73f288afa.svg);"></div>
<div class="gameName-1Zhof6 weightMedium-2iZe9B" title="Game">Game</div>
</div>
<div class="flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2NDFzi alignStretch-DpGPf3 noWrap-3jynv6 actions-U3K8f5" style="flex: 0 1 auto;">
<button aria-label="Stop Streaming" type="button" class="iconButton-_hrfYO button-38aScr lookBlank-3eh9lL colorBrand-3pXr91 grow-q77ONN">
<div class="contents-18-Yxp buttonInner-37locn">
<svg name="StopStream" class="actionIcon-18tUO4" aria-hidden="false" width="24" height="24" viewBox="0 0 24 24">
<path d="M18,12v3H2V6H13V4H2A2,2,0,0,0,0,6V17a2,2,0,0,0,2,2H9v2H5v2H15V21H11V19h7a2,2,0,0,0,2-2V12H18Z" fill="#ffffff"></path>
<polygon points="23 3.41 21.59 2 19.12 4.48 16.64 2 15.23 3.41 17.71 5.88 15.23 8.36 16.64 9.77 19.12 7.29 21.59 9.77 23 8.36 20.52 5.88 23 3.41" fill="#ffffff"></polygon>
</svg>
</div>
</button>
</div>
</div>
</div>
<div class="container-3baos1">
<div tabindex="0" aria-controls="popout_47" aria-expanded="false" aria-label="Set status" role="button">
<div tabindex="0" aria-label="Set status" class="avatarWrapper-2yR4wp" role="button">