From 5efd352e01ae4bd59381324894f7dad9292b27db Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 28 Apr 2021 18:00:01 +0200 Subject: [PATCH] Update ImageUtilities.plugin.js --- .../ImageUtilities/ImageUtilities.plugin.js | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/Plugins/ImageUtilities/ImageUtilities.plugin.js b/Plugins/ImageUtilities/ImageUtilities.plugin.js index bbf12c93e4..b4de0bf73e 100644 --- a/Plugins/ImageUtilities/ImageUtilities.plugin.js +++ b/Plugins/ImageUtilities/ImageUtilities.plugin.js @@ -2,7 +2,7 @@ * @name ImageUtilities * @author DevilBro * @authorId 278543574059057154 - * @version 4.3.6 + * @version 4.3.7 * @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.) * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,10 +17,13 @@ module.exports = (_ => { "info": { "name": "ImageUtilities", "author": "DevilBro", - "version": "4.3.6", + "version": "4.3.7", "description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)" }, "changeLog": { + "fixed": { + "Embed Thumbnails": "Fixed issue that caused Embed Thumbnails to go out of bounds of embeds" + }, "improved": { "Tenor and other GIFs": "Fixed issue where link for some GIFs copied by 'Copy Link' wasn't the same as Discord's Original" } @@ -288,7 +291,22 @@ module.exports = (_ => { }); BDFDB.PatchUtils.patch(this, (BDFDB.ModuleUtils.findByName("renderImageComponent", false).exports || {}), "renderImageComponent", {after: e => { - if (e.returnValue && e.returnValue.type && (e.returnValue.type.displayName == "LazyImageZoomable" || e.returnValue.type.displayName == "LazyImage") && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1) return this.injectImageDetails(e.methodArguments[0], e.returnValue); + if (this.settings.general.showAsHeader && e.returnValue && e.returnValue.type && (e.returnValue.type.displayName == "LazyImageZoomable" || e.returnValue.type.displayName == "LazyImage") && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1) { + return BDFDB.ReactUtils.createElement("div", { + className: BDFDB.disCN.embedwrapper, + children: [ + BDFDB.ReactUtils.createElement(ImageDetails, { + original: e.methodArguments[0].original, + attachment: { + height: 0, + width: 0, + filename: "unknown.png" + } + }), + e.returnValue + ] + }); + } }}); this.forceUpdateAll(); @@ -983,27 +1001,6 @@ module.exports = (_ => { } } - injectImageDetails (props, child) { - if (this.settings.general.showAsHeader) { - props.detailsAdded = true; - return BDFDB.ReactUtils.createElement("div", { - className: BDFDB.disCN.embedwrapper, - children: [ - BDFDB.ReactUtils.createElement(ImageDetails, { - original: props.original, - attachment: { - height: 0, - width: 0, - filename: "unknown.png" - } - }), - child - ] - }); - } - return child; - } - isValid (url, type) { if (!url) return false; const file = url && (BDFDB.LibraryModules.URLParser.parse(url).pathname || "").split("%3A")[0].toLowerCase();