From 0cedd01541cd59feba9d5b2fd3327b795e3a68f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=8B=E3=83=A5=E3=83=BC=E3=82=A8=E3=82=B9=E3=83=88?= Date: Tue, 26 Sep 2023 15:17:29 +0800 Subject: [PATCH] Update EmbedMoreImages.plugin.js to v1.5 Update EmbedMoreImages.plugin.js to v1.5 --- EmbedMoreImages.plugin.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/EmbedMoreImages.plugin.js b/EmbedMoreImages.plugin.js index 2c3202a..6f13cfe 100644 --- a/EmbedMoreImages.plugin.js +++ b/EmbedMoreImages.plugin.js @@ -2,7 +2,7 @@ * @name Embed More Images * @author Knew * @description Locally embeds images that are usually unembedded in the Discord client. -* @version 1.4 +* @version 1.5 * @authorId 332116671294734336 * @authorLink https://github.com/Knewest * @invite NqqqzajfK4 @@ -72,7 +72,8 @@ module.exports = class EmbedMoreImages { if (index >= links.length) return; const link = links[index]; const href = link.getAttribute('href'); - if (imgExtensions.some(ext => href.endsWith(ext))) { + const hrefWithoutQuery = href.split(/[?#]/)[0]; + if (imgExtensions.some(ext => hrefWithoutQuery.endsWith(ext))) { if (index >= links.length) { return; } @@ -134,7 +135,7 @@ module.exports = class EmbedMoreImages { if (clickableWrapper) { const imgExtension = document.createElement('span'); imgExtension.className = "altText-EmbedMoreImages imgExtension-EmbedMoreImages"; - const matchingExtension = imgExtensions.find((ext) => href.endsWith(ext)); + const matchingExtension = imgExtensions.find((ext) => hrefWithoutQuery.endsWith(ext)); if (matchingExtension) { imgExtension.textContent = matchingExtension.slice(1).toUpperCase(); imgExtension.style.display = this.settings.enableFormatExtension ? 'inline-block' : 'none'; @@ -567,14 +568,14 @@ module.exports = class EmbedMoreImages { } /** -* Version 1.4 of 'Embed More Images' +* Version 1.5 of 'Embed More Images' * Copyright (Boost Software License 1.0) 2023-2023 Knew * Link to plugin: https://github.com/Knewest/embed-more-images * Support server: https://discord.gg/NqqqzajfK4 * * @changelog {banner} https://cdn.discordapp.com/attachments/753561208073879642/1134847376541106176/output_animation8.webp * @changelog {blurb} Missed or want to know previous changelogs? Find them [here](https://github.com/Knewest/embed-more-images/releases). -* @changelog {fixed.item} The modal is not correctly positioned. Sorry this took so long to address. +* @changelog {fixed.item} Discord broke the embedding. This is fixed now. * @changelog {added.title} What I changed * @changelog {added.item} Functionally? Nothing. * @changelog {footer} Need help? Join my the [support server (NqqqzajfK4)](https://discord.gg/NqqqzajfK4).