fixes
This commit is contained in:
parent
f782b233a1
commit
25b4686859
|
@ -1056,6 +1056,7 @@
|
|||
SearchResults: "searchresultswrap",
|
||||
TypingUsers: "typing",
|
||||
UnreadDMs: "guildsscroller",
|
||||
Upload: "uploadmodal",
|
||||
UserPopout: "userpopout",
|
||||
V2C_ContentColumn: "contentcolumn",
|
||||
V2C_List: "_repolist",
|
||||
|
@ -4629,6 +4630,7 @@
|
|||
DiscordClassModules.TooltipGuild = BDFDB.ModuleUtils.findByProperties("rowIcon", "rowGuildName");
|
||||
DiscordClassModules.Typing = BDFDB.ModuleUtils.findByProperties("cooldownWrapper", "typing");
|
||||
DiscordClassModules.UnreadBar = BDFDB.ModuleUtils.findByProperties("active", "bar", "unread");
|
||||
DiscordClassModules.UploadModal = BDFDB.ModuleUtils.findByProperties("uploadModal", "bgScale");
|
||||
DiscordClassModules.UserPopout = BDFDB.ModuleUtils.findByProperties("userPopout", "headerPlaying");
|
||||
DiscordClassModules.UserProfile = BDFDB.ModuleUtils.findByProperties("topSectionNormal", "tabBarContainer");
|
||||
DiscordClassModules.Video = BDFDB.ModuleUtils.findByProperties("video", "fullScreen");
|
||||
|
@ -5935,6 +5937,7 @@
|
|||
unreadbarmention: ["UnreadBar", "mention"],
|
||||
unreadbartext: ["UnreadBar", "text"],
|
||||
unreadbarunread: ["UnreadBar", "unread"],
|
||||
uploadmodal: ["UploadModal", "uploadModal"],
|
||||
userpopout: ["UserPopout", "userPopout"],
|
||||
userpopoutavatarhint: ["UserPopout", "avatarHint"],
|
||||
userpopoutavatarhintinner: ["UserPopout", "avatarHintInner"],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
class GoogleTranslateOption {
|
||||
getName () {return "GoogleTranslateOption";}
|
||||
|
||||
getVersion () {return "1.8.9";}
|
||||
getVersion () {return "1.9.0";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -17,7 +17,8 @@ class GoogleTranslateOption {
|
|||
|
||||
this.patchedModules = {
|
||||
before: {
|
||||
ChannelTextArea: "render"
|
||||
ChannelTextAreaForm: "render",
|
||||
ChannelEditorContainer: "render"
|
||||
},
|
||||
after: {
|
||||
ChannelTextAreaContainer: "render",
|
||||
|
@ -144,7 +145,7 @@ class GoogleTranslateOption {
|
|||
if (instances.Message) for (let ins of instances.Message) ins.props.message = new BDFDB.DiscordObjects.Message(ins.props.message);
|
||||
BDFDB.ReactUtils.forceUpdate(instances.Message, instances.Embeds);
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, ["ChannelTextArea", "ChannelTextAreaContainer"]);
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, ["ChannelTextAreaForm", "ChannelTextAreaContainer"]);
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ class GoogleTranslateOption {
|
|||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.setLanguages();
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, ["ChannelTextArea", "ChannelTextAreaContainer"]);
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this, ["ChannelTextAreaForm", "ChannelTextAreaContainer"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,28 +229,36 @@ class GoogleTranslateOption {
|
|||
}));
|
||||
}
|
||||
}
|
||||
|
||||
processChannelTextAreaContainer (e) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["className", BDFDB.disCN.textareapickerbuttons]]});
|
||||
if (index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(this.createTranslateButton());
|
||||
}
|
||||
|
||||
processChannelTextArea (e) {
|
||||
if (e.instance.props.type != "normal" || e.instance.props.disabled) return;
|
||||
if (this.translating && this.isTranslating) e.instance.props.disabled = true;
|
||||
if (!BDFDB.ModuleUtils.isPatched(this, e.instance.props, "onSubmit")) BDFDB.ModuleUtils.patch(this, e.instance.props, "onSubmit", {instead: e2 => {
|
||||
processChannelTextAreaForm (e) {
|
||||
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
|
||||
if (this.translating) {
|
||||
BDFDB.ReactUtils.forceUpdate(e.instance);
|
||||
e2.stopOriginalMethodCall();
|
||||
this.translateText(e2.methodArguments[0], "message", (translation, input, output) => {
|
||||
translation = !translation ? e2.methodArguments[0] : (BDFDB.DataUtils.get(this, "settings", "sendOriginalMessage") ? e2.methodArguments[0] + "\n\n" + translation : translation);
|
||||
e2.originalMethod(translation);
|
||||
});
|
||||
return Promise.resolve({
|
||||
shouldClear: true,
|
||||
shouldRefocus: true
|
||||
});
|
||||
}
|
||||
else e2.callOriginalMethodAfterwards();
|
||||
else return e2.callOriginalMethodAfterwards();
|
||||
}}, true);
|
||||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (this.translating && this.isTranslating) e.instance.props.disabled = true;
|
||||
}
|
||||
|
||||
processChannelTextAreaContainer (e) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "ChannelEditorContainer"});
|
||||
if (index > -1 && children[index].props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) {
|
||||
let [children2, index2] = BDFDB.ReactUtils.findChildren(e.returnvalue, {props:[["className", BDFDB.disCN.textareapickerbuttons]]});
|
||||
if (index2 > -1 && children2[index2].props && children2[index2].props.children) children2[index2].props.children.unshift(this.createTranslateButton());
|
||||
}
|
||||
}
|
||||
|
||||
processMessageContent (e) {
|
||||
if (typeof e.returnvalue.props.children == "function") {
|
||||
let renderChildren = e.returnvalue.props.children;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class SendLargeMessages {
|
||||
getName () {return "SendLargeMessages";}
|
||||
|
||||
getVersion () {return "1.5.8";}
|
||||
getVersion () {return "1.5.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -17,7 +17,8 @@ class SendLargeMessages {
|
|||
|
||||
this.patchedModules = {
|
||||
before: {
|
||||
ChannelTextArea: "render"
|
||||
ChannelTextAreaForm: "render",
|
||||
ChannelEditorContainer: "render"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -79,24 +80,29 @@ class SendLargeMessages {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannelTextArea (e) {
|
||||
if (e.instance.props && e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) {
|
||||
e.instance.props.shouldUploadLongMessages = false;
|
||||
if (!BDFDB.ModuleUtils.isPatched(this, e.instance.props, "onSubmit")) BDFDB.ModuleUtils.patch(this, e.instance.props, "onSubmit", {instead: e2 => {
|
||||
let parsedLength = BDFDB.StringUtils.getParsedLength(e2.methodArguments[0]);
|
||||
if (parsedLength > 2000) {
|
||||
e2.stopOriginalMethodCall();
|
||||
let messages = this.formatText(e2.methodArguments[0], Math.sqrt(Math.pow(parsedLength - e2.methodArguments[0].length, 2)) > Math.max(parsedLength, e2.methodArguments[0].length) / 20);
|
||||
messages.filter(n => n).forEach((message, i) => {
|
||||
BDFDB.TimeUtils.timeout(_ => {
|
||||
e2.originalMethod(message);
|
||||
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
|
||||
}, this.messageDelay * i);
|
||||
});
|
||||
}
|
||||
else e2.callOriginalMethodAfterwards();
|
||||
}}, true);
|
||||
}
|
||||
processChannelTextAreaForm (e) {
|
||||
if (!BDFDB.ModuleUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.ModuleUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
|
||||
let parsedLength = BDFDB.StringUtils.getParsedLength(e2.methodArguments[0]);
|
||||
if (parsedLength > 2000) {
|
||||
e2.stopOriginalMethodCall();
|
||||
let messages = this.formatText(e2.methodArguments[0], Math.sqrt(Math.pow(parsedLength - e2.methodArguments[0].length, 2)) > Math.max(parsedLength, e2.methodArguments[0].length) / 20);
|
||||
messages.filter(n => n).forEach((message, i) => {
|
||||
BDFDB.TimeUtils.timeout(_ => {
|
||||
e2.originalMethod(message);
|
||||
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent_text, {type:"success"});
|
||||
}, this.messageDelay * i);
|
||||
});
|
||||
return Promise.resolve({
|
||||
shouldClear: true,
|
||||
shouldRefocus: true
|
||||
});
|
||||
}
|
||||
else return e2.callOriginalMethodAfterwards();
|
||||
}}, true);
|
||||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (e.instance.props.type && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false;
|
||||
}
|
||||
|
||||
formatText (text, parse) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class WriteUpperCase {
|
||||
getName () {return "WriteUpperCase";}
|
||||
|
||||
getVersion () {return "1.2.3";}
|
||||
getVersion () {return "1.2.4";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -17,7 +17,7 @@ class WriteUpperCase {
|
|||
|
||||
this.patchedModules = {
|
||||
before: {
|
||||
ChannelTextArea: "render"
|
||||
ChannelEditorContainer: "render"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ class WriteUpperCase {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processChannelTextArea (e) {
|
||||
if (e.instance.props.type && e.instance.props.textValue && e.instance.state.focused) {
|
||||
processChannelEditorContainer (e) {
|
||||
if (e.instance.props.textValue && e.instance.state.focused) {
|
||||
let string = e.instance.props.textValue;
|
||||
if (string.length > 0) {
|
||||
let newstring = string;
|
||||
|
|
Loading…
Reference in New Issue