imgfixer/data_srcset.js

30 lines
674 B
JavaScript
Raw Normal View History

2020-12-24 13:46:30 +00:00
// ==UserScript==
// @name data-srcset Image Fixer
2020-12-24 13:46:30 +00:00
// @version 1
// @grant none
// @match https://kotaku.com/*
2020-12-26 22:24:45 +00:00
// @match https://*.gizmodo.com/*
// @match https://www.latimes.com/*
2022-03-30 14:20:58 +00:00
// @match https://www.videogameschronicle.com/*
2020-12-24 13:46:30 +00:00
// ==/UserScript==
function fixSrcset(element) {
let srcSet = element.getAttribute('data-srcset');
console.log(srcSet);
if (srcSet) {
element.setAttribute('srcset', srcSet);
}
}
2020-12-24 13:46:30 +00:00
function fixImages() {
for (let img of document.getElementsByTagName('img')) {
fixSrcset(img);
2022-03-30 14:20:58 +00:00
img.style.opacity = 1;
}
for (let img of document.getElementsByTagName('source')) {
fixSrcset(img);
2020-12-24 13:46:30 +00:00
}
}
fixImages();