Behance - fetch lazy-load images immediately

Fetch lazy-load images immediately at document load

目前为 2014-10-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Behance - fetch lazy-load images immediately
  3. // @description Fetch lazy-load images immediately at document load
  4. // @version 1.01
  5. // @namespace http://wOxxOm.scripts
  6. // @author wOxxOm
  7. // @include https://www.behance.net/*
  8. // @match https://www.behance.net/*
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. window.addEventListener('DOMContentLoaded', function(e) {
  13. var images = document.body.getElementsByTagName('img');
  14. for (var img, i=0; i<images.length && (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. });