This commit is contained in:
Mirco Wittrien 2019-11-05 09:15:23 +01:00
parent d811df0726
commit 4eb0f7d124
11 changed files with 21 additions and 25 deletions

View File

@ -1068,7 +1068,7 @@ var BDFDB = {
else if (methodnames.includes("componentDidUpdate")) InternalBDFDB.initiateProcess(plugin, type, {instance, methodname:"componentDidUpdate"});
};
InternalBDFDB.initiateProcess = function (plugin, type, e) {
if (BDFDB.ObjectUtils.is(plugin) && e.instance) {
if (BDFDB.ObjectUtils.is(plugin) && !plugin.stopping && e.instance) {
// REMOVE
let isLib = plugin.name == "$BDFDB";
if (plugin.name == "$BDFDB") plugin = BDFDBprocessFunctions;

File diff suppressed because one or more lines are too long

View File

@ -236,7 +236,7 @@ class BadgesEverywhere {
}
injectBadges (instance, children, info, type, colored) {
if (!BDFDB.ArrayUtils.is(children) || !info || info.bot || this.stopping) return;
if (!BDFDB.ArrayUtils.is(children) || !info || info.bot) return;
if (!BDFDB.ArrayUtils.is(this.requestedusers[info.id])) {
this.requestedusers[info.id] = [instance];
BDFDB.LibraryModules.APIUtils.get(BDFDB.DiscordConstants.Endpoints.USER_PROFILE(info.id)).then(result => {

View File

@ -72,7 +72,7 @@ class BetterNsfwTag {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["className", BDFDB.disCN.channelchildren]]});
let firstChildClassName = index > -1 && BDFDB.ReactUtils.getValue(children[index], "props.children.0.props.className");
if (firstChildClassName && firstChildClassName.indexOf("NSFW-tag") > -1) children[index].props.children.shift();
if (!this.stopping && index > -1 && children[index].props && children[index].props.children) {
if (index > -1 && children[index].props && children[index].props.children) {
children[index].props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BotTag, {
className: "NSFW-tag",
tag: "NSFW",

View File

@ -136,7 +136,7 @@ class BetterSearchPage {
}
processSearchResults (e) {
if (!this.stopping && e.instance.props && e.instance.props.search) {
if (e.instance.props && e.instance.props.search) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"Pagination"});
if (index > -1) {
let settings = BDFDB.DataUtils.get(this, "settings");

View File

@ -125,24 +125,20 @@ class CharCounter {
// begin of own functions
processChannelTextArea (e) {
if (!this.stopping && e.instance.props && e.instance.props.type && this.maxLenghts[e.instance.props.type]) {
if (e.instance.props && e.instance.props.type && this.maxLenghts[e.instance.props.type]) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "TextAreaAutosize"});
if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.type, BDFDB.dotCN.textarea, true);
}
}
processNote (e) {
if (!this.stopping) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "TextAreaAutosize"});
if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.usernotepopout) > -1 ? "popout" : "profile", "textarea");
}
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "TextAreaAutosize"});
if (index > -1) this.injectCounter(e.returnvalue, children, e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.usernotepopout) > -1 ? "popout" : "profile", "textarea");
}
processChangeNickname (e) {
if (!this.stopping) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "TextInput"});
if (index > -1) this.injectCounter(e.returnvalue, children, "nickname", BDFDB.dotCN.input);
}
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "TextInput"});
if (index > -1) this.injectCounter(e.returnvalue, children, "nickname", BDFDB.dotCN.input);
}
injectCounter (parent, children, type, refClass, parsing) {

View File

@ -213,7 +213,7 @@ class CompleteTimestamps {
}
processMessage (e) {
if (!this.stopping && !e.instance.props.isCompact) {
if (!e.instance.props.isCompact) {
let settings = BDFDB.DataUtils.get(this, "settings");
if (settings.showInChat) this.injectTimestamp(e.returnvalue, e.instance.props);
if (settings.showOnHover) {
@ -233,7 +233,7 @@ class CompleteTimestamps {
}
processMessageContent (e) {
if (!this.stopping && typeof e.returnvalue.props.children == "function") {
if (typeof e.returnvalue.props.children == "function") {
let settings = BDFDB.DataUtils.get(this, "settings");
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = () => {

View File

@ -221,14 +221,14 @@ class CreationDate {
// begin of own functions
processUserPopout (e) {
if (!this.stopping && e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "CustomStatus"});
if (index > -1) this.injectDate(children, 2, e.instance.props.user);
}
}
processAnalyticsContext (e) {
if (!this.stopping && typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
if (typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = () => {
let renderedChildren = renderChildren(e.instance);

View File

@ -262,7 +262,7 @@ class GoogleTranslateOption {
}
else if (methodnames.includes("render")) {
let [children, index] = BDFDB.ReactUtils.findChildren(returnvalue, {props:[["className", BDFDB.disCN.textareapickerbuttons]]});
if (!this.stopping && index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(this.createTranslateButton());
if (index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(this.createTranslateButton());
}
}

View File

@ -223,14 +223,14 @@ class JoinedAtDate {
// begin of own functions
processUserPopout (e) {
if (!this.stopping && e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "CustomStatus"});
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user);
}
}
processAnalyticsContext (e) {
if (!this.stopping && typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
if (typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = () => {
let renderedChildren = renderChildren(e.instance);
@ -242,7 +242,7 @@ class JoinedAtDate {
}
injectDate (instance, children, index, user) {
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000" || this.stopping) return;
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return;
let guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId();
if (!guildid) return;
if (!this.loadedusers[guildid]) this.loadedusers[guildid] = {};

View File

@ -230,14 +230,14 @@ class LastMessageDate {
// begin of own functions
processUserPopout (e) {
if (!this.stopping && e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
if (e.instance.props.user && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "CustomStatus"});
if (index > -1) this.injectDate(e.instance, children, 2, e.instance.props.user);
}
}
processAnalyticsContext (e) {
if (!this.stopping && typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
if (typeof e.returnvalue.props.children == "function" && e.instance.props && e.instance.props.section == "Profile Modal" && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = () => {
let renderedChildren = renderChildren(e.instance);
@ -249,7 +249,7 @@ class LastMessageDate {
}
injectDate (instance, children, index, user) {
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000" || this.stopping) return;
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return;
let guildid = BDFDB.LibraryModules.LastGuildStore.getGuildId();
let isguild = !!guildid;
guildid = guildid || BDFDB.LibraryModules.LastChannelStore.getChannelId();