From b2f18e2841ced4594e3538d01eccf43573667a84 Mon Sep 17 00:00:00 2001 From: blankie Date: Fri, 11 Aug 2023 16:25:46 +1000 Subject: [PATCH] Update Image Loader Placeholder Remover to 1.16.1 - Fix displaying images inside s --- Image Loader Placeholder Remover.user.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Image Loader Placeholder Remover.user.js b/Image Loader Placeholder Remover.user.js index 2164efc..28d75ff 100644 --- a/Image Loader Placeholder Remover.user.js +++ b/Image Loader Placeholder Remover.user.js @@ -3,7 +3,7 @@ // @namespace blankie-scripts // @match http*://*/* // @grant none -// @version 1.16.0 +// @version 1.16.1 // @author blankie // @run-at document-end // @description Removes image loading placeholders @@ -151,6 +151,7 @@ function removePlaceholder(img) { parentElement = parentElement.parentElement; } + let picture = img.closest("picture"); let url = findUrl(img); if (!url) { @@ -160,8 +161,6 @@ function removePlaceholder(img) { if (window.location.host === "www.vice.com") { - let picture = img.parentElement; - img.style.filter = "none"; picture.style.opacity = 1; @@ -170,10 +169,6 @@ function removePlaceholder(img) { originalUrl = urlObject.href; urlObject.search = "?resize=1024:*"; url = urlObject.href; - - for (let source of picture.querySelectorAll("source")) { - source.remove(); - } } else if (window.location.host === "closeronline.co.uk") { let urlObject = new URL(url, window.location); urlObject.search = ""; @@ -191,6 +186,15 @@ function removePlaceholder(img) { // https://legendsoflocalization.com/japans-mysterious-love-of-the-word-lets/#why-lets-is-so-common //img.classList.remove(...getLazyloaderClasses(img)); + // apparently, remaining s can fuck up image rendering (firefox still thinks that the contains an empty image?) + // https://gizmodo.com/reddit-news-blackout-protest-is-finally-over-reddit-won-1850707509 + // also, the above vice.com-specific condition had the below code + if (picture) { + for (let source of picture.querySelectorAll("source")) { + source.remove(); + } + } + if (!hasLinkParent) { let wrapper = document.createElement("a"); img.replaceWith(wrapper);