* AutoPagerize Lazy Load Assistant

修复某些AutoPagerize脚本、扩展和附加中出现的第二页或更高版本的延迟加载图像问题。

目前为 2020-11-24 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name * AutoPagerize Lazy Load Assistant
  3. // @name:ja * AutoPagerize Lazy Load Assistant
  4. // @name:zh-CN * AutoPagerize Lazy Load Assistant
  5. // @namespace knoa.jp
  6. // @description It fixes the lazyload image problem of some AutoPagerize scripts, extensions or add-ons, occuring on second or latter pages.
  7. // @description:ja 一部のAutoPagerizeスクリプト、拡張機能、アドオンで発生する、2ページ目以降の遅延読み込み画像の問題を修正します。
  8. // @description:zh-CN 修复某些AutoPagerize脚本、扩展和附加中出现的第二页或更高版本的延迟加载图像问题。
  9. // @include *
  10. // @version 1
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. const SCRIPTNAME = 'AutoPagerize Lazy Load Assistant';
  16. const DATASETS = [
  17. 'src',
  18. 'lazySrc',
  19. 'original',
  20. ];
  21. let name = undefined; //そのページで使われているlazyloadプロパティ名は一度確定したら変わらない
  22. document.addEventListener('GM_AutoPagerizeNextPageLoaded', e => {
  23. console.log(SCRIPTNAME, e.type);
  24. const d = e.target;
  25. const imgs = d.querySelectorAll('img');
  26. imgs.forEach(img => {
  27. if(name === undefined){
  28. name = DATASETS.find(n => img.dataset[n]);
  29. if(name === undefined) return;
  30. }
  31. if(img.dataset[name] !== undefined){
  32. img.src = img.dataset[name];
  33. }
  34. });
  35. });
  36. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址