Add Image Loader Placeholder Remover
This commit is contained in:
parent
65ec104683
commit
2d3ee70def
|
@ -0,0 +1,77 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name Image Loader Placeholder Remover
|
||||||
|
// @namespace blankie-scripts
|
||||||
|
// @match http*://closeronline.co.uk/*
|
||||||
|
// @match http*://www.indiatoday.in/*
|
||||||
|
// @grant none
|
||||||
|
// @version 1.0
|
||||||
|
// @author blankie
|
||||||
|
// @run-at document-end
|
||||||
|
// @description Removes image loading placeholders
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
// https://closeronline.co.uk
|
||||||
|
// https://closeronline.co.uk/real-life/news/ever-used-excuses-documented-spreadsheet-man-used-expose-wife-s-lack-sex
|
||||||
|
function closeronline() {
|
||||||
|
for (element of document.querySelectorAll(".image-container")) {
|
||||||
|
let imageElement = element.querySelector("img");
|
||||||
|
let loadingElement = element.querySelector(".image-loading");
|
||||||
|
if (imageElement === null || loadingElement === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (imageElement.attributes["data-src"] === undefined || imageElement.attributes["data-src"].value.length <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let url = new URL(imageElement.attributes["data-src"].value, location);
|
||||||
|
let dontAddLink = element.parentNode.tagName === "A";
|
||||||
|
|
||||||
|
if (!dontAddLink) {
|
||||||
|
let newImageElement = imageElement.cloneNode();
|
||||||
|
newImageElement.src = url.href;
|
||||||
|
newImageElement.style.opacity = 100;
|
||||||
|
newImageElement.style.display = "block";
|
||||||
|
url.search = "";
|
||||||
|
let imageWrapper = document.createElement("a");
|
||||||
|
imageWrapper.href = url.href;
|
||||||
|
imageWrapper.appendChild(newImageElement);
|
||||||
|
imageElement.replaceWith(imageWrapper);
|
||||||
|
} else {
|
||||||
|
imageElement.src = url.href;
|
||||||
|
imageElement.style.opacity = 100;
|
||||||
|
imageElement.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
loadingElement.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://www.indiatoday.in
|
||||||
|
// https://www.indiatoday.in/technology/news/story/vivo-v25-pro-launched-in-india-price-starts-from-rs-35-999-1988971-2022-08-17
|
||||||
|
function indiatoday() {
|
||||||
|
for (element of document.querySelectorAll("img.lazyload")) {
|
||||||
|
if (element.attributes["data-src"] === undefined || element.attributes["data-src"].value.length <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let url = new URL(element.attributes["data-src"].value, location);
|
||||||
|
let dontAddLink = element.parentNode.tagName === "A" ||
|
||||||
|
(element.parentNode.tagName === "DIV" && element.parentNode.classList.contains("reporter_img"));
|
||||||
|
|
||||||
|
if (!dontAddLink) {
|
||||||
|
let newElement = element.cloneNode();
|
||||||
|
newElement.src = url.href;
|
||||||
|
url.search = "";
|
||||||
|
let wrapper = document.createElement("a");
|
||||||
|
wrapper.href = url.href;
|
||||||
|
wrapper.appendChild(newElement);
|
||||||
|
element.replaceWith(wrapper);
|
||||||
|
} else {
|
||||||
|
element.src = url.href;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
switch (location.host) {
|
||||||
|
case "closeronline.co.uk": closeronline(); break;
|
||||||
|
case "www.indiatoday.in": indiatoday(); break;
|
||||||
|
};
|
|
@ -16,6 +16,11 @@ to enable scripts to see emails again, inspired by
|
||||||
|
|
||||||
Hacky script to disable the client-side file limit per tab
|
Hacky script to disable the client-side file limit per tab
|
||||||
|
|
||||||
|
## Image Loader Placeholder Remover
|
||||||
|
|
||||||
|
Removes image loading placeholders from https://closertoday.co.uk and
|
||||||
|
https://www.indiatoday.in
|
||||||
|
|
||||||
## nightly.link buttons
|
## nightly.link buttons
|
||||||
|
|
||||||
A script to add [nightly.link](https://nightly.link) buttons on artifacts and
|
A script to add [nightly.link](https://nightly.link) buttons on artifacts and
|
||||||
|
|
Loading…
Reference in New Issue