imgfixer/data_srcset.js

30 lines
674 B
JavaScript

// ==UserScript==
// @name data-srcset Image Fixer
// @version 1
// @grant none
// @match https://kotaku.com/*
// @match https://*.gizmodo.com/*
// @match https://www.latimes.com/*
// @match https://www.videogameschronicle.com/*
// ==/UserScript==
function fixSrcset(element) {
let srcSet = element.getAttribute('data-srcset');
console.log(srcSet);
if (srcSet) {
element.setAttribute('srcset', srcSet);
}
}
function fixImages() {
for (let img of document.getElementsByTagName('img')) {
fixSrcset(img);
img.style.opacity = 1;
}
for (let img of document.getElementsByTagName('source')) {
fixSrcset(img);
}
}
fixImages();