* AutoPagerize Lazy Load Assistant

It fixes the lazyload image problem of some AutoPagerize scripts, extensions or add-ons, occuring on second or latter pages.

Verze ze dne 25. 11. 2020. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        * AutoPagerize Lazy Load Assistant
// @name:ja     * AutoPagerize Lazy Load Assistant
// @name:zh-CN  * AutoPagerize Lazy Load Assistant
// @namespace   knoa.jp
// @description It fixes the lazyload image problem of some AutoPagerize scripts, extensions or add-ons, occuring on second or latter pages.
// @description:ja 一部の AutoPagerize スクリプト、拡張機能、アドオンで発生する、2ページ目以降の遅延読み込み画像の問題を修正します。
// @description:zh-CN 修复某些 AutoPagerize 脚本、扩展和附加中出现的第二页或更高版本的延迟加载图像问题。
// @include     *
// @version     1
// @grant       none
// ==/UserScript==

(function() {
  const SCRIPTNAME = 'AutoPagerize Lazy Load Assistant';
  const DATASETS = [
    'src',
    'lazySrc',
    'original',
  ];
  let name = undefined; //そのページで使われているlazyloadプロパティ名は一度確定したら変わらない
  document.addEventListener('GM_AutoPagerizeNextPageLoaded', e => {
    console.log(SCRIPTNAME, e.type);
    const d = e.target;
    const imgs = d.querySelectorAll('img');
    imgs.forEach(img => {
      if(name === undefined){
        name = DATASETS.find(n => img.dataset[n]);
        if(name === undefined) return;
      }
      if(img.dataset[name] !== undefined){
        img.src = img.dataset[name];
      }
    });
  });
})();