Empornium show hidden thumbnail blocks

Automatically expands all "Show" blocks with images.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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             Empornium show hidden thumbnail blocks
// @version          1.1.0
// @description      Automatically expands all "Show" blocks with images.
// @namespace        https://greasyfork.org/users/241444
// @author           salad: https://greasyfork.org/en/users/241444-salad
// @license          GPL-3.0-only
// @match            https://www.empornium.is/torrents.php?id=*
// @match            https://www.empornium.sx/torrents.php?id=*
// @icon             https://www.google.com/s2/favicons?domain=empornium.is
// ==/UserScript==

(() => {

  const hiddenBlocks = document.querySelectorAll('.spoiler.hidden');
  let revealedImages = 0;

  hiddenBlocks.forEach(block => {
    const images = block.querySelectorAll('img');
    if (images.length) {
      images.forEach(img => {
        img.src = img.dataset.src;
        revealedImages++;
      });

      block.classList.remove('hidden');
    }
  });

  console.info('Revealed %d hidden blocks with %d images.', hiddenBlocks.length, revealedImages);

})();