Imgur UK Unblocker

Redirects Imgur images through a proxy to bypass the UK regional block.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Imgur UK Unblocker
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Redirects Imgur images through a proxy to bypass the UK regional block.
// @author       GallantSirKnight
// @match        *://*/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const PROXY_URL = "https://external-content.duckduckgo.com/iu/?u=";

    function fixImgur(element) {
        // Fix standard <img> tags
        if (element.tagName === 'IMG' && element.src.includes('imgur.com')) {
            if (!element.src.includes(PROXY_URL)) {
                element.src = PROXY_URL + encodeURIComponent(element.src);
            }
        }
        // Fix background images (common in forums/galleries)
        if (element.style && element.style.backgroundImage.includes('imgur.com')) {
            let urlMatch = element.style.backgroundImage.match(/url\(["']?(.*?)["']?\)/);
            if (urlMatch && !urlMatch[1].includes(PROXY_URL)) {
                element.style.backgroundImage = `url("${PROXY_URL}${encodeURIComponent(urlMatch[1])}")`;
            }
        }
    }

    // Observe the page for dynamically loaded images (like on Reddit/Twitter)
    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            mutation.addedNodes.forEach((node) => {
                if (node.nodeType === 1) { // ELEMENT_NODE
                    if (node.tagName === 'IMG') fixImgur(node);
                    node.querySelectorAll('img, [style*="imgur.com"]').forEach(fixImgur);
                }
            });
        });
    });

    // Run on existing elements
    document.querySelectorAll('img, [style*="imgur.com"]').forEach(fixImgur);

    // Start observing
    observer.observe(document.documentElement, {
        childList: true,
        subtree: true
    });
})();