Update DisplayLargeMessages.plugin.js

This commit is contained in:
Mirco Wittrien 2020-06-22 10:31:47 +02:00
parent 4c43e5d02b
commit 785b6b4204
1 changed files with 31 additions and 29 deletions

View File

@ -219,36 +219,38 @@ var DisplayLargeMessages = (_ => {
} }
processAttachment (e) { processAttachment (e) {
if (e.instance.props.filename == "message.txt" && settings.onDemand || amounts.maxFileSize && (amounts.maxFileSize < e.instance.props.size/1024)) e.returnvalue.props.children.splice(2, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { if (e.instance.props.filename == "message.txt" && (settings.onDemand || amounts.maxFileSize && (amounts.maxFileSize < e.instance.props.size/1024))) {
text: this.labels.button_injectattchment_text, e.returnvalue.props.children.splice(2, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, { text: this.labels.button_injectattchment_text,
rel: "noreferrer noopener", children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, {
target: "_blank", rel: "noreferrer noopener",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { target: "_blank",
className: BDFDB.disCN._displaylargemessagesinjectbutton, children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT, className: BDFDB.disCN._displaylargemessagesinjectbutton,
width: 20, name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT,
height: 20 width: 20,
}), height: 20
onClick: event => { }),
BDFDB.ListenerUtils.stopEvent(event); onClick: event => {
let target = event.target; BDFDB.ListenerUtils.stopEvent(event);
let message = BDFDB.ReactUtils.findValue(target, "message", {up: true}); let target = event.target;
if (message) { let message = BDFDB.ReactUtils.findValue(target, "message", {up: true});
pendingRequests.push(message.id); if (message) {
BDFDB.LibraryRequires.request(e.instance.props.url, (error, response, body) => { pendingRequests.push(message.id);
BDFDB.ArrayUtils.remove(pendingRequests, message.id, true); BDFDB.LibraryRequires.request(e.instance.props.url, (error, response, body) => {
oldMessages[message.id] = new BDFDB.DiscordObjects.Message(message); BDFDB.ArrayUtils.remove(pendingRequests, message.id, true);
encodedMessages[message.id] = { oldMessages[message.id] = new BDFDB.DiscordObjects.Message(message);
content: message.content || "", encodedMessages[message.id] = {
attachment: body || "" content: message.content || "",
}; attachment: body || ""
BDFDB.ModuleUtils.forceAllUpdates(this, "Messages"); };
}); BDFDB.ModuleUtils.forceAllUpdates(this, "Messages");
});
}
} }
} })
}) }));
})); }
} }
forceUpdateAll () { forceUpdateAll () {