Behance - fetch lazy-load images immediately

Fetch lazy-load images immediately at document load

目前为 2014-10-16 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Behance - fetch lazy-load images immediately
  3. // @description Fetch lazy-load images immediately at document load
  4. // @version 1.0
  5. // @namespace http://wOxxOm.scripts
  6. // @author wOxxOm
  7. // @include https://www.behance.net/*
  8. // @run-at document-start
  9. // ==/UserScript==
  10.  
  11. window.addEventListener('DOMContentLoaded', function(e) {
  12. var images = document.body.getElementsByTagName('img');
  13. for (var i=0, len = images.length; i<len; i++) {
  14. var img = images[i];
  15. if (img.className.indexOf('lazy')>=0) {
  16. img.src = (s = img.getAttribute('data-hd-src')) ? s : img.getAttribute('original');
  17. img.className = img.className.replace(/\S*?lazy\S*/, '');
  18. }
  19. }
  20. });