Update Image Loader Placeholder Remover to 1.16.1
- Fix displaying images inside <picture>s
This commit is contained in:
parent
4f5bc106b7
commit
b2f18e2841
|
@ -3,7 +3,7 @@
|
||||||
// @namespace blankie-scripts
|
// @namespace blankie-scripts
|
||||||
// @match http*://*/*
|
// @match http*://*/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// @version 1.16.0
|
// @version 1.16.1
|
||||||
// @author blankie
|
// @author blankie
|
||||||
// @run-at document-end
|
// @run-at document-end
|
||||||
// @description Removes image loading placeholders
|
// @description Removes image loading placeholders
|
||||||
|
@ -151,6 +151,7 @@ function removePlaceholder(img) {
|
||||||
|
|
||||||
parentElement = parentElement.parentElement;
|
parentElement = parentElement.parentElement;
|
||||||
}
|
}
|
||||||
|
let picture = img.closest("picture");
|
||||||
|
|
||||||
let url = findUrl(img);
|
let url = findUrl(img);
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
@ -160,8 +161,6 @@ function removePlaceholder(img) {
|
||||||
|
|
||||||
|
|
||||||
if (window.location.host === "www.vice.com") {
|
if (window.location.host === "www.vice.com") {
|
||||||
let picture = img.parentElement;
|
|
||||||
|
|
||||||
img.style.filter = "none";
|
img.style.filter = "none";
|
||||||
picture.style.opacity = 1;
|
picture.style.opacity = 1;
|
||||||
|
|
||||||
|
@ -170,10 +169,6 @@ function removePlaceholder(img) {
|
||||||
originalUrl = urlObject.href;
|
originalUrl = urlObject.href;
|
||||||
urlObject.search = "?resize=1024:*";
|
urlObject.search = "?resize=1024:*";
|
||||||
url = urlObject.href;
|
url = urlObject.href;
|
||||||
|
|
||||||
for (let source of picture.querySelectorAll("source")) {
|
|
||||||
source.remove();
|
|
||||||
}
|
|
||||||
} else if (window.location.host === "closeronline.co.uk") {
|
} else if (window.location.host === "closeronline.co.uk") {
|
||||||
let urlObject = new URL(url, window.location);
|
let urlObject = new URL(url, window.location);
|
||||||
urlObject.search = "";
|
urlObject.search = "";
|
||||||
|
@ -191,6 +186,15 @@ function removePlaceholder(img) {
|
||||||
// https://legendsoflocalization.com/japans-mysterious-love-of-the-word-lets/#why-lets-is-so-common
|
// https://legendsoflocalization.com/japans-mysterious-love-of-the-word-lets/#why-lets-is-so-common
|
||||||
//img.classList.remove(...getLazyloaderClasses(img));
|
//img.classList.remove(...getLazyloaderClasses(img));
|
||||||
|
|
||||||
|
// apparently, remaining <source>s can fuck up image rendering (firefox still thinks that the <img> 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) {
|
if (!hasLinkParent) {
|
||||||
let wrapper = document.createElement("a");
|
let wrapper = document.createElement("a");
|
||||||
img.replaceWith(wrapper);
|
img.replaceWith(wrapper);
|
||||||
|
|
Loading…
Reference in New Issue