Behance - fetch lazy-load images immediately

Fetch lazy-load images immediately at document load

Fra 16.10.2014. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Behance - fetch lazy-load images immediately
// @description Fetch lazy-load images immediately at document load
// @version 1.0
// @namespace http://wOxxOm.scripts
// @author wOxxOm
// @include https://www.behance.net/*
// @run-at document-start
// ==/UserScript==

window.addEventListener('DOMContentLoaded', function(e) {
  var images = document.body.getElementsByTagName('img');
  for (var i=0, len = images.length; i<len; i++) {
    var img = images[i];
    if (img.className.indexOf('lazy')>=0) {
      img.src = (s = img.getAttribute('data-hd-src')) ? s : img.getAttribute('original');
      img.className = img.className.replace(/\S*?lazy\S*/, '');
    }
  }
});