I have a userscript that does exactly this. It detects attributes on img tags that likely contain the real image url and changes the src attribute to that. I wrote it so sites with lazy loading images can be used without running their javascript.
// ==UserScript==
// @name fix-lazy-load-images
// @version 2
// @grant none
// @exclude /^https?://(?:(?:[^\W_]|-)+\.)?washingtonpost\.com(/.*|$)/
// ==/UserScript==
// example site: https://www.howtogeek.com/167533/the-ultimate-guide-to-changing-your-dns-server/
function doit(){
var lazy_image_keywords = ['data', 'pagespeed', 'lazy', 'src'];
var fix_lazy_load_element = function(element, src_attribute, keywords) {
var last_valid = "";
for (var attribute of element.attributes) {
var number_of_keywords = 0;
for (var keyword of keywords) {
if (attribute.name.includes(keyword) ){
number_of_keywords += 1;
if (number_of_keywords >= 2) {break};
}
}
if (number_of_keywords >= 2) {
last_valid = attribute;
}
}
if (last_valid !== "") {
element.setAttribute(src_attribute, last_valid.value);
}
}
for (var element of document.querySelectorAll('img')) {
fix_lazy_load_element(element, "src", lazy_image_keywords);
}
// now fix all the <source> tags in <picture> tag...
for (var picture_element of document.querySelectorAll('picture')) {
for (var source_element of picture_element.querySelectorAll("source")) {
fix_lazy_load_element(source_element, "srcset", lazy_image_keywords);
}
}
}
if(document.readyState === "loading"){
window.addEventListener('load', doit);
} else {
doit();
}
Greasemonkey or similar is required of course. I don't believe there's a way to do this without such an addon. The Washington Post is the only site I've encountered so far where this causes issues. As such, it is excluded.
1My Firefox 39.0 on Ubuntu 15.04 loads all the images on- and off-screen during the initial page load of your link. I have quite a few add-ons installed, and one of these may cause this behaviour, but it would take a long time to investigate which: possible candidates include Image Zoom, Tab Scope and Print Edit. Personally, I would prefer if it worked as it does for you, but each to his or her own. – AFH – 2015-07-09T11:58:15.223
@AFH: Thank you for the tips, I will investigate those addons and see what I can come up with. – dotancohen – 2015-07-09T13:51:30.973