Update DisplayLargeMessages.plugin.js

This commit is contained in:
Mirco Wittrien 2021-02-12 12:40:30 +01:00
parent 539612bdd8
commit a86ad88be5
1 changed files with 6 additions and 6 deletions

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "DisplayLargeMessages", "name": "DisplayLargeMessages",
"author": "DevilBro", "author": "DevilBro",
"version": "1.0.7", "version": "1.0.8",
"description": "Inject the contents of large messages that were sent by discord via 'message.txt'" "description": "Inject the contents of large messages that were sent by discord via 'message.txt'"
}, },
"changelog": { "changelog": {
"added": { "improved": {
"Open in popout": "Added an option to add a button that allows you to preview the contents of a 'message.txt' in a popup" "Open in Popout": "The open button now gets added to any .txt file not only 'message.txt'"
} }
} }
}; };
@ -247,9 +247,9 @@ module.exports = (_ => {
} }
processAttachment (e) { processAttachment (e) {
if (e.instance.props.filename == "message.txt" && (settings.onDemand || amounts.maxFileSize && (amounts.maxFileSize < e.instance.props.size/1024))) { if (typeof e.instance.props.filename == "string") {
e.returnvalue.props.children.splice(2, 0, [ e.returnvalue.props.children.splice(2, 0, [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { e.instance.props.filename == "message.txt" && (settings.onDemand || amounts.maxFileSize && (amounts.maxFileSize < e.instance.props.size/1024)) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: this.labels.button_injectattachment, text: this.labels.button_injectattachment,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, {
className: BDFDB.disCN._displaylargemessagesinjectbuttonwrapper, className: BDFDB.disCN._displaylargemessagesinjectbuttonwrapper,
@ -280,7 +280,7 @@ module.exports = (_ => {
} }
}) })
}), }),
settings.addOpenButton && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { e.instance.props.filename.endsWith(".txt") && settings.addOpenButton && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: BDFDB.LanguageUtils.LanguageStrings.OPEN, text: BDFDB.LanguageUtils.LanguageStrings.OPEN,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, {
className: BDFDB.disCN._displaylargemessagespopoutbuttonwrapper, className: BDFDB.disCN._displaylargemessagespopoutbuttonwrapper,