EMP Replace Thumbnail Images with Full Images

Replace all thumbnail images on with full images

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         EMP Replace Thumbnail Images with Full Images
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Replace all thumbnail images on with full images
// @author       bighype
// @include      /^https:\/\/www\.empornium\.(me|sx|is)\/torrents\.php\?id=\d+/
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Get all <img> elements on the page
    const images = document.querySelectorAll('img');

    images.forEach(img => {
        // Check if the image is from the specific domains and ends with '.th.jpg', '.th.png', '.md.jpg', or '.md.png'
        if ((img.src.includes('jerking.empornium.ph') || img.src.includes('fapping.empornium.sx'))) {
            if (img.src.endsWith('.th.jpg') || img.src.endsWith('.md.jpg')) {
                img.src = img.src.replace(/\.th\.jpg$|\.md\.jpg$/, '.jpg');
            } else if (img.src.endsWith('.th.png') || img.src.endsWith('.md.png')) {
                img.src = img.src.replace(/\.th\.png$|\.md\.png$/, '.png');
            }
            // Also replace in the 'alt' attribute if present
            if (img.alt) {
                if (img.alt.endsWith('.th.jpg') || img.alt.endsWith('.md.jpg')) {
                    img.alt = img.alt.replace(/\.th\.jpg$|\.md\.jpg$/, '.jpg');
                } else if (img.alt.endsWith('.th.png') || img.alt.endsWith('.md.png')) {
                    img.alt = img.alt.replace(/\.th\.png$|\.md\.png$/, '.png');
                }
            }
        }
    });
})();