From 169205b3416efd925d764e0278b7389076f0cb3e Mon Sep 17 00:00:00 2001 From: blankie Date: Fri, 1 Sep 2023 10:05:53 +1000 Subject: [PATCH] Update Image Loader Placeholder Remover to 1.18.0 - Add explicit support for www.forbes.com --- Image Loader Placeholder Remover.user.js | 32 +++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Image Loader Placeholder Remover.user.js b/Image Loader Placeholder Remover.user.js index 32d9c95..4af0157 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.17.1 +// @version 1.18.0 // @author blankie // @run-at document-end // @description Removes image loading placeholders @@ -306,4 +306,34 @@ if (window.location.host === "www.wikihow.com") { video.controls = 1; video.src = `/video${video.dataset.src}`; } +} + +// https://www.forbes.com/ +// https://www.forbes.com/sites/ewanspence/2023/08/30/fairphone-5-preview-android-sustainable-repairable-modular-android/ +if (window.location.host === "www.forbes.com") { + for (let progressiveImage of document.querySelectorAll("progressive-image")) { + let url = progressiveImage.getAttribute("src") || progressiveImage.getAttribute("background-image");; + + let img = document.createElement("img"); + for (let attr of progressiveImage.attributes) { + img.setAttribute(attr.name, attr.value); + } + img.src = url; + img.append(...progressiveImage.childNodes); + + let placeholder = progressiveImage.closest(".image-embed__placeholder"); + if (placeholder) { + placeholder.style.height = "auto"; + placeholder.style.paddingTop = 0; + } + + if (!progressiveImage.closest("a")) { + let wrapper = document.createElement("a"); + wrapper.href = url; + wrapper.append(img); + progressiveImage.replaceWith(wrapper); + } else { + progressiveImage.replaceWith(img); + } + } } \ No newline at end of file