This commit is contained in:
Mirco Wittrien 2019-08-29 23:23:06 +02:00
parent 953866ee3a
commit 49a1bc6ed0
2 changed files with 20 additions and 14 deletions

View File

@ -3,7 +3,7 @@
class EditChannels { class EditChannels {
getName () {return "EditChannels";} getName () {return "EditChannels";}
getVersion () {return "3.9.9";} getVersion () {return "4.0.0";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class EditChannels {
initConstructor () { initConstructor () {
this.changelog = { this.changelog = {
"improved":[["<span style='-webkit-background-clip: text; color: transparent; background-image: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'>Color Gradients</span>","You can now use color gradients to edit channels"]] "fixed":[["EditUsers bug","Fixed a bug that occured when EditUsers is enabled"]]
}; };
this.labels = {}; this.labels = {};
@ -401,6 +401,8 @@ class EditChannels {
else { else {
if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel; if (channel.type == 1) channel = this.UserUtils.getUser(channel.recipients[0]) || channel;
if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect(); if (channelname.EditChannelsChangeObserver && typeof channelname.EditChannelsChangeObserver.disconnect == "function") channelname.EditChannelsChangeObserver.disconnect();
if (BDFDB.isPluginEnabled("EditUsers")) bdplugins.EditUsers.plugin.changeName(channel, channelname);
else {
channelname.style.removeProperty("color"); channelname.style.removeProperty("color");
channelname.style.removeProperty("background"); channelname.style.removeProperty("background");
BDFDB.setInnerText(channelname, channel.name || channel.username); BDFDB.setInnerText(channelname, channel.name || channel.username);
@ -409,6 +411,7 @@ class EditChannels {
} }
} }
} }
}
processClickable (instance, wrapper) { processClickable (instance, wrapper) {
if (!instance.props || !instance.props.className) return; if (!instance.props || !instance.props.className) return;

View File

@ -3,7 +3,7 @@
class EditUsers { class EditUsers {
getName () {return "EditUsers";} getName () {return "EditUsers";}
getVersion () {return "3.5.2";} getVersion () {return "3.5.3";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class EditUsers {
initConstructor () { initConstructor () {
this.changelog = { this.changelog = {
"fixed":[["DM Header","Now works properly in DM Headers"]] "fixed":[["EditChannels bug","Fixed a bug that occured when EditChannels is enabled"]]
}; };
this.labels = {}; this.labels = {};
@ -711,16 +711,19 @@ class EditUsers {
processHeaderBar (instance, wrapper) { processHeaderBar (instance, wrapper) {
let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId"); let channel_id = BDFDB.getReactValue(instance, "props.channelId") || BDFDB.getReactValue(instance, "_reactInternalFiber.return.memoizedProps.channelId");
if (channel_id) { if (channel_id) {
let username = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle); let channelname = wrapper.querySelector(BDFDB.dotCN.channelheaderheaderbartitle);
if (username) { if (channelname) {
let channel = this.ChannelUtils.getChannel(channel_id); let channel = this.ChannelUtils.getChannel(channel_id);
if (channel) { if (channel) {
if (channel.type == 1) this.changeName(this.UserUtils.getUser(channel.recipients[0]), username); if (channel.type == 1) this.changeName(this.UserUtils.getUser(channel.recipients[0]), channelname);
else { else {
if (username.EditUsersChangeObserver && typeof username.EditUsersChangeObserver.disconnect == "function") username.EditUsersChangeObserver.disconnect(); if (channelname.EditUsersChangeObserver && typeof channelname.EditUsersChangeObserver.disconnect == "function") channelname.EditUsersChangeObserver.disconnect();
username.style.removeProperty("color"); if (BDFDB.isPluginEnabled("EditChannels")) bdplugins.EditChannels.plugin.changeChannel(channel, channelname);
username.style.removeProperty("background"); else {
BDFDB.setInnerText(username, channel.name); channelname.style.removeProperty("color");
channelname.style.removeProperty("background");
BDFDB.setInnerText(channelname, channel.name);
}
} }
} }
} }