BDEnhancements icon indicating copy to clipboard operation
BDEnhancements copied to clipboard

ResizeX stopped working since latest Discord update

Open PopnLoch opened this issue 7 years ago • 1 comments

Your plugin ResizeX doesn't work for me anymore because images are clickable now for some reason (a discord update?), and it just drags the image. https://i.imgur.com/dyHYoiP.png

PopnLoch avatar Jan 17 '18 14:01 PopnLoch

I tried to debug it and find the source of the error myself and I think I found out what is causing the error here (at least for the images), so the creator of this plugin may have an easier time finding the error and fixing it.

I ran the debugger in Discord and looked what happens whenever there is an image posted, and I think I was able to find the error on this line: https://github.com/Anxeal/BDEnhancements/blob/0e20c72a345f31e70479d584030fcf12e5cc70d4/plugins/ResizeX/ResizeX.plugin.js#L56

this if never becomes true because it seems like the way Discord is adding new images has changed so that the second condition in there

$(e.addedNodes[0]).attr("src")

always is undefined

whenever there is a new image posted to the chat window it gets added inside of a bigger div element called div.message in which there are two childNodes called div.body and div.acessory

inside the accessory div there is another div with the classes embed-2diOCQ flex-3B1Tl4 embed (don't know if they change all of the ones that I saw had the same class even with different images)

inside this embed div there is a link and inside that link is the <img> element with the src linking to the embedded image.

that's how the added element looks like that starts the ResizeX.prototype.observer event: discord_2018-01-17_23-57-25

tailoric avatar Jan 17 '18 23:01 tailoric