Add support for Vice articles
This commit is contained in:
parent
2d3ee70def
commit
e2acd5235b
|
@ -3,8 +3,9 @@
|
||||||
// @namespace blankie-scripts
|
// @namespace blankie-scripts
|
||||||
// @match http*://closeronline.co.uk/*
|
// @match http*://closeronline.co.uk/*
|
||||||
// @match http*://www.indiatoday.in/*
|
// @match http*://www.indiatoday.in/*
|
||||||
|
// @match http*://www.vice.com/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// @version 1.0
|
// @version 1.1
|
||||||
// @author blankie
|
// @author blankie
|
||||||
// @run-at document-end
|
// @run-at document-end
|
||||||
// @description Removes image loading placeholders
|
// @description Removes image loading placeholders
|
||||||
|
@ -70,8 +71,35 @@ function indiatoday() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO add support for home page, i'm too lazy
|
||||||
|
// https://www.vice.com/en/article/dy73n7/ehallpass-1000-thousand-schools-monitor-bathroom
|
||||||
|
function vice() {
|
||||||
|
for (element of document.querySelectorAll(".lazyloader--lowres")) {
|
||||||
|
let sourceElement = element.querySelector("source");
|
||||||
|
let imgElement = element.querySelector("img");
|
||||||
|
if (sourceElement === null || imgElement === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let url = new URL(sourceElement.srcset, location);
|
||||||
|
url.search = "";
|
||||||
|
|
||||||
|
let newImgElement = imgElement.cloneNode();
|
||||||
|
newImgElement.src = url.href;
|
||||||
|
newImgElement.style.filter = "none";
|
||||||
|
let imgWrapper = document.createElement("a");
|
||||||
|
imgWrapper.href = url.href;
|
||||||
|
imgWrapper.appendChild(newImgElement);
|
||||||
|
imgElement.replaceWith(imgWrapper);
|
||||||
|
|
||||||
|
for (sourceElement of element.querySelectorAll("source")) {
|
||||||
|
sourceElement.remove();
|
||||||
|
}
|
||||||
|
element.style.opacity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (location.host) {
|
switch (location.host) {
|
||||||
case "closeronline.co.uk": closeronline(); break;
|
case "closeronline.co.uk": closeronline(); break;
|
||||||
case "www.indiatoday.in": indiatoday(); break;
|
case "www.indiatoday.in": indiatoday(); break;
|
||||||
|
case "www.vice.com": vice(); break;
|
||||||
};
|
};
|
|
@ -18,8 +18,8 @@ Hacky script to disable the client-side file limit per tab
|
||||||
|
|
||||||
## Image Loader Placeholder Remover
|
## Image Loader Placeholder Remover
|
||||||
|
|
||||||
Removes image loading placeholders from https://closertoday.co.uk and
|
Removes image loading placeholders from https://closertoday.co.uk,
|
||||||
https://www.indiatoday.in
|
https://www.indiatoday.in, and https://www.vice.com (article only).
|
||||||
|
|
||||||
## nightly.link buttons
|
## nightly.link buttons
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue