From 38c67e2be574cf6f79312417c296c6b9e5c1747f Mon Sep 17 00:00:00 2001 From: blankie Date: Tue, 9 Jan 2024 11:09:57 +1100 Subject: [PATCH] Update Image Loader Placeholder Remover to 1.23.3 - Fix handling www.chaobunnyarts.com --- Image Loader Placeholder Remover.user.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Image Loader Placeholder Remover.user.js b/Image Loader Placeholder Remover.user.js index e02c030..363bdfc 100644 --- a/Image Loader Placeholder Remover.user.js +++ b/Image Loader Placeholder Remover.user.js @@ -4,7 +4,7 @@ // @match http*://*/* // @exclude-match http*://solar.lowtechmagazine.com/* // @grant none -// @version 1.23.2 +// @version 1.23.3 // @author blankie // @run-at document-end // @description Removes image loading placeholders @@ -16,7 +16,9 @@ const URL_RE_STR = "(?:https?://|\\.{0,2}/)\\S+"; const URL_RE = new RegExp(`^${URL_RE_STR}$`); const SRCSET_COMPONENT = `${URL_RE_STR}(?:\\s+\\d+w|\\s+\\d+(?:\\.\\d+)?x)?`; -const SRCSET_RE = new RegExp(`^${SRCSET_COMPONENT}(?:,\\s*${SRCSET_COMPONENT})*$`); +// Example of a trailing comma: +// - https://www.chaobunnyarts.com/product/shipping-upgrade-tracked-sticker-shipping +const SRCSET_RE = new RegExp(`^${SRCSET_COMPONENT}(?:,\\s*${SRCSET_COMPONENT})*,?$`); let cachedCSSProperties = new Map(); @@ -110,7 +112,9 @@ function findSrcset(element) { // Examples of data-srcset: // - https://www.cbsnews.com/ // - https://www.cbsnews.com/news/leonard-mack-exonerated-47-years-after-wrongful-rape-conviction/ - if (/srcset/.test(attr.name) && attr.name !== "srcset" && SRCSET_RE.test(attr.value)) { + // - https://www.chaobunnyarts.com/ + // - https://www.chaobunnyarts.com/product/shipping-upgrade-tracked-sticker-shipping + if (/srcset/.test(attr.name) && attr.name !== "srcset" && SRCSET_RE.test(attr.value.trim())) { return attr.value; } } @@ -157,10 +161,13 @@ function getLazyloaderClasses(element) { // Examples of image (though admittedly a hack for cloneLazyloaderTree): // - https://restofworld.org/ // - https://restofworld.org/2023/parent-facing-matchmaking-apps-china/ - // Example of img: + // Examples of img: // - https://www.bloomberg.com/news/features/2023-05-11/the-plot-to-steal-the-secret-coke-can-liner-formula // - https://www.bloomberg.com/news/features/2023-09-28/google-user-data-is-police-s-top-shortcut-for-solving-crimes - if (/loading|lazy|responsive|preload|placeholder|image/.test(className)) { + // Examples of blur; + // - https://www.chaobunnyarts.com/ + // - https://www.chaobunnyarts.com/product/shipping-upgrade-tracked-sticker-shipping + if (/loading|lazy|responsive|preload|placeholder|image|blur/.test(className)) { classes.push(className); } }